From 4dccfaa437acaadbcbccbd89f01e08ef38a23e72 Mon Sep 17 00:00:00 2001 From: Bepis <36346617+bbepis@users.noreply.github.com> Date: Mon, 27 Nov 2023 04:18:48 +1100 Subject: [PATCH 1/5] Fix netfx & netcore build targets, and add target framework variants --- .../BepInEx.NET.CoreCLR.csproj | 4 +- .../BepInEx.NET.Framework.Launcher.csproj | 5 ++- .../BepInEx.NET.Shared.shproj | 25 +++++++------ build/DistributionTarget.cs | 37 +++++++++++++++---- build/Program.cs | 37 ++++++++++++------- 5 files changed, 72 insertions(+), 36 deletions(-) diff --git a/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj b/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj index d42685d..b50cd86 100644 --- a/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj +++ b/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj @@ -2,10 +2,10 @@ BepInEx support library for CoreCLR games - netcoreapp3.1 + netcoreapp3.1;net6 $(BuildDir)/NET.CoreCLR true - false + true diff --git a/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj b/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj index 5e5fe96..353ed2b 100644 --- a/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj +++ b/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj @@ -2,9 +2,9 @@ BepInEx support library for .NET Framework games Exe - net452 + net40;net452 true - false + true x86 $(BuildDir)/NET.Framework @@ -16,6 +16,7 @@ + diff --git a/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj b/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj index 779cd4d..900fbeb 100644 --- a/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj +++ b/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj @@ -1,13 +1,16 @@ - - 067bcc8c-fc25-4929-b4f4-c6a5a7496994 - 14.0 - - - - - - - - + + 067bcc8c-fc25-4929-b4f4-c6a5a7496994 + 14.0 + + + + + + + + + + + \ No newline at end of file diff --git a/build/DistributionTarget.cs b/build/DistributionTarget.cs index 6aed13c..2e91da3 100644 --- a/build/DistributionTarget.cs +++ b/build/DistributionTarget.cs @@ -1,12 +1,35 @@ -using System; +using System; -readonly record struct DistributionTarget(string DistributionIdentifier, string RuntimeIndentifier) +readonly struct DistributionTarget { - public readonly string Arch = RuntimeIndentifier.Split('-')[1]; - public readonly string Engine = DistributionIdentifier.Split('.')[0]; - public readonly string Os = RuntimeIndentifier.Split('-')[0]; - public readonly string Runtime = DistributionIdentifier.Split('.')[1]; - public readonly string Target = $"{DistributionIdentifier}-{RuntimeIndentifier}"; + public DistributionTarget(string distributionIdentifier, string runtimeIdentifier) + { + DistributionIdentifier = distributionIdentifier; + RuntimeIdentifier = runtimeIdentifier; + FrameworkTarget = null; + + Os = RuntimeIdentifier.Split('-')[0]; + Arch = RuntimeIdentifier.Split('-')[1]; + Engine = DistributionIdentifier.Split('.')[0]; + Runtime = DistributionIdentifier.Split('.')[1]; + Target = $"{DistributionIdentifier}-{RuntimeIdentifier}"; + } + + public DistributionTarget(string distributionIdentifier, string runtimeIdentifier, string frameworkTarget) : this(distributionIdentifier, runtimeIdentifier) + { + FrameworkTarget = frameworkTarget; + Target = $"{DistributionIdentifier}-{FrameworkTarget}-{RuntimeIdentifier}"; + } + + public readonly string DistributionIdentifier; + public readonly string RuntimeIdentifier; + public readonly string FrameworkTarget; + + public readonly string Arch; + public readonly string Engine; + public readonly string Os; + public readonly string Runtime; + public readonly string Target; public string ClearOsName => Os switch { diff --git a/build/Program.cs b/build/Program.cs index ea5f0a9..bf4987c 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -50,8 +50,10 @@ public class BuildContext : FrostingContext new("Unity.IL2CPP", "win-x64"), new("Unity.IL2CPP", "linux-x64"), new("Unity.IL2CPP", "macos-x64"), - new("NET.Framework", "win-x64"), - new("NET.CoreCLR", "win-x64") + new("NET.Framework", "win-x86", "net40"), + new("NET.Framework", "win-x86", "net452"), + new("NET.CoreCLR", "win-x64", "netcoreapp3.1"), + new("NET.CoreCLR", "win-x64", "net6") }; @@ -241,8 +243,12 @@ public sealed class MakeDistTask : FrostingTask ctx.CreateDirectory(bepInExDir.Combine("patchers")); File.WriteAllText(targetDir.CombineWithFilePath("changelog.txt").FullPath, changelog); - foreach (var filePath in ctx.GetFiles(ctx.OutputDirectory.Combine(dist.DistributionIdentifier) - .Combine("*.*").FullPath)) + + var sourceDirectory = ctx.OutputDirectory.Combine(dist.DistributionIdentifier); + if (dist.FrameworkTarget != null) + sourceDirectory = sourceDirectory.Combine(dist.FrameworkTarget); + + foreach (var filePath in ctx.GetFiles(sourceDirectory.Combine("*.*").FullPath)) ctx.CopyFileToDirectory(filePath, bepInExCoreDir); if (dist.Engine == "Unity") @@ -269,21 +275,24 @@ public sealed class MakeDistTask : FrostingTask { ctx.CopyFile(ctx.CacheDirectory.Combine("dobby").Combine($"dobby_{dist.Os}").CombineWithFilePath($"{dist.DllPrefix}dobby_{dist.Arch}.{dist.DllExtension}"), bepInExCoreDir.CombineWithFilePath($"{dist.DllPrefix}dobby.{dist.DllExtension}")); - ctx.CopyDirectory(ctx.CacheDirectory.Combine("dotnet").Combine(dist.RuntimeIndentifier), + ctx.CopyDirectory(ctx.CacheDirectory.Combine("dotnet").Combine(dist.RuntimeIdentifier), targetDir.Combine("dotnet")); } } - - if (dist.DistributionIdentifier == "NET.Framework") + else if (dist.Engine == "NET") { - ctx.DeleteFile(bepInExCoreDir.CombineWithFilePath("BepInEx.NET.Framework.Launcher.exe.config")); - foreach (var filePath in ctx.GetFiles(bepInExCoreDir.Combine("BepInEx.NET.*").FullPath)) - ctx.MoveFileToDirectory(filePath, targetDir); - } + if (dist.Runtime == "Framework") + { + ctx.DeleteFile(bepInExCoreDir.CombineWithFilePath("BepInEx.NET.Framework.Launcher.exe.config")); - if (dist.DistributionIdentifier == "NET.CoreCLR") - foreach (var filePath in ctx.GetFiles(bepInExCoreDir.Combine("BepInEx.NET.CoreCLR.*").FullPath)) - ctx.MoveFileToDirectory(filePath, targetDir); + ctx.MoveFileToDirectory(bepInExCoreDir.CombineWithFilePath("BepInEx.NET.Framework.Launcher.exe"), targetDir); + } + else if (dist.Runtime == "CoreCLR") + { + foreach (var filePath in ctx.GetFiles(bepInExCoreDir.Combine("BepInEx.NET.CoreCLR.*").FullPath)) + ctx.MoveFileToDirectory(filePath, targetDir); + } + } } } } From 3100c887b45b7a462a40303560c643c2204ce22c Mon Sep 17 00:00:00 2001 From: Bepis <36346617+bbepis@users.noreply.github.com> Date: Mon, 27 Nov 2023 04:23:52 +1100 Subject: [PATCH 2/5] Include a better description for target framework variants --- build/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Program.cs b/build/Program.cs index bf4987c..ecc4cf5 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -356,7 +356,7 @@ public sealed class PublishTask : FrostingTask { ["file"] = $"BepInEx-{d.Target}-{ctx.BuildPackageVersion}.zip", ["description"] = - $"BepInEx {d.Engine} ({d.Runtime}) for {d.ClearOsName} ({d.Arch}) games" + $"BepInEx {d.Engine} ({d.Runtime}{(d.FrameworkTarget == null ? "" : " " + d.FrameworkTarget)}) for {d.ClearOsName} ({d.Arch}) games" }).ToArray() }); } From 342068a9c7f6fd0d42871069f6be75ba2f2b51bc Mon Sep 17 00:00:00 2001 From: Bepis <36346617+bbepis@users.noreply.github.com> Date: Mon, 27 Nov 2023 23:03:35 +1100 Subject: [PATCH 3/5] Fix shared project whitespace --- .../BepInEx.NET.Shared.shproj | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj b/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj index 900fbeb..77757e6 100644 --- a/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj +++ b/Runtimes/NET/BepInEx.NET.Shared/BepInEx.NET.Shared.shproj @@ -1,16 +1,16 @@ - - 067bcc8c-fc25-4929-b4f4-c6a5a7496994 - 14.0 - - - - - - - - - - + + 067bcc8c-fc25-4929-b4f4-c6a5a7496994 + 14.0 + + + + + + + + + + \ No newline at end of file From 5fbdd38405d025948a0dbc28719266be6e3f3eed Mon Sep 17 00:00:00 2001 From: Bepis <36346617+bbepis@users.noreply.github.com> Date: Wed, 29 Nov 2023 19:29:57 +1100 Subject: [PATCH 4/5] Address PR issues --- Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj | 2 +- .../BepInEx.NET.Framework.Launcher.csproj | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj b/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj index b50cd86..5aafa90 100644 --- a/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj +++ b/Runtimes/NET/BepInEx.NET.CoreCLR/BepInEx.NET.CoreCLR.csproj @@ -2,7 +2,7 @@ BepInEx support library for CoreCLR games - netcoreapp3.1;net6 + netcoreapp3.1;net6.0 $(BuildDir)/NET.CoreCLR true true diff --git a/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj b/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj index 353ed2b..274dc40 100644 --- a/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj +++ b/Runtimes/NET/BepInEx.NET.Framework.Launcher/BepInEx.NET.Framework.Launcher.csproj @@ -16,7 +16,6 @@ - From b841c78f9215ece7d012f6de6150f7fc411655ef Mon Sep 17 00:00:00 2001 From: Bepis <36346617+bbepis@users.noreply.github.com> Date: Thu, 30 Nov 2023 03:12:57 +1100 Subject: [PATCH 5/5] Fix runtime naming --- build/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Program.cs b/build/Program.cs index ecc4cf5..1189597 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -53,7 +53,7 @@ public class BuildContext : FrostingContext new("NET.Framework", "win-x86", "net40"), new("NET.Framework", "win-x86", "net452"), new("NET.CoreCLR", "win-x64", "netcoreapp3.1"), - new("NET.CoreCLR", "win-x64", "net6") + new("NET.CoreCLR", "win-x64", "net6.0") };