Skip to content

Commit

Permalink
This is the Silk.NET March 2022 Update (v2.14) (#836)
Browse files Browse the repository at this point in the history
* 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 <runner@Mac-1647114792566.local>
Co-authored-by: runner <runner@Mac-1647114157131.local>
Co-authored-by: The Silk.NET Automaton <9011267+dotnet-bot@users.noreply.github.com>

* 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 <9011267+dotnet-bot@users.noreply.github.com>

* 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 <9011267+dotnet-bot@users.noreply.github.com>

* Update Build.Native.cs

* New binaries for SwiftShader on Microsoft Windows 10.0.20348 (#842)

Co-authored-by: The Silk.NET Automaton <9011267+dotnet-bot@users.noreply.github.com>

* 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 <9011267+dotnet-bot@users.noreply.github.com>

* New binaries for Vulkan Loader on Microsoft Windows 10.0.20348 (#840)

Co-authored-by: The Silk.NET Automaton <9011267+dotnet-bot@users.noreply.github.com>

* 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 <9011267+dotnet-bot@users.noreply.github.com>

* 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 <9011267+dotnet-bot@users.noreply.github.com>

Co-authored-by: silkdotnet <85832961+silkdotnet@users.noreply.github.com>
Co-authored-by: runner <runner@Mac-1647114792566.local>
Co-authored-by: runner <runner@Mac-1647114157131.local>
Co-authored-by: The Silk.NET Automaton <9011267+dotnet-bot@users.noreply.github.com>
  • Loading branch information
5 people authored Mar 15, 2022
1 parent f155284 commit d9bec7a
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 29 deletions.
6 changes: 6 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"type": "string",
"enum": [
"Angle",
"Assimp",
"BuildLibSilkDroid",
"Clean",
"Compile",
Expand Down Expand Up @@ -153,6 +154,7 @@
"type": "string",
"enum": [
"Angle",
"Assimp",
"BuildLibSilkDroid",
"Clean",
"Compile",
Expand Down Expand Up @@ -186,6 +188,10 @@
"Quiet",
"Verbose"
]
},
"Warnings": {
"type": "boolean",
"description": "Outputs build warnings instead of keeping the MSBuild logging quiet with just errors"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/Silk.NET.NUKE/Build.Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ partial class Build
.After(Clean)
.Executes
(
() => DotNetBuild
() => ErrorsOnly<DotNetBuildSettings>
(
s => s.SetProjectFile(Solution)
.SetConfiguration(Configuration)
Expand Down
134 changes: 113 additions & 21 deletions src/infrastructure/Silk.NET.NUKE/Build.Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ partial class Build

[CanBeNull] string AndroidHomeValue;

static string JobsArg => string.IsNullOrWhiteSpace(GitHubActions.Instance?.GitHubJob)
? $" -j{Environment.ProcessorCount}"
: string.Empty;

string AndroidHome
{
get
Expand Down Expand Up @@ -122,10 +126,7 @@ string AndroidHome
Git("checkout HEAD build/", SwiftShaderBuildPath / "..");
StartProcess("cmake", ".. -DCMAKE_BUILD_TYPE=Release", SwiftShaderBuildPath)
.AssertZeroExitCode();
var nonGitHubActionsArgs = string.IsNullOrWhiteSpace(GitHubActions.Instance.GitHubJob)
? " --parallel"
: string.Empty;
StartProcess("cmake", $"--build .{nonGitHubActionsArgs} --config Release", SwiftShaderBuildPath)
StartProcess("cmake", $"--build .{JobsArg} --config Release", SwiftShaderBuildPath)
.AssertWaitForExit(); // might fail... as long as the output exists we're happy
var fname = sysName switch
{
Expand Down Expand Up @@ -275,7 +276,9 @@ string AndroidHome
}
)
);

AbsolutePath GLFWPath => RootDirectory / "build" / "submodules" / "GLFW";

Target GLFW => CommonTarget
(
x => x.Before(Compile)
Expand All @@ -286,7 +289,7 @@ string AndroidHome
{
var @out = GLFWPath / "build";
var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON";
var build = "cmake --build build --config Release";
var build = $"cmake --build build --config Release{JobsArg}";
EnsureCleanDirectory(@out);
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.GLFW.Native" / "runtimes";
if (OperatingSystem.IsWindows())
Expand All @@ -296,14 +299,14 @@ string AndroidHome
InheritedShell(build, GLFWPath)
.AssertZeroExitCode();
CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x64" / "native");
EnsureCleanDirectory(@out);
InheritedShell($"{prepare} -A Win32", GLFWPath)
.AssertZeroExitCode();
InheritedShell(build, GLFWPath)
.AssertZeroExitCode();
CopyAll(@out.GlobFiles("src/Release/glfw3.dll"), runtimes / "win-x86" / "native");
}
else if (OperatingSystem.IsLinux())
Expand All @@ -323,19 +326,22 @@ string AndroidHome
CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-x64" / "native");
EnsureCleanDirectory(@out);
InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=arm64", GLFWPath)
.AssertZeroExitCode();
InheritedShell(build, GLFWPath)
.AssertZeroExitCode();
CopyAll(@out.GlobFiles("src/libglfw.3.dylib"), runtimes / "osx-arm64" / "native");
}
PrUpdatedNativeBinary("GLFW");
}
)
);

AbsolutePath VulkanLoaderPath => RootDirectory / "build" / "submodules" / "Vulkan-Loader";

Target VulkanLoader => CommonTarget
(
x => x.Before(Compile)
Expand All @@ -348,11 +354,12 @@ string AndroidHome
EnsureCleanDirectory(@out);
var abi = OperatingSystem.IsWindows() ? " -DCMAKE_GENERATOR_PLATFORM=Win32" : string.Empty;
InheritedShell
(
$"cmake -S. -Bbuild -DUPDATE_DEPS=On -DCMAKE_BUILD_TYPE=Release{abi}",
VulkanLoaderPath
).AssertZeroExitCode();
InheritedShell("cmake --build build --config Release", VulkanLoaderPath)
(
$"cmake -S. -Bbuild -DUPDATE_DEPS=On -DCMAKE_BUILD_TYPE=Release{abi}{JobsArg}",
VulkanLoaderPath
)
.AssertZeroExitCode();
InheritedShell($"cmake --build build --config Release{JobsArg}", VulkanLoaderPath)
.AssertZeroExitCode();
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.Vulkan.Loader.Native" / "runtimes";
if (OperatingSystem.IsWindows())
Expand All @@ -374,28 +381,113 @@ string AndroidHome
)
);

AbsolutePath AssimpPath => RootDirectory / "build" / "submodules" / "Assimp";

Target Assimp => CommonTarget
(
x => x.Before(Compile)
.After(Clean)
.Executes
(
() =>
{
void CopyAs(AbsolutePath @out, string from, string to)
{
var file = @out.GlobFiles(from).First();
CopyFile(file, to, FileExistsPolicy.Overwrite);
}
var @out = AssimpPath / "build";
var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON";
var build = $"cmake --build build --config Release{JobsArg}";
EnsureCleanDirectory(@out);
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.Assimp.Native" / "runtimes";
if (OperatingSystem.IsWindows())
{
InheritedShell($"{prepare} -A X64", AssimpPath)
.AssertZeroExitCode();
InheritedShell(build, AssimpPath)
.AssertZeroExitCode();
CopyAs(@out, "bin/Release/assimp-*-mt.dll", runtimes / "win-x64" / "native" / "Assimp64.dll");
EnsureCleanDirectory(@out);
InheritedShell($"{prepare} -A Win32", AssimpPath)
.AssertZeroExitCode();
InheritedShell(build, AssimpPath)
.AssertZeroExitCode();
CopyAs(@out, "bin/Release/assimp-*-mt.dll", runtimes / "win-x86" / "native" / "Assimp32.dll");
}
else if (OperatingSystem.IsLinux())
{
InheritedShell($"{prepare} -DCMAKE_SYSTEM_PROCESSOR=x86_64", AssimpPath)
.AssertZeroExitCode();
InheritedShell(build, AssimpPath)
.AssertZeroExitCode();
CopyAll(@out.GlobFiles("bin/libassimp.so.5"), runtimes / "linux-x64" / "native");
}
else if (OperatingSystem.IsMacOS())
{
InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=x86_64", AssimpPath)
.AssertZeroExitCode();
InheritedShell(build, AssimpPath)
.AssertZeroExitCode();
CopyAll(@out.GlobFiles("bin/libassimp.5.dylib"), runtimes / "osx-x64" / "native");
EnsureCleanDirectory(@out);
InheritedShell($"{prepare} -DCMAKE_OSX_ARCHITECTURES=arm64", AssimpPath)
.AssertZeroExitCode();
InheritedShell(build, AssimpPath)
.AssertZeroExitCode();
CopyAll(@out.GlobFiles("bin/libassimp.5.dylib"), runtimes / "osx-arm64" / "native");
}
PrUpdatedNativeBinary("Assimp");
}
)
);

void PrUpdatedNativeBinary(string name)
{
var pushableToken = EnvironmentInfo.GetVariable<string>("PUSHABLE_GITHUB_TOKEN");
var curBranch = GitCurrentBranch(RootDirectory);
if (GitHubActions.Instance?.GitHubRepository == "dotnet/Silk.NET" &&
!string.IsNullOrWhiteSpace(pushableToken) &&
if (!string.IsNullOrWhiteSpace(pushableToken) &&
GitHubActions.Instance?.GitHubRepository == "dotnet/Silk.NET" &&
curBranch != "HEAD" &&
!string.IsNullOrWhiteSpace(curBranch) &&
!curBranch.StartsWith("ci/", StringComparison.OrdinalIgnoreCase) && // ignore other CI branches
!curBranch.StartsWith("main", StringComparison.OrdinalIgnoreCase) && // submodule updates are done in PRs...
!curBranch.StartsWith("develop/", StringComparison.OrdinalIgnoreCase))
{
// it's assumed that the pushable token was used to checkout the repo
var suffix = string.Empty;
if (OperatingSystem.IsWindows())
{
suffix = "/**/*.dll";
}
else if (OperatingSystem.IsMacOS())
{
suffix = "/**/*.dylib";
}
else if (OperatingSystem.IsLinux())
{
suffix = "/**/*.so*";
}

Git("fetch --all", RootDirectory);
Git("pull");
Git("add src/Native", RootDirectory);
Git($"add src/Native{suffix}", RootDirectory);
var newBranch = $"ci/{curBranch}/{name.ToLower().Replace(' ', '_')}_bins";
var curCommit = GitCurrentCommit(RootDirectory);
var commitCmd = InheritedShell
(
$"git commit -m \"New binaries for {name} on {RuntimeInformation.OSDescription}\""
).AssertWaitForExit();
(
$"git commit -m \"New binaries for {name} on {RuntimeInformation.OSDescription}\""
)
.AssertWaitForExit();
if (!commitCmd.Output.Any(x => x.Text.Contains("nothing to commit", StringComparison.OrdinalIgnoreCase)))
{
commitCmd.AssertZeroExitCode();
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/Silk.NET.NUKE/Build.Packaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ partial class Build
.Produces("build/output_packages/*.nupkg")
.Executes
(
() => DotNetPack
() => ErrorsOnly<DotNetPackSettings>
(
s => s.SetProject(Solution)
.SetConfiguration(Configuration)
Expand Down
6 changes: 3 additions & 3 deletions src/infrastructure/Silk.NET.NUKE/Build.ReviewHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ partial class Build
(
() =>
{
var files = RootDirectory.GlobFiles("**/*.csproj").ToArray();
Logger.Info($"Found {files.Length} csproj files in \"{RootDirectory}\"");
var files = SourceDirectory.GlobFiles("**/*.csproj").ToArray();
Logger.Info($"Found {files.Length} csproj files in \"{SourceDirectory}\"");
var missedOut = new List<string>();
foreach (var file in files)
{
Expand All @@ -44,7 +44,7 @@ partial class Build
"extension) to the AllowedExclusions array in the NUKE Build.CI.AutoReview.cs file."
);
missedOut.Add(Path.GetRelativePath(RootDirectory, file));
missedOut.Add(Path.GetRelativePath(RootDirectory, file).Replace('\\', '/'));
}
}
Expand Down
41 changes: 38 additions & 3 deletions src/infrastructure/Silk.NET.NUKE/Build.Support.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities;
using Octokit;
using Octokit.Internal;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tooling.ProcessTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;

partial class Build
{
Expand All @@ -32,6 +33,10 @@ partial class Build
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main() => Execute<Build>(x => x.Compile);

[Parameter("Outputs build warnings instead of keeping the MSBuild logging quiet with just errors.")]
bool Warnings;

static int IndexOfOrThrow(string x, char y)
{
var idx = x.IndexOf(y);
Expand Down Expand Up @@ -121,7 +126,7 @@ Target CommonTarget([CanBeNull] Target actualTarget = null) => Targets.GetOrAdd
);

async Task AddOrUpdatePrComment(string type, string file, bool editOnly = false, params KeyValuePair<string, string>[] subs)
{;
{
var githubToken = EnvironmentInfo.GetVariable<string>("GITHUB_TOKEN");
if (string.IsNullOrWhiteSpace(githubToken))
{
Expand Down Expand Up @@ -152,7 +157,7 @@ async Task AddOrUpdatePrComment(string type, string file, bool editOnly = false,
var github = new GitHubClient
(
new ProductHeaderValue("Silk.NET-CI"),
new InMemoryCredentialStore(new Credentials(githubToken))
new Octokit.Internal.InMemoryCredentialStore(new Credentials(githubToken))
);

var existingComment = (await github.Issue.Comment.GetAllForIssue("dotnet", "Silk.NET", pr))
Expand Down Expand Up @@ -185,4 +190,34 @@ async Task AddOrUpdatePrComment(string type, string file, bool editOnly = false,
await github.Issue.Comment.Create("dotnet", "Silk.NET", pr, commentText);
}
}

IReadOnlyCollection<Output> ErrorsOnly<T>(Configure<T> settings) where T : ToolSettings, new()
{
var toolSettings = settings(new T());
var arguments = toolSettings.GetProcessArguments();

var finalArgs = arguments.RenderForExecution();
if (!Warnings)
{
finalArgs += " /clp:ErrorsOnly";
}

using var proc = StartProcess
(
toolSettings.ProcessToolPath,
finalArgs,
toolSettings.ProcessWorkingDirectory,
toolSettings.ProcessEnvironmentVariables,
toolSettings.ProcessExecutionTimeout,
toolSettings.ProcessLogOutput,
toolSettings.ProcessLogInvocation,
toolSettings.ProcessLogTimestamp,
toolSettings.ProcessLogFile,
toolSettings.ProcessCustomLogger,
arguments.FilterSecrets
);

proc.AssertZeroExitCode();
return proc.Output;
}
}

0 comments on commit d9bec7a

Please sign in to comment.