mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 03:39:35 -10:00
142 lines
9.1 KiB
XML
142 lines
9.1 KiB
XML
<Project>
|
|
<PropertyGroup Condition="'$(RunScriptInputName)' == ''">
|
|
<RunScriptInputName Condition="'$(TargetOS)' == 'windows'">RunnerTemplate.cmd</RunScriptInputName>
|
|
<RunScriptInputName Condition="'$(TargetOS)' != 'windows'">RunnerTemplate.sh</RunScriptInputName>
|
|
<RunScriptInputName Condition="'$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'">AppleRunnerTemplate.sh</RunScriptInputName>
|
|
<RunScriptInputName Condition="'$(TargetOS)' == 'Android'">AndroidRunnerTemplate.sh</RunScriptInputName>
|
|
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' != 'Windows_NT'">WasmRunnerTemplate.sh</RunScriptInputName>
|
|
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' == 'Windows_NT'">WasmRunnerTemplate.cmd</RunScriptInputName>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup>
|
|
<RunScriptInputPath Condition="'$(RunScriptInputPath)' == ''">$(MSBuildThisFileDirectory)$(RunScriptInputName)</RunScriptInputPath>
|
|
|
|
<RunScriptOutputName Condition="'$(TargetOS)' != 'windows'">RunTests.sh</RunScriptOutputName>
|
|
<RunScriptOutputName Condition="'$(TargetOS)' == 'windows' or ('$(TargetOS)' == 'Browser' and '$(OS)' == 'Windows_NT')">RunTests.cmd</RunScriptOutputName>
|
|
<RunScriptOutputPath>$([MSBuild]::NormalizePath('$(OutDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath>
|
|
|
|
<RunScriptHostDir Condition="'$(TargetOS)' == 'windows'">%RUNTIME_PATH%\</RunScriptHostDir>
|
|
<RunScriptHostDir Condition="'$(TargetOS)' != 'windows'">$RUNTIME_PATH/</RunScriptHostDir>
|
|
|
|
<RunScriptHost Condition="'$(TargetOS)' == 'windows'">$(RunScriptHostDir)dotnet.exe</RunScriptHost>
|
|
<RunScriptHost Condition="'$(TargetOS)' != 'windows'">$(RunScriptHostDir)dotnet</RunScriptHost>
|
|
</PropertyGroup>
|
|
|
|
<!-- For both tests.mobile.targets and tests.wasm.targets -->
|
|
<PropertyGroup>
|
|
<_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross'))</_MonoAotCrossCompilerPath>
|
|
<_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe</_MonoAotCrossCompilerPath>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<MonoAotCrossCompiler Include="$(_MonoAotCrossCompilerPath)" RuntimeIdentifier="$(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())" />
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<ArchiveTestsAfterTargets>PrepareForRun</ArchiveTestsAfterTargets>
|
|
|
|
<!-- For browser we need to hook up the target with DependsOnTargets in PublishTestAsSelfContained
|
|
because we do a Publish which runs after Build, if we run after PrepareForRun we would generated
|
|
an empty zip because we haven't published the selfcontained app. -->
|
|
<ArchiveTestsAfterTargets Condition="'$(TargetOS)' == 'Browser' or '$(TestSingleFile)' == 'true'" />
|
|
</PropertyGroup>
|
|
|
|
<!-- Archive test binaries. -->
|
|
<Target Name="ArchiveTests"
|
|
Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true' and ('$(TargetsMobile)' != 'true' or '$(TargetOS)' == 'Browser')"
|
|
AfterTargets="$(ArchiveTestsAfterTargets)"
|
|
DependsOnTargets="GenerateRunScript">
|
|
<Error Condition="'$(TestArchiveTestsDir)' == ''" Text="TestArchiveTestsDir property to archive the test folder must be set." />
|
|
|
|
<PropertyGroup>
|
|
<_ZipSourceDirectory>$(OutDir)</_ZipSourceDirectory>
|
|
<_ZipSourceDirectory Condition="'$(TargetOS)' == 'Browser' or '$(TestSingleFile)' == 'true'">$(BundleDir)</_ZipSourceDirectory>
|
|
</PropertyGroup>
|
|
|
|
<MakeDir Directories="$(TestArchiveTestsDir)" />
|
|
<ZipDirectory SourceDirectory="$(_ZipSourceDirectory)"
|
|
DestinationFile="$([MSBuild]::NormalizePath('$(TestArchiveTestsDir)', '$(TestProjectName).zip'))"
|
|
Overwrite="true" />
|
|
<!-- delete the BundleDir and PublishDir in CI builds to save disk space on build agents since they're no longer needed -->
|
|
<RemoveDir Condition="'$(ContinuousIntegrationBuild)' == 'true'" Directories="$(BundleDir)" ContinueOnError="WarnAndContinue" />
|
|
<RemoveDir Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(OS)' != 'Windows_NT'" Directories="$(PublishDir)" ContinueOnError="WarnAndContinue" />
|
|
</Target>
|
|
|
|
<UsingTask TaskName="GenerateRunScript" AssemblyFile="$(InstallerTasksAssemblyPath)"/>
|
|
<Target Name="GenerateRunScript">
|
|
<PropertyGroup>
|
|
<!-- RSP file support. -->
|
|
<RunScriptCommand Condition="'$(TargetOS)' != 'windows' and ('$(TargetOS)' != 'Browser' or '$(OS)' != 'Windows_NT')">$(RunScriptCommand) $RSP_FILE</RunScriptCommand>
|
|
<RunScriptCommand Condition="'$(TargetOS)' == 'windows' or ('$(TargetOS)' == 'Browser' and '$(OS)' == 'Windows_NT')">$(RunScriptCommand) %RSP_FILE%</RunScriptCommand>
|
|
|
|
<!-- Escape potential user input. -->
|
|
<RunScriptCommand>$([MSBuild]::Escape('$(RunScriptCommand)'))</RunScriptCommand>
|
|
</PropertyGroup>
|
|
|
|
<!-- Set $(TestDebugger) to eg c:\debuggers\windbg.exe to run tests under a debugger. -->
|
|
<PropertyGroup Condition="'$(TestDebugger)' != ''">
|
|
<RunScriptCommand Condition="!$(TestDebugger.Contains('devenv'))">$(TestDebugger) $(RunScriptCommand)</RunScriptCommand>
|
|
<RunScriptCommand Condition=" $(TestDebugger.Contains('devenv'))">$(TestDebugger) /debugexe $(RunScriptCommand)</RunScriptCommand>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<!--
|
|
If the PreExecutionTestScript property is set, then it should be set to the full path to a script that will be directly incorporated
|
|
into the generated runtests script, immediately before the test is run. This can be used to set a number of JIT stress modes,
|
|
for example. It is intended that this be as late as possible in the generated script, as close as possible to the running of the
|
|
test. That is why this doesn't appear higher in this file. The idea is that if the included script alters managed code behavior, such as
|
|
setting various JIT stress modes, we don't want those changes to affect any other managed code invocation (such as test infrastructure
|
|
written in managed code).
|
|
-->
|
|
<RunScriptCommands Condition="'$(PreExecutionTestScript)' != ''" Include="$([System.IO.File]::ReadAllText('$(PreExecutionTestScript)'))" />
|
|
|
|
<RunScriptCommands Include="$(RunScriptCommand)" />
|
|
|
|
<!-- Do not put anything between this and the GenerateRunScript invocation. -->
|
|
<RunScriptCommands Include="@(PostRunScriptCommands)" />
|
|
</ItemGroup>
|
|
|
|
<GenerateRunScript RunCommands="@(RunScriptCommands)"
|
|
TemplatePath="$(RunScriptInputPath)"
|
|
OutputPath="$(RunScriptOutputPath)" />
|
|
|
|
<Exec Condition="'$(TargetOS)' != 'windows' and '$(OS)' != 'Windows_NT'" Command="chmod +x $(RunScriptOutputPath)" />
|
|
</Target>
|
|
|
|
<Target Name="RunTests">
|
|
<PropertyGroup>
|
|
<RunTestsCommand>"$(RunScriptOutputPath)"</RunTestsCommand>
|
|
<!-- Use runtime path only for the live built shared framework (NetCoreAppCurrent). -->
|
|
<RunTestsCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
|
|
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)'))">$(RunTestsCommand) --runtime-path "$(NetCoreAppCurrentTestHostPath.TrimEnd('\/'))"</RunTestsCommand>
|
|
<RunTestsCommand Condition="'$(TestRspFile)' != '' and '$(RuntimeFlavor)' != 'Mono'">$(RunTestsCommand) --rsp-file "$(TestRspFile)"</RunTestsCommand>
|
|
<RunTestsCommand Condition="'$(TargetsMobile)' == 'true'">"$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture) $(TargetOS.ToLowerInvariant()) $(TestProjectName) $(AdditionalXHarnessArguments)</RunTestsCommand>
|
|
<RunTestsCommand Condition="'$(TargetOS)' == 'Browser'">"$(RunScriptOutputPath)" $(JSEngine) $(AssemblyName).dll $(Scenario)</RunTestsCommand>
|
|
</PropertyGroup>
|
|
|
|
<!-- Invoke the run script with the test host as the runtime path. -->
|
|
<Exec Command="$(RunTestsCommand)"
|
|
ContinueOnError="true"
|
|
IgnoreExitCode="true"
|
|
IgnoreStandardErrorWarningFormat="true">
|
|
<Output PropertyName="TestRunExitCode" TaskParameter="ExitCode" />
|
|
</Exec>
|
|
|
|
<PropertyGroup Condition="'$(TestRunExitCode)' != '0'">
|
|
<TestResultsPath>$(OutputPath)$(TestResultsName)</TestResultsPath>
|
|
<TestRunErrorMessage>One or more tests failed while running tests from '$(TestProjectName)'.</TestRunErrorMessage>
|
|
<TestRunErrorMessage Condition="Exists('$(TestResultsPath)')">$(TestRunErrorMessage) Please check $(TestResultsPath) for details!</TestRunErrorMessage>
|
|
</PropertyGroup>
|
|
|
|
<Error Condition="'$(TestRunExitCode)' != '0'" Text="$(TestRunErrorMessage)" />
|
|
</Target>
|
|
|
|
<Import Project="$(MSBuildThisFileDirectory)tests.mobile.targets" Condition="'$(TargetsMobile)' == 'true'" />
|
|
<Import Project="$(MSBuildThisFileDirectory)tests.singlefile.targets" Condition="'$(TestSingleFile)' == 'true'" />
|
|
<Import Project="$(MSBuildThisFileDirectory)xunit\xunit.targets" Condition="'$(TestFramework)' == 'xunit'" />
|
|
|
|
<!-- Main test targets -->
|
|
<Target Name="Test" DependsOnTargets="$(TestDependsOn)" />
|
|
|
|
<Import Project="$(MSBuildThisFileDirectory)outerBuild.targets" Condition="'$(IsCrossTargetingBuild)' == 'true'" />
|
|
</Project>
|