From 6a1059b7975592358b7868c9c22d29f34e9644a9 Mon Sep 17 00:00:00 2001 From: Andreas Pardeike Date: Sat, 3 Feb 2024 15:50:15 +0100 Subject: [PATCH] Feature/fat version (#569) * adds ilrepack * builds both thin and fat * makes ReleaseFat default test configuration * fixes test configuration --- Directory.Build.props | 2 +- Harmony.sln | 62 +++++++++------ Harmony/Documentation/Documentation.csproj | 17 +--- Harmony/Harmony.csproj | 81 +++++++++----------- HarmonyTests/HarmonyTests.csproj | 1 + HarmonyTests/Patching/Assets/PatchClasses.cs | 1 - ILRepack.targets | 9 +++ TestLibrary/TestLibrary.csproj | 1 + azure-pipelines-job-template.yml | 15 +++- 9 files changed, 103 insertions(+), 86 deletions(-) create mode 100644 ILRepack.targets diff --git a/Directory.Build.props b/Directory.Build.props index 78142495..f88f222b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ 2.3.0.0 - -prerelease.5 + -prerelease.7 1.1.0-prerelease.2 diff --git a/Harmony.sln b/Harmony.sln index 288f39c6..829b4f3f 100644 --- a/Harmony.sln +++ b/Harmony.sln @@ -1,14 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29509.3 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34525.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{887FC7DA-9A29-4130-92E7-66E21E76CAC4}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore - _config.yml = _config.yml azure-pipelines-job-template.yml = azure-pipelines-job-template.yml azure-pipelines.yml = azure-pipelines.yml CNAME = CNAME @@ -17,6 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json LICENSE = LICENSE README.md = README.md + _config.yml = _config.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Harmony", "Harmony\Harmony.csproj", "{69AEE16A-B6E7-4642-8081-3928B32455DF}" @@ -28,30 +28,48 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Documentation", "Harmony\Do {69AEE16A-B6E7-4642-8081-3928B32455DF} = {69AEE16A-B6E7-4642-8081-3928B32455DF} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestLibrary", "TestLibrary\TestLibrary.csproj", "{11F828EC-7C50-48F4-A30D-9BED06837F3A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestLibrary", "TestLibrary\TestLibrary.csproj", "{11F828EC-7C50-48F4-A30D-9BED06837F3A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU + DebugFat|Any CPU = DebugFat|Any CPU + DebugThin|Any CPU = DebugThin|Any CPU + ReleaseFat|Any CPU = ReleaseFat|Any CPU + ReleaseThin|Any CPU = ReleaseThin|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {69AEE16A-B6E7-4642-8081-3928B32455DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {69AEE16A-B6E7-4642-8081-3928B32455DF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {69AEE16A-B6E7-4642-8081-3928B32455DF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {69AEE16A-B6E7-4642-8081-3928B32455DF}.Release|Any CPU.Build.0 = Release|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.Release|Any CPU.Build.0 = Release|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.Release|Any CPU.Build.0 = Release|Any CPU - {11F828EC-7C50-48F4-A30D-9BED06837F3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {11F828EC-7C50-48F4-A30D-9BED06837F3A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {11F828EC-7C50-48F4-A30D-9BED06837F3A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {11F828EC-7C50-48F4-A30D-9BED06837F3A}.Release|Any CPU.Build.0 = Release|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.DebugFat|Any CPU.ActiveCfg = DebugFat|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.DebugFat|Any CPU.Build.0 = DebugFat|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.DebugThin|Any CPU.ActiveCfg = DebugThin|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.DebugThin|Any CPU.Build.0 = DebugThin|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.ReleaseFat|Any CPU.ActiveCfg = ReleaseFat|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.ReleaseFat|Any CPU.Build.0 = ReleaseFat|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.ReleaseThin|Any CPU.ActiveCfg = ReleaseThin|Any CPU + {69AEE16A-B6E7-4642-8081-3928B32455DF}.ReleaseThin|Any CPU.Build.0 = ReleaseThin|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugFat|Any CPU.ActiveCfg = Debug|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugFat|Any CPU.Build.0 = Debug|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugThin|Any CPU.ActiveCfg = Debug|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugThin|Any CPU.Build.0 = Debug|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseFat|Any CPU.ActiveCfg = Release|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseFat|Any CPU.Build.0 = Release|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseThin|Any CPU.ActiveCfg = Release|Any CPU + {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseThin|Any CPU.Build.0 = Release|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugFat|Any CPU.ActiveCfg = Default|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugFat|Any CPU.Build.0 = Default|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugThin|Any CPU.ActiveCfg = Default|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugThin|Any CPU.Build.0 = Default|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseFat|Any CPU.ActiveCfg = Default|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseFat|Any CPU.Build.0 = Default|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseThin|Any CPU.ActiveCfg = Default|Any CPU + {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseThin|Any CPU.Build.0 = Default|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.DebugFat|Any CPU.ActiveCfg = Debug|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.DebugFat|Any CPU.Build.0 = Debug|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.DebugThin|Any CPU.ActiveCfg = Debug|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.DebugThin|Any CPU.Build.0 = Debug|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.ReleaseFat|Any CPU.ActiveCfg = Release|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.ReleaseFat|Any CPU.Build.0 = Release|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.ReleaseThin|Any CPU.ActiveCfg = Release|Any CPU + {11F828EC-7C50-48F4-A30D-9BED06837F3A}.ReleaseThin|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Harmony/Documentation/Documentation.csproj b/Harmony/Documentation/Documentation.csproj index 584cff2c..4bd654cb 100644 --- a/Harmony/Documentation/Documentation.csproj +++ b/Harmony/Documentation/Documentation.csproj @@ -7,28 +7,15 @@ obj obj false - - - - - - - - false - full - true - DEBUG - - - + Default true none false + - diff --git a/Harmony/Harmony.csproj b/Harmony/Harmony.csproj index aa62f2b3..3eff8496 100644 --- a/Harmony/Harmony.csproj +++ b/Harmony/Harmony.csproj @@ -8,6 +8,7 @@ Copyright © 2016 A general non-destructive patch library for .NET and Mono modules Lib.Harmony + Lib.Harmony.Thin Andreas Pardeike 0Harmony true @@ -23,47 +24,23 @@ true preview $(DefaultItemExcludes);Documentation/** + true false - $(NoWarn);SYSLIB0011 $(HarmonyVersion) $(HarmonyVersion) $(HarmonyVersion) $(HarmonyVersion)$(HarmonyPrerelease) $(HarmonyVersion)$(HarmonyPrerelease) - $(NoWarn);NU5131 + $(NoWarn);SYSLIB0011;NU5131 + DebugThin;DebugFat;ReleaseThin;ReleaseFat - - - - - true - - - - - false - - - - - - - - - true - - - - - false - true - - - + + true + + + false + @@ -71,27 +48,30 @@ - + false full true DEBUG - + true none false + $(SolutionDir)ILRepack.targets + True - + + - + false @@ -99,11 +79,11 @@ $(TargetsForTfmSpecificContentInPackage);AddRefAssemblyToPackage - - + + - + @@ -144,15 +124,26 @@ - - - - - + + + + + + + + + + + + + + + + diff --git a/HarmonyTests/HarmonyTests.csproj b/HarmonyTests/HarmonyTests.csproj index cc9fca38..857cbb34 100644 --- a/HarmonyTests/HarmonyTests.csproj +++ b/HarmonyTests/HarmonyTests.csproj @@ -6,6 +6,7 @@ preview false false + Debug;Release diff --git a/HarmonyTests/Patching/Assets/PatchClasses.cs b/HarmonyTests/Patching/Assets/PatchClasses.cs index 950d12e0..65d9eaf3 100644 --- a/HarmonyTests/Patching/Assets/PatchClasses.cs +++ b/HarmonyTests/Patching/Assets/PatchClasses.cs @@ -1,5 +1,4 @@ using HarmonyLib; -using MonoMod.Utils.Cil; using System; using System.Collections; using System.Collections.Generic; diff --git a/ILRepack.targets b/ILRepack.targets new file mode 100644 index 00000000..2692ef1f --- /dev/null +++ b/ILRepack.targets @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/TestLibrary/TestLibrary.csproj b/TestLibrary/TestLibrary.csproj index 64f99e75..7263e684 100644 --- a/TestLibrary/TestLibrary.csproj +++ b/TestLibrary/TestLibrary.csproj @@ -6,6 +6,7 @@ preview false false + Debug;Release diff --git a/azure-pipelines-job-template.yml b/azure-pipelines-job-template.yml index eef11b44..93c324db 100644 --- a/azure-pipelines-job-template.yml +++ b/azure-pipelines-job-template.yml @@ -1,22 +1,33 @@ parameters: + - name: dependsOn type: string default: '' + - name: os type: string values: [windows, ubuntu, macOS] + - name: runtimeType type: string values: [dotnet, mono] default: dotnet + - name: architecture type: string values: [x86, x64] + - name: frameworks type: object + - name: buildConfiguration + type: string + default: ReleaseFat + +- name: testConfiguration type: string default: Release + - name: publishBuild type: boolean default: false @@ -101,7 +112,7 @@ jobs: inputs: command: test projects: HarmonyTests - arguments: "--no-build --configuration ${{parameters.buildConfiguration}} --framework ${{framework}} --logger \"console;verbosity=normal\" $(blameArg) -- $(runSettingsArgs)" + arguments: "--no-build --configuration ${{parameters.testConfiguration}} --framework ${{framework}} --logger \"console;verbosity=normal\" $(blameArg) -- $(runSettingsArgs)" publishTestResults: true # .NET Framework on non-Windows implicitly always uses mono. ${{ if and(ne(parameters.os, 'windows'), not(contains(framework, '.'))) }}: @@ -129,7 +140,7 @@ jobs: # Execute the tests via mono + vstest.console. mono="$(eval $programFilesCmd)/Mono/bin/mono.exe" vstest="$(vswhere.exe -latest -property installationPath)/Common7/IDE/CommonExtensions/Microsoft/TestWindow/vstest.console.exe" - "$mono" "$vstest" "HarmonyTests/bin/${{parameters.buildConfiguration}}/${{framework}}/HarmonyTests.dll" --Framework:${{framework}} --logger:trx --ResultsDirectory:"$(Agent.TempDirectory)" $(blameArg) -- $(runSettingsArgs) + "$mono" "$vstest" "HarmonyTests/bin/${{parameters.testConfiguration}}/${{framework}}/HarmonyTests.dll" --Framework:${{framework}} --logger:trx --ResultsDirectory:"$(Agent.TempDirectory)" $(blameArg) -- $(runSettingsArgs) displayName: "Test ${{replace(framework, 'net35', 'net35 in CLR 4.0 \"compatibility mode\"')}}" condition: succeededOrFailed() env: