Skip to content

Commit

Permalink
update nuke
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasteles committed Nov 29, 2024
1 parent bf9ec63 commit 8c60441
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"rollForward": false
},
"nuke.globaltool": {
"version": "8.1.4",
"version": "9.0.1",
"commands": [
"nuke"
],
Expand All @@ -31,4 +31,4 @@
"rollForward": false
}
}
}
}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>

<PackageReference Include="SonarAnalyzer.CSharp" Version="9.32.*">
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.3.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
46 changes: 24 additions & 22 deletions _build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Collections.Generic;

class MainBuild : NukeBuild
{
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
Expand Down Expand Up @@ -35,29 +37,28 @@ class MainBuild : NukeBuild
.DependsOn(Clean)
.Executes(() => DotNetRestore(s => s.SetProjectFile(Solution)));

IReadOnlyCollection<Output> BuildProj(AbsolutePath project, Configuration configuration) =>
DotNetBuild(s => s
.SetProjectFile(project)
.SetConfiguration(configuration)
.EnableNoLogo()
.EnableNoRestore()
.SetProperty("UseSharedCompilation", false)
.AddProcessAdditionalArguments("/nodeReuse:false"));

Target Build => _ => _
.Description("Builds SDK")
.DependsOn(Restore)
.Executes(() =>
DotNetBuild(s => s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.EnableNoLogo()
.EnableNoRestore()
.SetProperty("UseSharedCompilation", false)
.SetProcessArgumentConfigurator(args => args.Add("/nodeReuse:false")))
);
.Executes(() => BuildProj(Solution, Configuration));

Target BuildSamples => _ => _
.Description("Builds SDK and Samples")
.Executes(() =>
DotNetBuild(s => s
.SetProjectFile(RootDirectory / "Samples" / "Backdash.Samples.sln")
.SetConfiguration(Configuration)
.EnableNoLogo()
.SetProperty("UseSharedCompilation", false)
.SetProcessArgumentConfigurator(args => args.Add("/nodeReuse:false")))
);
{
var sampleSln = RootDirectory / "Samples" / "Backdash.Samples.sln";
DotNetRestore(s => s.SetProjectFile(sampleSln));
BuildProj(sampleSln, Configuration);
});

Target BuildAll => _ => _
.Description("Build All Projects")
Expand Down Expand Up @@ -148,11 +149,12 @@ class MainBuild : NukeBuild

Target BuildDocs => _ => _
.Description("Build DocFX")
.DependsOn(Restore)
.Executes(() =>
{
DocsSitePath.CreateOrCleanDirectory();
(DocsPath / "api").CreateOrCleanDirectory();
DotNetBuild(s => s.SetProjectFile(Solution).SetConfiguration(Configuration.Release));
BuildProj(Solution, Configuration.Release);
DocFX.Build(c => c
.SetProcessWorkingDirectory(DocsPath)
.SetProcessEnvironmentVariable(DocFX.DocFXSourceBranchName, MasterBranch)
Expand All @@ -161,9 +163,10 @@ class MainBuild : NukeBuild

Target Docs => _ => _
.Description("View DocFX")
.DependsOn(Restore)
.Executes(() =>
{
DotNetBuild(s => s.SetProjectFile(Solution).SetConfiguration(Configuration.Release));
BuildProj(Solution, Configuration.Release);
DocFX.Serve(c => c
.SetProcessWorkingDirectory(DocsPath)
.SetProcessEnvironmentVariable(DocFX.DocFXSourceBranchName, MasterBranch));
Expand All @@ -179,18 +182,17 @@ class MainBuild : NukeBuild
.Executes(() =>
DotNetPublish(s => s
.EnableNoLogo()
.EnableNoRestore()
.SetProject(Solution.FindProject("Backdash"))
.SetConfiguration(Configuration.Release)
.AddProperty("DefineConstants", "AOT_ENABLED")
.SetProcessArgumentConfigurator(args => args.Add("--use-current-runtime"))
));
.AddProcessAdditionalArguments("--use-current-runtime"))
);


public static int Main() => Execute<MainBuild>();

protected override void OnBuildInitialized() =>
DotNetToolRestore(c => c.DisableProcessLogOutput());
DotNetToolRestore(c => c.DisableProcessOutputLogging());

protected override void OnBuildFinished()
{
Expand Down
10 changes: 10 additions & 0 deletions _build/Configuration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.ComponentModel;

[TypeConverter(typeof(TypeConverter<Configuration>))]
public class Configuration : Enumeration
{
public static Configuration Debug = new() { Value = nameof(Debug) };
public static Configuration Release = new() { Value = nameof(Release) };

public static implicit operator string(Configuration configuration) => configuration.Value;
}
2 changes: 1 addition & 1 deletion _build/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
global using static Nuke.Common.Tools.Docker.DockerTasks;
global using static Nuke.Common.Tools.DotNet.DotNetTasks;
global using NukePlus;
global using static NukePlus.NukePlus;
global using static NukePlus.NukePlusTasks;
global using static NukePlus.DotnetLocalTools;
7 changes: 4 additions & 3 deletions _build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
<Nullable>disable</Nullable>
<IsPackable>false</IsPackable>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" Version="8.1.4" />
<PackageReference Include="NukePlus" Version="1.1.2" />
<PackageReference Include="Nuke.Common" Version="9.0.1" />
<PackageReference Include="NukePlus" Version="2.0.1" />
</ItemGroup>
</Project>

0 comments on commit 8c60441

Please sign in to comment.