dotnet-installer/build/Test.targets
Livar Cunha e2b679c4bb Merge branch 'master' of /Users/livarcocc/Documents/git/cli into merge_master_cli
* 'master' of /Users/livarcocc/Documents/git/cli: (1063 commits)
  Updating signing project to use new intermediate directory (int).
  Update runtimeconfig.json doc for 2.1 (#9382)
  Shortening the path to the intermediate folder by renaming it to int.
  fix typo (#9364)
  Updating asp.net to 2.2.0 as well.
  Updating the build and tests to work with the 2.2.0 runtime.
  Simplified combining dictionaries in Telemetry
  Fixing 'Channel' and 'BranchName': "release/2.1.4xx" to "master" (#9362)
  Fix extraction of folders (#9335)
  Update Sha256Hasher.cs
  Fix relative path tool path (#9330)
  Insert updated SDK from 2.1.4xx branch
  MSBuild 15.8.60
  Fix crash when user home directory cannot be determined.
  Make `CliFolderPathCalculator` a static class.
  Don't add the ReleaseSuffix to the branding on the CLI when DropSuffix is set to true.
  Add retry when Directory.Move (#9313)
  Override new SdkResult public properties
  Add reference to Microsoft.Build.NuGetSdkResolver
  Disable crossgen for MSBuild inline-task refs
  ...
2018-06-25 22:38:01 -07:00

130 lines
6.3 KiB
XML

<Project ToolsVersion="14.0" DefaultTargets="Test">
<Import Project="test/TestPackageProjects.targets" />
<Import Project="test/TestProjects.targets" />
<PropertyGroup>
<PathListSeparator>:</PathListSeparator>
<PathListSeparator Condition=" '$(OS)' == 'Windows_NT' ">%3b</PathListSeparator>
<ExecPath>$(OutputDirectory)$(PathListSeparator)$(PATH)</ExecPath>
<ExecPath Condition=" '$(OS)' == 'Windows_NT' ">$(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="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>
<!-- Begin Workaround lack of a stable package version for depedencies; copy into simulated stable version folders -->
<PropertyGroup>
<StableSharedFrameworkDirectory>$(OutputDirectory)/shared/Microsoft.NETCore.App/$(SharedFrameworkStableVersion)</StableSharedFrameworkDirectory>
<StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes>$(Stage2WithBackwardsCompatibleRuntimesOutputDirectory)/shared/Microsoft.NETCore.App/$(SharedFrameworkStableVersion)</StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes>
</PropertyGroup>
<ItemGroup>
<Stabilize_SourceFiles_2_0 Include="$(OutputDirectory)/shared/Microsoft.NETCore.App/$(MicrosoftNETCoreAppPackageVersion)/*.*"/>
<SimulatedStableSharedFrameworkDirectories Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
Include="$(StableSharedFrameworkDirectory)" />
<SimulatedStableSharedFrameworkDirectories Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
Include="$(StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes)" />
</ItemGroup>
<Copy
Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
SourceFiles="@(Stabilize_SourceFiles_2_0)"
DestinationFiles="@(Stabilize_SourceFiles_2_0->'$(StableSharedFrameworkDirectory)/%(RecursiveDir)%(Filename)%(Extension)')"
/>
<Copy
Condition=" '$(IsSharedFrameworkPreReleaseVersion)' == 'True' "
SourceFiles="@(Stabilize_SourceFiles_2_0)"
DestinationFiles="@(Stabilize_SourceFiles_2_0->'$(StableSharedFrameworkDirectoryWithBackwardsCompatibleRuntimes)/%(RecursiveDir)%(Filename)%(Extension)')"
/>
<!-- End Workaround lack of a stable package version for depedencies; copy into simulated stable versions -->
<Message Text="Starting test execution" Importance="High" />
<MSBuild
BuildInParallel="True"
Projects="@(ProjectsToTest)">
</MSBuild>
<Exec Command="$(DotnetInOutputDirectory) exec $(RoslynDirectory)/bincore/VBCSCompiler.dll -shutdown" />
<Message Text="Finished test execution" Importance="High" />
<!-- Begin Workaround lack of a stable package version for depedencies; remove simulated stable version folder. -->
<RemoveDir Directories="@(SimulatedStableSharedFrameworkDirectories)" />
<!-- End Workaround lack of a stable package version for depedencies; remove simulated stable version folder. -->
</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="EnsureStageSeparation">
<DotNetMSBuild Arguments="/v:diag $(RepoRoot)/build_projects/Microsoft.DotNet.Cli.Build.SelfTest/InvokeWithStage0.proj /p:OutputDirectory=&quot;$(OutputDirectory)&quot;"
ToolPath="$(PreviousStageDirectory)" />
</Target>
</Project>