Skip to content

Commit a2b6bae

Browse files
committed
Port latest 2.X NUKE changes to 3.0
2 parents 4b1b9c3 + 1092adf commit a2b6bae

16 files changed

+1725
-484
lines changed

.nuke

Lines changed: 0 additions & 1 deletion
This file was deleted.

.nuke/build.schema.json

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "Build Schema",
4+
"$ref": "#/definitions/build",
5+
"definitions": {
6+
"build": {
7+
"type": "object",
8+
"properties": {
9+
"Configuration": {
10+
"type": "string",
11+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)"
12+
},
13+
"Continue": {
14+
"type": "boolean",
15+
"description": "Indicates to continue a previously failed build attempt"
16+
},
17+
"Help": {
18+
"type": "boolean",
19+
"description": "Shows the help text for this build assembly"
20+
},
21+
"Host": {
22+
"type": "string",
23+
"description": "Host for execution. Default is 'automatic'",
24+
"enum": [
25+
"AppVeyor",
26+
"AzurePipelines",
27+
"Bamboo",
28+
"Bitrise",
29+
"GitHubActions",
30+
"GitLab",
31+
"Jenkins",
32+
"Rider",
33+
"SpaceAutomation",
34+
"TeamCity",
35+
"Terminal",
36+
"TravisCI",
37+
"VisualStudio",
38+
"VSCode"
39+
]
40+
},
41+
"MsbuildProperties": {
42+
"type": "array",
43+
"description": "Extra properties passed to MSBuild commands",
44+
"items": {
45+
"type": "string"
46+
}
47+
},
48+
"Native": {
49+
"type": "boolean",
50+
"description": "Build native code"
51+
},
52+
"NoLogo": {
53+
"type": "boolean",
54+
"description": "Disables displaying the NUKE logo"
55+
},
56+
"NugetApiKey": {
57+
"type": "string",
58+
"description": "The API key used to push packages and symbols packages to NuGet"
59+
},
60+
"NugetFeed": {
61+
"type": "string",
62+
"description": "NuGet feed"
63+
},
64+
"NugetNoServiceEndpoint": {
65+
"type": "boolean",
66+
"description": "NuGet -NoServiceEndpoint"
67+
},
68+
"NugetPassword": {
69+
"type": "string",
70+
"description": "NuGet password"
71+
},
72+
"NugetUsername": {
73+
"type": "string",
74+
"description": "NuGet username"
75+
},
76+
"OriginalSolution": {
77+
"type": "string",
78+
"description": "Path to a solution file that is automatically loaded"
79+
},
80+
"Partition": {
81+
"type": "string",
82+
"description": "Partition to use on CI"
83+
},
84+
"Plan": {
85+
"type": "boolean",
86+
"description": "Shows the execution plan (HTML)"
87+
},
88+
"Profile": {
89+
"type": "array",
90+
"description": "Defines the profiles to load",
91+
"items": {
92+
"type": "string"
93+
}
94+
},
95+
"Projects": {
96+
"type": "array",
97+
"description": "If specified, generates a solution including only the specified projects or group of projects. You can provide individual project names or the name of the folder in which they're contained e.g. \"--projects opengl examples/csharp vulkan microsoft core.win32extras silk.net.opencl\". The Silk.NET prefix for individual projects is optional, but folder names will be preferred over project names so if you only want \"Silk.NET.Vulkan\" and not everything in \"src/Vulkan\", use \"--projects silk.net.vulkan\". The solution include project dependencies. The solution will be regenerated whenever you run a NUKE build with this specified, but if you don't want to run a build just use \"nuke sln --projects ...\" to run a dummy target",
98+
"items": {
99+
"type": "string"
100+
}
101+
},
102+
"Root": {
103+
"type": "string",
104+
"description": "Root directory during build execution"
105+
},
106+
"SignPassword": {
107+
"type": "string",
108+
"description": "Code-signing service password"
109+
},
110+
"SignUsername": {
111+
"type": "string",
112+
"description": "Code-signing service username"
113+
},
114+
"Skip": {
115+
"type": "array",
116+
"description": "List of targets to be skipped. Empty list skips all dependencies",
117+
"items": {
118+
"type": "string",
119+
"enum": [
120+
"Angle",
121+
"Assimp",
122+
"BuildLibSilkDroid",
123+
"Clean",
124+
"Compile",
125+
"DeclareApi",
126+
"EnsureApiDeclared",
127+
"FullCompile",
128+
"FullPack",
129+
"FullPushToNuGet",
130+
"GLFW",
131+
"Pack",
132+
"Prerequisites",
133+
"PushToNuGet",
134+
"RegenerateBindings",
135+
"Restore",
136+
"ShipApi",
137+
"SignPackages",
138+
"Sln",
139+
"SwiftShader",
140+
"Test",
141+
"ValidateSolution",
142+
"VulkanLoader"
143+
]
144+
}
145+
},
146+
"Sln": {
147+
"type": "boolean",
148+
"description": "If specified, when using the clean target removes the generated solution and stops"
149+
},
150+
"Target": {
151+
"type": "array",
152+
"description": "List of targets to be invoked. Default is '{default_target}'",
153+
"items": {
154+
"type": "string",
155+
"enum": [
156+
"Angle",
157+
"Assimp",
158+
"BuildLibSilkDroid",
159+
"Clean",
160+
"Compile",
161+
"DeclareApi",
162+
"EnsureApiDeclared",
163+
"FullCompile",
164+
"FullPack",
165+
"FullPushToNuGet",
166+
"GLFW",
167+
"Pack",
168+
"Prerequisites",
169+
"PushToNuGet",
170+
"RegenerateBindings",
171+
"Restore",
172+
"ShipApi",
173+
"SignPackages",
174+
"Sln",
175+
"SwiftShader",
176+
"Test",
177+
"ValidateSolution",
178+
"VulkanLoader"
179+
]
180+
}
181+
},
182+
"Verbosity": {
183+
"type": "string",
184+
"description": "Logging verbosity during build execution. Default is 'Normal'",
185+
"enum": [
186+
"Minimal",
187+
"Normal",
188+
"Quiet",
189+
"Verbose"
190+
]
191+
},
192+
"Warnings": {
193+
"type": "boolean",
194+
"description": "Outputs build warnings instead of keeping the MSBuild logging quiet with just errors"
195+
}
196+
}
197+
}
198+
}
199+
}

.nuke/parameters.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./build.schema.json",
3+
"OriginalSolution": "Silk.NET.sln"
4+
}

src/infrastructure/Silk.NET.NUKE/.editorconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
[*.cs]
2-
dotnet_style_qualification_for_field = false:warning
3-
dotnet_style_qualification_for_property = false:warning
4-
dotnet_style_qualification_for_method = false:warning
5-
dotnet_style_qualification_for_event = false:warning
62
dotnet_style_require_accessibility_modifiers = never:warning
73

84
csharp_style_expression_bodied_methods = true:silent
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.IO;
6+
using System.Linq;
7+
using Nuke.Common;
8+
using Nuke.Common.CI;
9+
using Nuke.Common.Tooling;
10+
using Nuke.Common.Tools.DotNet;
11+
using Nuke.Common.Tools.SignClient;
12+
using static Nuke.Common.Tools.DotNet.DotNetTasks;
13+
using static Nuke.Common.Tooling.ProcessTasks;
14+
15+
partial class Build
16+
{
17+
[Parameter("Code-signing service username")] readonly string SignUsername;
18+
[Parameter("Code-signing service password")] readonly string SignPassword;
19+
bool CanCodeSign => !string.IsNullOrWhiteSpace(SignUsername) && !string.IsNullOrWhiteSpace(SignPassword);
20+
21+
Target SignPackages => CommonTarget
22+
(
23+
x => x.Before(PushToNuGet)
24+
.After(Pack)
25+
.Produces("build/output_packages/*.nupkg")
26+
.Executes
27+
(
28+
() =>
29+
{
30+
if (!CanCodeSign)
31+
{
32+
ControlFlow.Fail("SignClient username and/or password not specified.");
33+
}
34+
35+
var outputs = Enumerable.Empty<Output>();
36+
var basePath = RootDirectory / "build" / "codesigning";
37+
var execPath = basePath / "tool" / (OperatingSystem.IsWindows() ? "SignClient.exe" : "SignClient");
38+
if (!File.Exists(execPath))
39+
{
40+
outputs = outputs.Concat
41+
(
42+
DotNetToolInstall
43+
(
44+
s => s.SetToolInstallationPath(basePath / "tool")
45+
.SetPackageName("SignClient")
46+
)
47+
);
48+
}
49+
50+
return Packages.Aggregate
51+
(
52+
outputs, (current, pkg) => current.Concat
53+
(
54+
// TODO this doesn't work for some reason
55+
// > C:\Users\perks\Documents\_Silk.NET\Silk.NET\build\codesigning\tool\SignClient.exe sign \
56+
// --config C:\Users\perks\Documents\_Silk.NET\Silk.NET\build\codesigning\config.json \
57+
// --input C:\Users\perks\Documents\_Silk.NET\Silk.NET\build\output_packages\Silk.NET.2.11.0.nupkg \
58+
// --baseDirectory C:\Users\perks\Documents\_Silk.NET\Silk.NET\build\output_packages \
59+
// --fileList C:\Users\perks\Documents\_Silk.NET\Silk.NET\build\codesigning\filelist.txt \
60+
// --secret [hidden] \
61+
// --user *** \
62+
// --name Silk.NET \
63+
// --description Silk.NET \
64+
// --descriptionUrl https://github.com/dotnet/Silk.NET
65+
// @ C:\Users\perks\Documents\_Silk.NET\Silk.NET
66+
// Error output:
67+
// --name parameter is required
68+
// SignClientSign
69+
// (
70+
// s => s.SetProcessToolPath(execPath)
71+
// .SetBaseDirectory(PackageDirectory)
72+
// .SetInput(pkg)
73+
// .SetConfig(basePath / "config.json")
74+
// .SetFileList(basePath / "filelist.txt")
75+
// .SetUsername(SignUsername)
76+
// .SetSecret(SignPassword)
77+
// .SetName("Silk.NET")
78+
// .SetDescription("Silk.NET")
79+
// .SetDescriptionUrl("https://github.com/dotnet/Silk.NET")
80+
// )
81+
StartProcess
82+
(
83+
execPath,
84+
"sign " +
85+
$"--baseDirectory {PackageDirectory} " +
86+
$"--input \"{pkg}\" " +
87+
$"--config \"{basePath / "config.json"}\" " +
88+
$"--filelist \"{basePath / "filelist.txt"}\" " +
89+
$"--user \"{SignUsername}\" " +
90+
$"--secret \"{SignPassword}\" " +
91+
"--name \"Silk.NET\" " +
92+
"--description \"Silk.NET\" " +
93+
"--descriptionUrl \"https://github.com/dotnet/Silk.NET\""
94+
).AssertZeroExitCode().Output
95+
)
96+
);
97+
}
98+
)
99+
);
100+
}

0 commit comments

Comments
 (0)