Nuke.Cola
Loading...
Searching...
No Matches
CSharpScriptPlugin.cs
1using System.Reflection;
2using Nuke.Common.IO;
3
5
6/// <summary>
7/// Encapsulates a C# script file (*.csx) which contains build interfaces.
8/// </summary>
10{
11 private List<Importable> _buildInterfaces = [];
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 / "CSharpScriptOutput";
19
20 var assembly = Assembly.LoadFrom(
22 );
23
24 _buildInterfaces = [.. assembly.GetBuildInterfaces(SourcePath, true)];
25 }
26}
Encapsulates a C# script file (*.csx) 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.
static AbsolutePath CompileScript(AbsolutePath scriptPath, AbsolutePath outputDirIn)
Compiles a C# script into a DLL with dotnet-script, which needs to be installed at least into the con...
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.