diff --git a/Harmony.sln b/Harmony.sln index c94dacee..288f39c6 100644 --- a/Harmony.sln +++ b/Harmony.sln @@ -32,44 +32,26 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestLibrary", "TestLibrary\ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - ReleaseFat|Any CPU = ReleaseFat|Any CPU - ReleaseLite|Any CPU = ReleaseLite|Any CPU - DebugLite|Any CPU = DebugLite|Any CPU - DebugFat|Any CPU = DebugFat|Any CPU + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {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}.ReleaseLite|Any CPU.ActiveCfg = ReleaseLite|Any CPU - {69AEE16A-B6E7-4642-8081-3928B32455DF}.ReleaseLite|Any CPU.Build.0 = ReleaseLite|Any CPU - {69AEE16A-B6E7-4642-8081-3928B32455DF}.DebugLite|Any CPU.ActiveCfg = DebugLite|Any CPU - {69AEE16A-B6E7-4642-8081-3928B32455DF}.DebugLite|Any CPU.Build.0 = DebugLite|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 - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseFat|Any CPU.ActiveCfg = ReleaseFat|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseFat|Any CPU.Build.0 = ReleaseFat|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseLite|Any CPU.ActiveCfg = ReleaseLite|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.ReleaseLite|Any CPU.Build.0 = ReleaseLite|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugLite|Any CPU.ActiveCfg = DebugLite|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugLite|Any CPU.Build.0 = DebugLite|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugFat|Any CPU.ActiveCfg = DebugFat|Any CPU - {DEE74EFC-29A8-4704-8536-7DA38D3999F7}.DebugFat|Any CPU.Build.0 = DebugFat|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugFat|Any CPU.ActiveCfg = Debug|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugFat|Any CPU.Build.0 = Debug|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugLite|Any CPU.ActiveCfg = Debug|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.DebugLite|Any CPU.Build.0 = Debug|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseFat|Any CPU.ActiveCfg = Release|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseFat|Any CPU.Build.0 = Release|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseLite|Any CPU.ActiveCfg = Release|Any CPU - {9B9DD18C-6EB7-497F-8ED5-699515A840C5}.ReleaseLite|Any CPU.Build.0 = Release|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}.DebugLite|Any CPU.ActiveCfg = Debug|Any CPU - {11F828EC-7C50-48F4-A30D-9BED06837F3A}.DebugLite|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}.ReleaseLite|Any CPU.ActiveCfg = Release|Any CPU - {11F828EC-7C50-48F4-A30D-9BED06837F3A}.ReleaseLite|Any CPU.Build.0 = Release|Any CPU + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Harmony/Documentation/Documentation.csproj b/Harmony/Documentation/Documentation.csproj index 47b391af..584cff2c 100644 --- a/Harmony/Documentation/Documentation.csproj +++ b/Harmony/Documentation/Documentation.csproj @@ -9,14 +9,18 @@ false - + + + + + false full true DEBUG - + true none false @@ -33,8 +37,4 @@ - - - - diff --git a/Harmony/Harmony.csproj b/Harmony/Harmony.csproj index 83f2e8cc..aa62f2b3 100644 --- a/Harmony/Harmony.csproj +++ b/Harmony/Harmony.csproj @@ -2,55 +2,157 @@ netstandard2.0;net35;net452;net472;net48;netcoreapp3.0;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 - + true + Harmony + Andreas Pardeike + Copyright © 2016 + A general non-destructive patch library for .NET and Mono modules + Lib.Harmony + Andreas Pardeike + 0Harmony + true + LICENSE + README.md + https://github.com/pardeike/Harmony + false + Harmony,Mono,Patch,Patching,Runtime,Detour,Detours,Aspect,Aspects + HarmonyLogo.png + https://raw.githubusercontent.com/pardeike/Harmony/master/HarmonyLogo.png + true + obj/docfx-$(TargetFramework).log true preview - 0Harmony - $(DefaultItemExcludes);Documentation/** - + false + $(NoWarn);SYSLIB0011 $(HarmonyVersion) $(HarmonyVersion) $(HarmonyVersion) + $(HarmonyVersion)$(HarmonyPrerelease) $(HarmonyVersion)$(HarmonyPrerelease) - - ReleaseFat;ReleaseLite;DebugLite;DebugFat - - true - obj/docfx-$(TargetFramework).log - false - $(NoWarn);SYSLIB0011;NU5131 - + $(NoWarn);NU5131 - + + + + + true + + + + + false + + + + + + + + + true + + + + + false + true + + + - + + + + + - - - + + false + full + true + DEBUG + + + + true + none + false + - - all - - - - all - + - + + + + + false + + true + + $(TargetsForTfmSpecificContentInPackage);AddRefAssemblyToPackage + + + + + + + + + + ref/netstandard2.0 + + + ref/netstandard2.0 + + + + + + + + + + + + + + + + + - + + + $(MSBuildThisFileDirectory)bin\$(Configuration) + + + + + + + + + + - + + + + + + diff --git a/Harmony/msbuild/_._ b/Harmony/msbuild/_._ deleted file mode 100644 index e69de29b..00000000 diff --git a/Harmony/msbuild/build.props b/Harmony/msbuild/build.props deleted file mode 100644 index 740d479b..00000000 --- a/Harmony/msbuild/build.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - - false - full - true - DEBUG - - - - true - none - false - - - \ No newline at end of file diff --git a/Harmony/msbuild/clean.props b/Harmony/msbuild/clean.props deleted file mode 100644 index 490684c1..00000000 --- a/Harmony/msbuild/clean.props +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)bin\$(Configuration) - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Harmony/msbuild/ilrepack.props b/Harmony/msbuild/ilrepack.props deleted file mode 100644 index 13f5f36b..00000000 --- a/Harmony/msbuild/ilrepack.props +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - true - - - - - false - - - - - - $(Configuration) - false - true - true - true - $(PkgBUTR_ILRepack)\tools\net461\ILRepack.exe - - - - - - - - - - diff --git a/Harmony/msbuild/netstandard.props b/Harmony/msbuild/netstandard.props deleted file mode 100644 index f67f700e..00000000 --- a/Harmony/msbuild/netstandard.props +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - false - - true - - $(TargetsForTfmSpecificContentInPackage);AddRefAssemblyToPackage - - - - - - - - - - - - ref/netstandard2.0 - - - ref/netstandard2.0 - - - - - \ No newline at end of file diff --git a/Harmony/msbuild/nuget.props b/Harmony/msbuild/nuget.props deleted file mode 100644 index 8d3028d6..00000000 --- a/Harmony/msbuild/nuget.props +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - Lib.Harmony - A general non-destructive patch library for .NET and Mono modules. Contains IL Merged code. Use Lib.Harmony.Lite for a non IL Merged version - - - - - Lib.Harmony.Lite - A general non-destructive patch library for .NET and Mono modules - - - - - - - - true - - - - - false - - - - - - true - Harmony - Andreas Pardeike - Copyright © 2016 - Andreas Pardeike - true - LICENSE - README.md - https://github.com/pardeike/Harmony - false - Harmony,Mono,Patch,Patching,Runtime,Detour,Detours,Aspect,Aspects - HarmonyLogo.png - https://raw.githubusercontent.com/pardeike/Harmony/master/HarmonyLogo.png - $(HarmonyVersion)$(HarmonyPrerelease) - true - - - - - - - - - - - - - - false - - $(TargetsForTfmSpecificContentInPackage);AddEmptyNETDirectoriesToPackage - - - - - - - lib/$(TargetFramework) - - - - - \ No newline at end of file diff --git a/Harmony/msbuild/package.props b/Harmony/msbuild/package.props deleted file mode 100644 index 29bd2c30..00000000 --- a/Harmony/msbuild/package.props +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - true - - - - - false - - - - - - - - true - - - - - false - - - - - - - - - diff --git a/Harmony/msbuild/variables.props b/Harmony/msbuild/variables.props deleted file mode 100644 index 1478ac28..00000000 --- a/Harmony/msbuild/variables.props +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - true - - - - - false - - - - - - - - true - - - - - false - - - - - - - - true - - - - - false - - - - - \ No newline at end of file diff --git a/HarmonyTests/HarmonyTests.csproj b/HarmonyTests/HarmonyTests.csproj index 3446aa3c..cc9fca38 100644 --- a/HarmonyTests/HarmonyTests.csproj +++ b/HarmonyTests/HarmonyTests.csproj @@ -6,30 +6,46 @@ preview false false - ReleaseFat;ReleaseLite;DebugLite;DebugFat - - false - full - true - DEBUG + + + + + true + + + + + false + + + + + + + + + + + false + full + true + DEBUG - + true none false - + true - - runtime; build; native; contentfiles; analyzers; buildtransitive @@ -47,18 +63,13 @@ - + - - - - - - + mmc diff --git a/TestLibrary/TestLibrary.csproj b/TestLibrary/TestLibrary.csproj index 881cbaba..64f99e75 100644 --- a/TestLibrary/TestLibrary.csproj +++ b/TestLibrary/TestLibrary.csproj @@ -1,18 +1,33 @@ - net35;net452;net472;net48;netcoreapp3.0;netcoreapp3.1;net5.0;net6.0;net7.0 + net35;net452;net472;net48;netcoreapp3.0;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 + true preview + false false - - + + + false + full + true + DEBUG + + + + true + none + false + + - + + - + \ No newline at end of file diff --git a/azure-pipelines-job-template.yml b/azure-pipelines-job-template.yml index 3670b8ba..eef11b44 100644 --- a/azure-pipelines-job-template.yml +++ b/azure-pipelines-job-template.yml @@ -14,8 +14,9 @@ parameters: values: [x86, x64] - name: frameworks type: object -- name: buildConfigurations - type: object +- name: buildConfiguration + type: string + default: Release - name: publishBuild type: boolean default: false @@ -65,19 +66,15 @@ jobs: version: ${{replace(replace(framework, 'coreapp', ''), 'net', '')}}.x packageType: sdk - - bash: "dotnet nuget locals all --clear" - displayName: 'Clean NuGet' + - bash: "dotnet clean --configuration ${{parameters.buildConfiguration}} && dotnet nuget locals all --clear" + displayName: 'Clean' - - ${{ each buildConfiguration in parameters.buildConfigurations }}: - - bash: "dotnet clean --configuration ${{buildConfiguration}}" - displayName: 'Clean ${{buildConfiguration}}' - - - task: DotNetCoreCLI@2 - displayName: 'Build ${{buildConfiguration}}' - inputs: - command: build # `dotnet build` implicitly runs `dotnet restore` as well - projects: Harmony.sln - arguments: "--configuration ${{buildConfiguration}}" + - task: DotNetCoreCLI@2 + displayName: 'Build' + inputs: + command: build # `dotnet build` implicitly runs `dotnet restore` as well + projects: Harmony.sln + arguments: "--configuration ${{parameters.buildConfiguration}}" # For some reason, if mono is installed, above solution restore/build fails when restoring nugets (doesn't fail when only building a project). # Since mono is only needed for running tests in 'mono' runtimeType mode, only install mono after the restore/build. @@ -87,85 +84,84 @@ jobs: # 'dotnet' runtimeType means using `dotnet test`. - ${{ each framework in parameters.frameworks }}: - - ${{ each buildConfiguration in parameters.buildConfigurations }}: - - ${{ if eq(parameters.runtimeType, 'dotnet') }}: - # dotnet usage notes: - # - `dotnet test` does work for .NET Framework targets, but they still implicitly require mono on non-Windows. - # `dotnet test` for .NET Core targets do not require mono (.NET Core is cross-platform). - # - `dotnet test HarmonyTests`, even with --framework net35, won't run .NET Framework 3.5 tests unless IsTestPlatform is explicitly set - # (since Microsoft.NET.Test.Sdk only sets IsTestProject property for net40+). HarmonyTests.csproj works around this by setting IsTestPlatform for net35. - # - `dotnet test path/to//HarmonyTests.dll --framework ` does work, but there's currently a bug where inline runSettings don't work - # (this is apparently fixed in .NET 5.0+), requiring a runSettings file (which would need to be generated beforehand). So not doing this. - # - Even with the above workaround for running .NET Framework 3.5 tests, there is no CLR 2.0 runtime (or mono equivalent) available to properly test it. - # Both `dotnet test path/to/net35/HarmonyTests.dll --framework net35` and `mono path/to/nunit3-console.exe path/to/net35/HarmonyTests.dll` - # run the tests in 'CLR 4.0 "compatibility mode"' (or the mono equivalent of this). - - task: DotNetCoreCLI@2 - displayName: "Test ${{buildConfiguration}} ${{replace(framework, 'net35', 'net35 in CLR 4.0 \"compatibility mode\"')}}" - condition: succeededOrFailed() - inputs: - command: test - projects: HarmonyTests - arguments: "--no-build --configuration ${{buildConfiguration}} --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, '.'))) }}: - testRunTitle: "${{framework}} (${{parameters.os}} mono ${{parameters.architecture}})" - ${{ if or(eq(parameters.os, 'windows'), contains(framework, '.')) }}: # currently no `else` construct in Azure Pipelines - testRunTitle: "${{framework}} (${{parameters.os}} ${{parameters.architecture}})" - - # 'mono' runtimeType is for running .NET Framework tests on Windows (non-Windows will always run .NET Framework tests on mono even via `dotnet test`). - - ${{ if eq(parameters.runtimeType, 'mono') }}: - # Following attempts to replicate the behavior of DotNetCoreCLI test with publishTestResults=true, the main difference being: - # - the usage of mono + vstest.console (since mono + dotnet test doesn't work) - # - the actual test publishing delegated to a followup PublishTestResults task - - bash: | - shopt -s failglob globstar - set -x - # Remove any existing test result files. - for testResultFile in "$(Agent.TempDirectory)"/**/*.trx; do - rm "$testResultFile" - # If there are test attachments, they are in a directory with same name as trx file, excluding the .trx extension. - testResultDir="${testResultFile%.trx}" - if [ -e "$testResultDir" ]; then - rm -r "$testResultDir" - fi - done - # 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/${{buildConfiguration}}/${{framework}}/HarmonyTests.dll" --Framework:${{framework}} --logger:trx --ResultsDirectory:"$(Agent.TempDirectory)" $(blameArg) -- $(runSettingsArgs) - displayName: "Test ${{buildConfiguration}} ${{replace(framework, 'net35', 'net35 in CLR 4.0 \"compatibility mode\"')}}" - condition: succeededOrFailed() - env: - ${{ if eq(parameters.architecture, 'x86') }}: - programFilesCmd: "cmd //c 'echo %ProgramFiles(x86)%'" # no direct way to access ProgramFiles(x86) env var from within bash - ${{ if ne(parameters.architecture, 'x86') }}: # currently no `else` construct in Azure Pipelines - programFilesCmd: "echo $PROGRAMFILES" - - - ${{ if eq(parameters.runtimeType, 'mono') }}: - - task: PublishTestResults@2 - displayName: "Publish ${{buildConfiguration}} ${{framework}} test results" - condition: succeededOrFailed() - inputs: - buildPlatform: ${{parameters.architecture}} - buildConfiguration: ${{buildConfiguration}} - testResultsFormat: VSTest - testResultsFiles: '**/*.trx' - searchFolder: $(Agent.TempDirectory) + - ${{ if eq(parameters.runtimeType, 'dotnet') }}: + # dotnet usage notes: + # - `dotnet test` does work for .NET Framework targets, but they still implicitly require mono on non-Windows. + # `dotnet test` for .NET Core targets do not require mono (.NET Core is cross-platform). + # - `dotnet test HarmonyTests`, even with --framework net35, won't run .NET Framework 3.5 tests unless IsTestPlatform is explicitly set + # (since Microsoft.NET.Test.Sdk only sets IsTestProject property for net40+). HarmonyTests.csproj works around this by setting IsTestPlatform for net35. + # - `dotnet test path/to//HarmonyTests.dll --framework ` does work, but there's currently a bug where inline runSettings don't work + # (this is apparently fixed in .NET 5.0+), requiring a runSettings file (which would need to be generated beforehand). So not doing this. + # - Even with the above workaround for running .NET Framework 3.5 tests, there is no CLR 2.0 runtime (or mono equivalent) available to properly test it. + # Both `dotnet test path/to/net35/HarmonyTests.dll --framework net35` and `mono path/to/nunit3-console.exe path/to/net35/HarmonyTests.dll` + # run the tests in 'CLR 4.0 "compatibility mode"' (or the mono equivalent of this). + - task: DotNetCoreCLI@2 + displayName: "Test ${{replace(framework, 'net35', 'net35 in CLR 4.0 \"compatibility mode\"')}}" + condition: succeededOrFailed() + inputs: + command: test + projects: HarmonyTests + arguments: "--no-build --configuration ${{parameters.buildConfiguration}} --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, '.'))) }}: testRunTitle: "${{framework}} (${{parameters.os}} mono ${{parameters.architecture}})" + ${{ if or(eq(parameters.os, 'windows'), contains(framework, '.')) }}: # currently no `else` construct in Azure Pipelines + testRunTitle: "${{framework}} (${{parameters.os}} ${{parameters.architecture}})" - - ${{ if parameters.publishBuild }}: - - ${{ each buildConfiguration in parameters.buildConfigurations }}: - # publish task doesn't support globbing, so have to find the file and output it as a variable. Yes, this is clunky. + # 'mono' runtimeType is for running .NET Framework tests on Windows (non-Windows will always run .NET Framework tests on mono even via `dotnet test`). + - ${{ if eq(parameters.runtimeType, 'mono') }}: + # Following attempts to replicate the behavior of DotNetCoreCLI test with publishTestResults=true, the main difference being: + # - the usage of mono + vstest.console (since mono + dotnet test doesn't work) + # - the actual test publishing delegated to a followup PublishTestResults task - bash: | - shopt -s failglob - # Expecting only one zip file, but this allows script to error if no such zip file is found. - for buildZipFile in Harmony/bin/Harmony_${{buildConfiguration}}*.zip; do - echo "##vso[task.setvariable variable=buildZipFile]$buildZipFile" + shopt -s failglob globstar + set -x + # Remove any existing test result files. + for testResultFile in "$(Agent.TempDirectory)"/**/*.trx; do + rm "$testResultFile" + # If there are test attachments, they are in a directory with same name as trx file, excluding the .trx extension. + testResultDir="${testResultFile%.trx}" + if [ -e "$testResultDir" ]; then + rm -r "$testResultDir" + fi done - displayName: "Find ${{buildConfiguration}} Harmony zip for build artifact publishing" + # 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) + displayName: "Test ${{replace(framework, 'net35', 'net35 in CLR 4.0 \"compatibility mode\"')}}" + condition: succeededOrFailed() + env: + ${{ if eq(parameters.architecture, 'x86') }}: + programFilesCmd: "cmd //c 'echo %ProgramFiles(x86)%'" # no direct way to access ProgramFiles(x86) env var from within bash + ${{ if ne(parameters.architecture, 'x86') }}: # currently no `else` construct in Azure Pipelines + programFilesCmd: "echo $PROGRAMFILES" + + - ${{ if eq(parameters.runtimeType, 'mono') }}: + - task: PublishTestResults@2 + displayName: "Publish ${{framework}} test results" condition: succeededOrFailed() + inputs: + buildPlatform: ${{parameters.architecture}} + buildConfiguration: ${{parameters.buildConfiguration}} + testResultsFormat: VSTest + testResultsFiles: '**/*.trx' + searchFolder: $(Agent.TempDirectory) + testRunTitle: "${{framework}} (${{parameters.os}} mono ${{parameters.architecture}})" + + - ${{ if parameters.publishBuild }}: + # publish task doesn't support globbing, so have to find the file and output it as a variable. Yes, this is clunky. + - bash: | + shopt -s failglob + # Expecting only one zip file, but this allows script to error if no such zip file is found. + for buildZipFile in Harmony/bin/Harmony*.zip; do + echo "##vso[task.setvariable variable=buildZipFile]$buildZipFile" + done + name: FindBuildArtifact + displayName: "Find Harmony zip for build artifact publishing" + condition: succeededOrFailed() - - publish: $(buildZipFile) - displayName: "Publish ${{buildConfiguration}} Harmony zip as build artifact" - artifact: ${{buildConfiguration}} + - publish: $(buildZipFile) + displayName: "Publish Harmony zip as build artifact" + artifact: ${{parameters.buildConfiguration}} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 394e9194..50793693 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,7 +14,6 @@ jobs: os: windows architecture: x64 frameworks: [net35, net452, net472, net48, netcoreapp3.0, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0] - buildConfigurations: [ReleaseFat, ReleaseLite] publishBuild: true - template: azure-pipelines-job-template.yml @@ -23,7 +22,6 @@ jobs: os: windows architecture: x86 frameworks: [net35, net452, net472, net48, netcoreapp3.0, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0] - buildConfigurations: [ReleaseFat, ReleaseLite] - template: azure-pipelines-job-template.yml parameters: @@ -32,7 +30,6 @@ jobs: architecture: x64 runtimeType: mono frameworks: [net35, net452, net472, net48] # mono for .NET Core just delegates to actual .NET Core, so no need for mono .NET Core tests - buildConfigurations: [ReleaseFat, ReleaseLite] - template: azure-pipelines-job-template.yml parameters: @@ -41,7 +38,6 @@ jobs: architecture: x86 runtimeType: mono frameworks: [net35, net452, net472, net48] # mono for .NET Core just delegates to actual .NET Core, so no need for mono .NET Core tests - buildConfigurations: [ReleaseFat, ReleaseLite] - template: azure-pipelines-job-template.yml parameters: @@ -49,7 +45,6 @@ jobs: os: ubuntu architecture: x64 frameworks: [net35, net452, net472, net48, netcoreapp3.0, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0] - buildConfigurations: [ReleaseFat, ReleaseLite] # Without an x86 ubuntu agent and with mono's packaging not multi-arch-safe (can't install x86 mono on x64 ubuntu), we can't test on x86 ubuntu. #- template: azure-pipelines-job-template.yml @@ -57,7 +52,6 @@ jobs: # os: ubuntu # architecture: x86 # frameworks: [net35, net452, net472, net48] # .NET Core x86 is unavailable for non-Windows -# buildConfigurations: [ReleaseFat, ReleaseLite] - template: azure-pipelines-job-template.yml parameters: @@ -65,7 +59,6 @@ jobs: os: macOS architecture: x64 frameworks: [net35, net452, net472, net48, netcoreapp3.0, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0] - buildConfigurations: [ReleaseFat, ReleaseLite] # x86 ubuntu does apply to x86 macOS as well. #- template: azure-pipelines-job-template.yml @@ -73,4 +66,3 @@ jobs: # os: macOS # architecture: x86 # frameworks: [net35, net452, net472, net48] # .NET Core x86 is unavailable for non-Windows -# buildConfigurations: [ReleaseFat, ReleaseLite]