dotnet-installer/build/Test.targets
John Beisner a54f0ffb81
Enable 'arm' builds in the CLI (#8791)
* First draft enablement of Win-arm and Linux-arm builds for the CLI.

* Fixing a typo

* Disable tests for arm; enable badges and FinalizeBuild for arm.

* Remove the 'Win-arm' leg.

* Update the README

* Update the README [2]

* Update netci.groovy

* Fixing a hard-coded Architecture: 'linux-x64'; removing the LZMA for 'arm'.
2018-03-14 19:04:25 -07:00

98 lines
4.3 KiB
XML

<Project ToolsVersion="14.0" DefaultTargets="Test">
<Import Project="test/TestPackageProjects.targets" />
<Import Project="test/TestProjects.targets" />
<PropertyGroup>
<PathListSeparator>:</PathListSeparator>
<PathListSeparator Condition=" '$(OSName)' == 'win' ">%3b</PathListSeparator>
<ExecPath>$(OutputDirectory)$(PathListSeparator)$(PATH)</ExecPath>
<ExecPath Condition=" '$(OSName)' == 'win' ">$(OutputDirectory)</ExecPath>
<TestPackagesDir>$(TestOutputDir)/packages/</TestPackagesDir>
<TestArtifactsDir>$(TestOutputDir)/artifacts/</TestArtifactsDir>
<TestResultXmlDir>$(TestOutputDir)/results/</TestResultXmlDir>
</PropertyGroup>
<Target Name="Test"
Condition=" '$(CLIBUILD_SKIP_TESTS)' != 'true' And !$(Architecture.StartsWith('arm')) "
DependsOnTargets="TestsForBuildItself;BuildTests;">
<!-- Make ure the test packages directory exists so that it's not an error to have it as a package source -->
<MakeDir Directories="$(TestPackagesDir)" />
<ItemGroup>
<ProjectsToTest Include="build/test/RunTest.proj">
<Properties>
CLIBuildDll=$(CLIBuildDll);
Configuration=$(Configuration);
TestArtifactsDir=$(TestArtifactsDir);
TestPackagesDir=$(TestPackagesDir);
PreviousStageProps=$(NextStagePropsPath);
TestProject=%(TestProjects.Identity);
TestResultXmlDir=$(TestResultXmlDir);
ToolPath=$(OutputDirectory);
WorkingDirectory=$([System.IO.Directory]::GetParent(%(TestProjects.Identity)))
</Properties>
</ProjectsToTest>
</ItemGroup>
<Message Text="Starting test execution" Importance="High" />
<MSBuild
BuildInParallel="True"
Projects="@(ProjectsToTest)">
</MSBuild>
<Message Text="Finished test execution" Importance="High" />
</Target>
<Target Name="PrepareTests"
DependsOnTargets="Init;
SetupTestProjectData">
<MakeDir Directories="$(TestPackagesDir)" Condition="!Exists('$(TestPackagesDir)')"/>
</Target>
<Target Name="RestoreTests"
DependsOnTargets="PrepareTests;
CreateTestAssetPackageNuPkgs;">
<DotNetRestore ToolPath="$(OutputDirectory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;"
AdditionalParameters="/p:PreviousStageProps=$(NextStagePropsPath)" />
</Target>
<Target Name="BuildTests"
DependsOnTargets="RestoreTests;">
<DotNetBuild ToolPath="$(OutputDirectory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;"
AdditionalParameters="/p:PreviousStageProps=$(NextStagePropsPath)"
MaxCpuCount="1" />
</Target>
<Target Name="CreateTestAssetPackageNuPkgs"
DependsOnTargets="SetupTestPackageProjectData;"
Outputs="%(TestPackageProject.Identity)">
<DotNetRestore ToolPath="$(OutputDirectory)"
WorkingDirectory="$([System.IO.Directory]::GetParent('%(TestPackageProject.ProjectPath)'))"
ProjectPath="%(TestPackageProject.ProjectPath)"
AdditionalParameters="/p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages /p:PreviousStageProps=$(NextStagePropsPath)"
/>
<!-- https://github.com/NuGet/Home/issues/4063 -->
<DotNetPack Output="$(TestPackagesDir)"
ProjectPath="%(TestPackageProject.ProjectPath)"
ToolPath="$(OutputDirectory)"
VersionSuffix="%(TestPackageProject.VersionSuffix)"
MsbuildArgs="%(TestPackageProject.MsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion) /p:RestoreAdditionalProjectSources=$(TestOutputDir)/packages /p:PreviousStageProps=$(NextStagePropsPath)" />
</Target>
<Target Name="TestsForBuildItself">
<DotNetMSBuild Arguments="/v:diag $(RepoRoot)/test/MsBuildScript.Tests/runtests.target"
ToolPath="$(PreviousStageDirectory)" />
</Target>
<Target Name="EnsureStageSeparation">
<DotNetMSBuild Arguments="/v:diag $(RepoRoot)/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj /p:OutputDirectory=&quot;$(OutputDirectory)&quot;"
ToolPath="$(PreviousStageDirectory)" />
</Target>
</Project>