diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json
index 740f7aaf..4f8d5a45 100644
--- a/.nuke/build.schema.json
+++ b/.nuke/build.schema.json
@@ -81,10 +81,12 @@
"CreateScoopManifest",
"CreateWinGetManifest",
"PublishDebug",
+ "PublishLinux64",
"PublishLinux64Aot",
"PublishLinux64FrameworkDependent",
"PublishLinux64SelfContained",
"PublishRelease",
+ "PublishWin64",
"PublishWin64Aot",
"PublishWin64FrameworkDependent",
"PublishWin64SelfContained",
@@ -107,10 +109,12 @@
"CreateScoopManifest",
"CreateWinGetManifest",
"PublishDebug",
+ "PublishLinux64",
"PublishLinux64Aot",
"PublishLinux64FrameworkDependent",
"PublishLinux64SelfContained",
"PublishRelease",
+ "PublishWin64",
"PublishWin64Aot",
"PublishWin64FrameworkDependent",
"PublishWin64SelfContained",
diff --git a/build.ps1 b/build.ps1
new file mode 100644
index 00000000..34bfc758
--- /dev/null
+++ b/build.ps1
@@ -0,0 +1 @@
+./src/build.ps1
\ No newline at end of file
diff --git a/build.sh b/build.sh
new file mode 100755
index 00000000..8f9f1e77
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+./src/build.sh
\ No newline at end of file
diff --git a/src/01-Build/NukeBuild/Build.cs b/src/01-Build/NukeBuild/Build.cs
index adc7460e..1a52ba1c 100644
--- a/src/01-Build/NukeBuild/Build.cs
+++ b/src/01-Build/NukeBuild/Build.cs
@@ -110,21 +110,22 @@ public sealed class Build : NukeBuild
.Produces(PathToLinux64AotZip)
.Executes(() =>
{
- var staging = StagingDirectory / "linux-x64_aot";
+ var st = StagingDirectory / "linux-x64_aot";
DotNetPublish(_ => _
.SetAssemblyVersion(AssemblyVersion)
.SetInformationalVersion(InformationalVersion)
.SetConfiguration(Configuration)
.SetProject(Solution._0_Host.Wtq_Host_Linux)
- .SetOutput(staging)
+ .SetOutput(st)
.SetProperty("PublishAot", true)
.SetProperty("InvariantGlobalization", true)
.SetRuntime("linux-x64"));
- staging.ZipTo(
+ // TODO: Remove unnecessary files.
+
+ st.ZipTo(
PathToLinux64AotZip,
- filter: x => x.HasExtension(".exe", ".jsonc"),
compressionLevel: CompressionLevel.SmallestSize,
fileMode: System.IO.FileMode.CreateNew);
});
@@ -149,9 +150,10 @@ public sealed class Build : NukeBuild
.SetRuntime("linux-x64")
.SetSelfContained(false));
+ st.DeleteFilesExceptFor("wtq", "wtq.kwin.js");
+
st.ZipTo(
PathToLinux64FrameworkDependentZip,
- filter: x => !x.HasExtension(".xml"),
compressionLevel: CompressionLevel.SmallestSize,
fileMode: System.IO.FileMode.CreateNew);
});
@@ -164,21 +166,22 @@ public sealed class Build : NukeBuild
.Produces(PathToLinux64SelfContainedZip)
.Executes(() =>
{
- var staging = StagingDirectory / "linux-x64_self-contained";
+ var st = StagingDirectory / "linux-x64_self-contained";
DotNetPublish(_ => _
.SetAssemblyVersion(AssemblyVersion)
.SetInformationalVersion(InformationalVersion)
.SetConfiguration(Configuration)
.SetProject(Solution._0_Host.Wtq_Host_Linux)
- .SetOutput(staging)
+ .SetOutput(st)
.SetPublishSingleFile(true)
.SetRuntime("linux-x64")
.SetSelfContained(true));
- staging.ZipTo(
+ st.DeleteFilesExceptFor("wtq", "wtq.kwin.js");
+
+ st.ZipTo(
PathToLinux64SelfContainedZip,
- filter: x => !x.HasExtension(".xml"),
compressionLevel: CompressionLevel.SmallestSize,
fileMode: System.IO.FileMode.CreateNew);
});
@@ -191,7 +194,7 @@ public sealed class Build : NukeBuild
.Produces(PathToWin64AotZip)
.Executes(() =>
{
- var staging = StagingDirectory / "win-x64_aot";
+ var st = StagingDirectory / "win-x64_aot";
DotNetPublish(_ => _
.SetAssemblyVersion(AssemblyVersion)
@@ -199,14 +202,15 @@ public sealed class Build : NukeBuild
.SetConfiguration(Configuration)
.SetFramework("net8.0-windows")
.SetProject(Solution._0_Host.Wtq_Host_Windows)
- .SetOutput(staging)
+ .SetOutput(st)
.SetProperty("PublishAot", true)
.SetProperty("InvariantGlobalization", true)
.SetRuntime("win-x64"));
- staging.ZipTo(
+ // TODO: Remove unnecessary files.
+
+ st.ZipTo(
PathToWin64AotZip,
- filter: x => x.HasExtension(".exe", ".jsonc"),
compressionLevel: CompressionLevel.SmallestSize,
fileMode: System.IO.FileMode.CreateNew);
});
@@ -232,9 +236,10 @@ public sealed class Build : NukeBuild
.SetRuntime("win-x64")
.SetSelfContained(false));
+ st.DeleteFilesExceptFor("wtq.exe");
+
st.ZipTo(
PathToWin64FrameworkDependentZip,
- filter: x => x.HasExtension(".exe", ".jsonc"),
compressionLevel: CompressionLevel.SmallestSize,
fileMode: System.IO.FileMode.CreateNew);
});
@@ -247,7 +252,7 @@ public sealed class Build : NukeBuild
.Produces(PathToWin64SelfContainedZip)
.Executes(() =>
{
- var staging = StagingDirectory / "win-x64_self-contained";
+ var st = StagingDirectory / "win-x64_self-contained";
DotNetPublish(_ => _
.SetAssemblyVersion(AssemblyVersion)
@@ -255,14 +260,15 @@ public sealed class Build : NukeBuild
.SetConfiguration(Configuration)
.SetFramework("net8.0-windows")
.SetProject(Solution._0_Host.Wtq_Host_Windows)
- .SetOutput(staging)
+ .SetOutput(st)
.SetPublishSingleFile(true)
.SetRuntime("win-x64")
.SetSelfContained(true));
- staging.ZipTo(
+ st.DeleteFilesExceptFor("wtq.exe");
+
+ st.ZipTo(
PathToWin64SelfContainedZip,
- filter: x => x.HasExtension(".exe", ".jsonc"),
compressionLevel: CompressionLevel.SmallestSize,
fileMode: System.IO.FileMode.CreateNew);
});
@@ -375,16 +381,28 @@ await GitHubTasks
await GitHubTasks.GitHubClient.UploadReleaseAssetToGithub(ghRelease, PathToWin64SelfContainedZip);
});
- private Target PublishDebug => _ => _
+ private Target PublishLinux64 => _ => _
.DependsOn(Clean)
.DependsOn(PublishLinux64FrameworkDependent)
.DependsOn(PublishLinux64SelfContained)
+ .Executes();
+
+ private Target PublishWin64 => _ => _
+ .DependsOn(Clean)
.DependsOn(PublishWin64FrameworkDependent)
.DependsOn(PublishWin64SelfContained)
.Triggers(CreateScoopManifest)
.Triggers(CreateWinGetManifest)
.Executes();
+ private Target PublishDebug => _ => _
+ .DependsOn(Clean)
+ .DependsOn(PublishLinux64)
+ .DependsOn(PublishWin64)
+ .Triggers(CreateScoopManifest)
+ .Triggers(CreateWinGetManifest)
+ .Executes();
+
[SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "MvdO: Invoked manually.")]
private Target PublishRelease => _ => _
.DependsOn(Clean)
diff --git a/src/01-Build/NukeBuild/NukeExtensions.cs b/src/01-Build/NukeBuild/NukeExtensions.cs
index dafe3119..d5d12cee 100644
--- a/src/01-Build/NukeBuild/NukeExtensions.cs
+++ b/src/01-Build/NukeBuild/NukeExtensions.cs
@@ -1,5 +1,8 @@
+using Nuke.Common.IO;
using Octokit;
using Serilog;
+using System;
+using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text;
@@ -11,6 +14,28 @@ public static partial class NukeExtensions
{
private static readonly string ApplicationOctetStream = "application/octet-stream";
+ ///
+ /// Deletes all files under the specified , except for any .
+ ///
+ public static void DeleteFilesExceptFor(this AbsolutePath path, params string[] excludes)
+ {
+ var wl = new HashSet(StringComparer.OrdinalIgnoreCase);
+ foreach (var ex in excludes)
+ {
+ wl.Add(ex);
+ }
+
+ foreach (var f in path.GetFiles())
+ {
+ if (wl.Contains(f.Name))
+ {
+ continue;
+ }
+
+ f.DeleteFile();
+ }
+ }
+
public static async Task GetChangeLogEntryAsync(
string path,
string ver)