Nuke.Cola
Loading...
Searching...
No Matches
DotnetProjectPlugin.cs
1using System.Reflection;
2using Nuke.Common.IO;
3
5
6/// <summary>
7/// Encapsulates a .NET project (*.*proj) which contains build interfaces.
8/// </summary>
10{
11 private List<Importable> _buildInterfaces = new();
12 public IEnumerable<Importable> BuildInterfaces => _buildInterfaces;
13
14 public AbsolutePath SourcePath { init; get; } = (AbsolutePath) "/";
15
16 public void Compile(BuildContext context)
17 {
18 var compiledRoot = context.Temporary / "DotnetProjectOutput";
19
20 var assembly = Assembly.LoadFrom(
21 DotnetCommon.CompileProject(SourcePath, compiledRoot)
22 );
23
24 _buildInterfaces = assembly.GetBuildInterfaces(SourcePath, false).ToList();
25 }
26}
Encapsulates a .NET project (*.*proj) which contains build interfaces.
IEnumerable< Importable > BuildInterfaces
List of build interfaces which are found in the plugin.
AbsolutePath SourcePath
Original source path of the plugin (can be either a script or a project file)
void Compile(BuildContext context)
This should be called before attempting to gather resulting types from the plugin.
Implementation of this plugin must provide one build plugin which can be compiled to a ....
record class BuildContext(AbsolutePath Temporary, AbsolutePath Root)
Local paths for plugin discovery and compilation.