Skip to content

Commit d9bec7a

Browse files
Perkseysilkdotnetrunnerrunnerdotnet-bot
authored
This is the Silk.NET March 2022 Update (v2.14) (#836)
* Upgrade Assimp, regenerate bindings, attempt to update assimp natives * Add workflow for assimp * Actually make the assimp workflow run * Revert SilkTouch debug change * PR the updated binary * Fix workflows(?), bin paths * Add back the wildcards, they're not doing much harm * Fix Linux paths * Mac versioning scheme in Core.Loader, fix PR opening * Fix CI * Attempt to fix various native workflows * Formatting * Fix weird merge conflicts * Update Assimp binaries (#839) * New binaries for Assimp on Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 * New binaries for Assimp on Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 * New binaries for Assimp on Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 * New binaries for Assimp on Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 Co-authored-by: runner <[email protected]> Co-authored-by: runner <[email protected]> Co-authored-by: The Silk.NET Automaton <[email protected]> * Update SwiftShader binaries (#838) * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 * New binaries for SwiftShader on Microsoft Windows 10.0.20348 Co-authored-by: The Silk.NET Automaton <[email protected]> * Update Vulkan Loader binaries (#837) * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 Co-authored-by: The Silk.NET Automaton <[email protected]> * Update Build.Native.cs * New binaries for SwiftShader on Microsoft Windows 10.0.20348 (#842) Co-authored-by: The Silk.NET Automaton <[email protected]> * Update Assimp binaries (#841) * New binaries for Assimp on Linux 5.11.0-1028-azure #31~20.04.2-Ubuntu SMP Tue Jan 18 08:46:15 UTC 2022 * New binaries for Assimp on Microsoft Windows 10.0.20348 Co-authored-by: The Silk.NET Automaton <[email protected]> * New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 (#840) Co-authored-by: The Silk.NET Automaton <[email protected]> * Regenerate bindings, update patch notes * New binaries for ANGLE on Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 (#844) Co-authored-by: The Silk.NET Automaton <[email protected]> * New binaries for ANGLE on Linux 5.11.0-1028-azure #31~20.04.2-Ubuntu SMP Tue Jan 18 08:46:15 UTC 2022 (#845) Co-authored-by: The Silk.NET Automaton <[email protected]> Co-authored-by: silkdotnet <[email protected]> Co-authored-by: runner <[email protected]> Co-authored-by: runner <[email protected]> Co-authored-by: The Silk.NET Automaton <[email protected]>
1 parent f155284 commit d9bec7a

File tree

6 files changed

+162
-29
lines changed

6 files changed

+162
-29
lines changed

.nuke/build.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"type": "string",
119119
"enum": [
120120
"Angle",
121+
"Assimp",
121122
"BuildLibSilkDroid",
122123
"Clean",
123124
"Compile",
@@ -153,6 +154,7 @@
153154
"type": "string",
154155
"enum": [
155156
"Angle",
157+
"Assimp",
156158
"BuildLibSilkDroid",
157159
"Clean",
158160
"Compile",
@@ -186,6 +188,10 @@
186188
"Quiet",
187189
"Verbose"
188190
]
191+
},
192+
"Warnings": {
193+
"type": "boolean",
194+
"description": "Outputs build warnings instead of keeping the MSBuild logging quiet with just errors"
189195
}
190196
}
191197
}

src/infrastructure/Silk.NET.NUKE/Build.Core.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ partial class Build
8484
.After(Clean)
8585
.Executes
8686
(
87-
() => DotNetBuild
87+
() => ErrorsOnly<DotNetBuildSettings>
8888
(
8989
s => s.SetProjectFile(Solution)
9090
.SetConfiguration(Configuration)

src/infrastructure/Silk.NET.NUKE/Build.Native.cs

Lines changed: 113 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ partial class Build
3131

3232
[CanBeNull] string AndroidHomeValue;
3333

34+
static string JobsArg => string.IsNullOrWhiteSpace(GitHubActions.Instance?.GitHubJob)
35+
? $" -j{Environment.ProcessorCount}"
36+
: string.Empty;
37+
3438
string AndroidHome
3539
{
3640
get
@@ -122,10 +126,7 @@ string AndroidHome
122126
Git("checkout HEAD build/", SwiftShaderBuildPath / "..");
123127
StartProcess("cmake", ".. -DCMAKE_BUILD_TYPE=Release", SwiftShaderBuildPath)
124128
.AssertZeroExitCode();
125-
var nonGitHubActionsArgs = string.IsNullOrWhiteSpace(GitHubActions.Instance.GitHubJob)
126-
? " --parallel"
127-
: string.Empty;
128-
StartProcess("cmake", $"--build .{nonGitHubActionsArgs} --config Release", SwiftShaderBuildPath)
129+
StartProcess("cmake", $"--build .{JobsArg} --config Release", SwiftShaderBuildPath)
129130
.AssertWaitForExit(); // might fail... as long as the output exists we're happy
130131
var fname = sysName switch
131132
{
@@ -275,7 +276,9 @@ string AndroidHome
275276
}
276277
)
277278
);
279+
278280
AbsolutePath GLFWPath => RootDirectory / "build" / "submodules" / "GLFW";
281+
279282
Target GLFW => CommonTarget
280283
(
281284
x => x.Before(Compile)
@@ -286,7 +289,7 @@ string AndroidHome
286289
{
287290
var @out = GLFWPath / "build";
288291
var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON";
289-
var build = "cmake --build build --config Release";
292+
var build = $"cmake --build build --config Release{JobsArg}";
290293
EnsureCleanDirectory(@out);
291294
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes";
292295
if (OperatingSystem.IsWindows())
@@ -296,14 +299,14 @@ string AndroidHome
296299
InheritedShell(build, GLFWPath)
297300
.AssertZeroExitCode();
298301
CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x64" / "native");
299-
302+
300303
EnsureCleanDirectory(@out);
301-
304+
302305
InheritedShell($"{prepare} -A Win32", GLFWPath)
303306
.AssertZeroExitCode();
304307
InheritedShell(build, GLFWPath)
305308
.AssertZeroExitCode();
306-
309+
307310
CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x86" / "native");
308311
}
309312
else if (OperatingSystem.IsLinux())
@@ -323,19 +326,22 @@ string AndroidHome
323326
CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-x64" / "native");
324327

325328
EnsureCleanDirectory(@out);
326-
329+
327330
InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=arm64", GLFWPath)
328331
.AssertZeroExitCode();
329332
InheritedShell(build, GLFWPath)
330333
.AssertZeroExitCode();
331-
334+
332335
CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-arm64" / "native");
333336
}
337+
338+
PrUpdatedNativeBinary("GLFW");
334339
}
335340
)
336341
);
337342

338343
AbsolutePath VulkanLoaderPath => RootDirectory / "build" / "submodules" / "Vulkan-Loader";
344+
339345
Target VulkanLoader => CommonTarget
340346
(
341347
x => x.Before(Compile)
@@ -348,11 +354,12 @@ string AndroidHome
348354
EnsureCleanDirectory(@out);
349355
var abi = OperatingSystem.IsWindows() ? " -DCMAKE_GENERATOR_PLATFORM=Win32" : string.Empty;
350356
InheritedShell
351-
(
352-
$"cmake -S. -Bbuild -DUPDATE_DEPS=On -DCMAKE_BUILD_TYPE=Release{abi}",
353-
VulkanLoaderPath
354-
).AssertZeroExitCode();
355-
InheritedShell("cmake --build build --config Release", VulkanLoaderPath)
357+
(
358+
$"cmake -S. -Bbuild -DUPDATE_DEPS=On -DCMAKE_BUILD_TYPE=Release{abi}{JobsArg}",
359+
VulkanLoaderPath
360+
)
361+
.AssertZeroExitCode();
362+
InheritedShell($"cmake --build build --config Release{JobsArg}", VulkanLoaderPath)
356363
.AssertZeroExitCode();
357364
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.Vulkan.Loader.Native" / "runtimes";
358365
if (OperatingSystem.IsWindows())
@@ -374,28 +381,113 @@ string AndroidHome
374381
)
375382
);
376383

384+
AbsolutePath AssimpPath => RootDirectory / "build" / "submodules" / "Assimp";
385+
386+
Target Assimp => CommonTarget
387+
(
388+
x => x.Before(Compile)
389+
.After(Clean)
390+
.Executes
391+
(
392+
() =>
393+
{
394+
void CopyAs(AbsolutePath @out, string from, string to)
395+
{
396+
var file = @out.GlobFiles(from).First();
397+
CopyFile(file, to, FileExistsPolicy.Overwrite);
398+
}
399+
400+
var @out = AssimpPath / "build";
401+
var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON";
402+
var build = $"cmake --build build --config Release{JobsArg}";
403+
EnsureCleanDirectory(@out);
404+
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.Assimp.Native" / "runtimes";
405+
if (OperatingSystem.IsWindows())
406+
{
407+
InheritedShell($"{prepare} -A X64", AssimpPath)
408+
.AssertZeroExitCode();
409+
InheritedShell(build, AssimpPath)
410+
.AssertZeroExitCode();
411+
412+
CopyAs(@out, "bin/Release/assimp-*-mt.dll", runtimes / "win-x64" / "native" / "Assimp64.dll");
413+
EnsureCleanDirectory(@out);
414+
415+
InheritedShell($"{prepare} -A Win32", AssimpPath)
416+
.AssertZeroExitCode();
417+
InheritedShell(build, AssimpPath)
418+
.AssertZeroExitCode();
419+
420+
CopyAs(@out, "bin/Release/assimp-*-mt.dll", runtimes / "win-x86" / "native" / "Assimp32.dll");
421+
}
422+
else if (OperatingSystem.IsLinux())
423+
{
424+
InheritedShell($"{prepare} -DCMAKE_SYSTEM_PROCESSOR=x86_64", AssimpPath)
425+
.AssertZeroExitCode();
426+
InheritedShell(build, AssimpPath)
427+
.AssertZeroExitCode();
428+
429+
CopyAll(@out.GlobFiles("bin/libassimp.so.5"), runtimes / "linux-x64" / "native");
430+
}
431+
else if (OperatingSystem.IsMacOS())
432+
{
433+
InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=x86_64", AssimpPath)
434+
.AssertZeroExitCode();
435+
InheritedShell(build, AssimpPath)
436+
.AssertZeroExitCode();
437+
CopyAll(@out.GlobFiles("bin/libassimp.5.dylib"), runtimes / "osx-x64" / "native");
438+
439+
EnsureCleanDirectory(@out);
440+
441+
InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=arm64", AssimpPath)
442+
.AssertZeroExitCode();
443+
InheritedShell(build, AssimpPath)
444+
.AssertZeroExitCode();
445+
446+
CopyAll(@out.GlobFiles("bin/libassimp.5.dylib"), runtimes / "osx-arm64" / "native");
447+
}
448+
449+
PrUpdatedNativeBinary("Assimp");
450+
}
451+
)
452+
);
453+
377454
void PrUpdatedNativeBinary(string name)
378455
{
379456
var pushableToken = EnvironmentInfo.GetVariable<string>("PUSHABLE_GITHUB_TOKEN");
380457
var curBranch = GitCurrentBranch(RootDirectory);
381-
if (GitHubActions.Instance?.GitHubRepository == "dotnet/Silk.NET" &&
382-
!string.IsNullOrWhiteSpace(pushableToken) &&
458+
if (!string.IsNullOrWhiteSpace(pushableToken) &&
459+
GitHubActions.Instance?.GitHubRepository == "dotnet/Silk.NET" &&
383460
curBranch != "HEAD" &&
384461
!string.IsNullOrWhiteSpace(curBranch) &&
385462
!curBranch.StartsWith("ci/", StringComparison.OrdinalIgnoreCase) && // ignore other CI branches
386463
!curBranch.StartsWith("main", StringComparison.OrdinalIgnoreCase) && // submodule updates are done in PRs...
387464
!curBranch.StartsWith("develop/", StringComparison.OrdinalIgnoreCase))
388465
{
389466
// it's assumed that the pushable token was used to checkout the repo
467+
var suffix = string.Empty;
468+
if (OperatingSystem.IsWindows())
469+
{
470+
suffix = "/**/*.dll";
471+
}
472+
else if (OperatingSystem.IsMacOS())
473+
{
474+
suffix = "/**/*.dylib";
475+
}
476+
else if (OperatingSystem.IsLinux())
477+
{
478+
suffix = "/**/*.so*";
479+
}
480+
390481
Git("fetch --all", RootDirectory);
391482
Git("pull");
392-
Git("add src/Native", RootDirectory);
483+
Git($"add src/Native{suffix}", RootDirectory);
393484
var newBranch = $"ci/{curBranch}/{name.ToLower().Replace(' ', '_')}_bins";
394485
var curCommit = GitCurrentCommit(RootDirectory);
395486
var commitCmd = InheritedShell
396-
(
397-
$"git commit -m \"New binaries for {name} on {RuntimeInformation.OSDescription}\""
398-
).AssertWaitForExit();
487+
(
488+
$"git commit -m \"New binaries for {name} on {RuntimeInformation.OSDescription}\""
489+
)
490+
.AssertWaitForExit();
399491
if (!commitCmd.Output.Any(x => x.Text.Contains("nothing to commit", StringComparison.OrdinalIgnoreCase)))
400492
{
401493
commitCmd.AssertZeroExitCode();

src/infrastructure/Silk.NET.NUKE/Build.Packaging.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ partial class Build
1515
.Produces("build/output_packages/*.nupkg")
1616
.Executes
1717
(
18-
() => DotNetPack
18+
() => ErrorsOnly<DotNetPackSettings>
1919
(
2020
s => s.SetProject(Solution)
2121
.SetConfiguration(Configuration)

src/infrastructure/Silk.NET.NUKE/Build.ReviewHelpers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ partial class Build
2020
(
2121
() =>
2222
{
23-
var files = RootDirectory.GlobFiles("**/*.csproj").ToArray();
24-
Logger.Info($"Found {files.Length} csproj files in \"{RootDirectory}\"");
23+
var files = SourceDirectory.GlobFiles("**/*.csproj").ToArray();
24+
Logger.Info($"Found {files.Length} csproj files in \"{SourceDirectory}\"");
2525
var missedOut = new List<string>();
2626
foreach (var file in files)
2727
{
@@ -44,7 +44,7 @@ partial class Build
4444
"extension) to the AllowedExclusions array in the NUKE Build.CI.AutoReview.cs file."
4545
);
4646

47-
missedOut.Add(Path.GetRelativePath(RootDirectory, file));
47+
missedOut.Add(Path.GetRelativePath(RootDirectory, file).Replace('\\', '/'));
4848
}
4949
}
5050

src/infrastructure/Silk.NET.NUKE/Build.Support.cs

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
using Nuke.Common.IO;
1717
using Nuke.Common.ProjectModel;
1818
using Nuke.Common.Tooling;
19+
using Nuke.Common.Tools.DotNet;
1920
using Nuke.Common.Utilities;
2021
using Octokit;
21-
using Octokit.Internal;
2222
using static Nuke.Common.IO.FileSystemTasks;
2323
using static Nuke.Common.Tooling.ProcessTasks;
24+
using static Nuke.Common.Tools.DotNet.DotNetTasks;
2425

2526
partial class Build
2627
{
@@ -32,6 +33,10 @@ partial class Build
3233
/// - Microsoft VisualStudio https://nuke.build/visualstudio
3334
/// - Microsoft VSCode https://nuke.build/vscode
3435
public static int Main() => Execute<Build>(x => x.Compile);
36+
37+
[Parameter("Outputs build warnings instead of keeping the MSBuild logging quiet with just errors.")]
38+
bool Warnings;
39+
3540
static int IndexOfOrThrow(string x, char y)
3641
{
3742
var idx = x.IndexOf(y);
@@ -121,7 +126,7 @@ Target CommonTarget([CanBeNull] Target actualTarget = null) => Targets.GetOrAdd
121126
);
122127

123128
async Task AddOrUpdatePrComment(string type, string file, bool editOnly = false, params KeyValuePair<string, string>[] subs)
124-
{;
129+
{
125130
var githubToken = EnvironmentInfo.GetVariable<string>("GITHUB_TOKEN");
126131
if (string.IsNullOrWhiteSpace(githubToken))
127132
{
@@ -152,7 +157,7 @@ async Task AddOrUpdatePrComment(string type, string file, bool editOnly = false,
152157
var github = new GitHubClient
153158
(
154159
new ProductHeaderValue("Silk.NET-CI"),
155-
new InMemoryCredentialStore(new Credentials(githubToken))
160+
new Octokit.Internal.InMemoryCredentialStore(new Credentials(githubToken))
156161
);
157162

158163
var existingComment = (await github.Issue.Comment.GetAllForIssue("dotnet", "Silk.NET", pr))
@@ -185,4 +190,34 @@ async Task AddOrUpdatePrComment(string type, string file, bool editOnly = false,
185190
await github.Issue.Comment.Create("dotnet", "Silk.NET", pr, commentText);
186191
}
187192
}
193+
194+
IReadOnlyCollection<Output> ErrorsOnly<T>(Configure<T> settings) where T : ToolSettings, new()
195+
{
196+
var toolSettings = settings(new T());
197+
var arguments = toolSettings.GetProcessArguments();
198+
199+
var finalArgs = arguments.RenderForExecution();
200+
if (!Warnings)
201+
{
202+
finalArgs += " /clp:ErrorsOnly";
203+
}
204+
205+
using var proc = StartProcess
206+
(
207+
toolSettings.ProcessToolPath,
208+
finalArgs,
209+
toolSettings.ProcessWorkingDirectory,
210+
toolSettings.ProcessEnvironmentVariables,
211+
toolSettings.ProcessExecutionTimeout,
212+
toolSettings.ProcessLogOutput,
213+
toolSettings.ProcessLogInvocation,
214+
toolSettings.ProcessLogTimestamp,
215+
toolSettings.ProcessLogFile,
216+
toolSettings.ProcessCustomLogger,
217+
arguments.FilterSecrets
218+
);
219+
220+
proc.AssertZeroExitCode();
221+
return proc.Output;
222+
}
188223
}

0 commit comments

Comments
 (0)