dotnet-installer/build/Microsoft.DotNet.Cli.Test.targets

119 lines
4.9 KiB
Text
Raw Normal View History

<Project ToolsVersion="14.0" DefaultTargets="Test">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<PathSeparator>/</PathSeparator>
<PathSeparator Condition=" '$(OSName)' == 'win' ">\</PathSeparator>
</PropertyGroup>
<Import Project="test/TestPackageProjects.targets" />
<Import Project="test/TestProjects.targets" />
2016-08-09 22:19:34 +00:00
<Target Name="Test"
Condition=" '$(CLIBUILD_SKIP_TESTS)' != 'true' "
DependsOnTargets="BuildTests;">
<PropertyGroup>
<PathListSeparator>:</PathListSeparator>
<PathListSeparator Condition=" '$(OSName)' == 'win' ">%3b</PathListSeparator>
<ExecPath>$(Stage2Directory)$(PathListSeparator)$(PATH)</ExecPath>
<ExecPath Condition=" '$(OSName)' == 'win' ">$(Stage2Directory)</ExecPath>
<TestArtifactsEnv>$(TestArtifactsDir)</TestArtifactsEnv>
</PropertyGroup>
<ItemGroup>
<TestTaskEnvironmentVariables Include="PATH=$(ExecPath)" />
<TestTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsEnv)" />
</ItemGroup>
2016-08-09 22:19:34 +00:00
<PropertyGroup>
<RunTestEnvironmentVariables>@(TestTaskEnvironmentVariables)</RunTestEnvironmentVariables>
</PropertyGroup>
<ItemGroup>
<ProjectsToTest Include="build/test/RunTest.proj">
<Properties>
CLIBuildDll=$(CLIBuildDll);
2016-08-09 22:19:34 +00:00
Configuration=$(Configuration);
EnvironmentVariables=$(RunTestEnvironmentVariables);
TestProject=%(TestProjects.Identity);
2016-08-09 22:19:34 +00:00
TestResultXmlDir=$(TestResultXmlDir);
ToolPath=$(Stage0Directory);
WorkingDirectory=$([System.IO.Directory]::GetParent(%(TestProjects.Identity)))
2017-01-21 02:30:10 +00:00
ToolPath=$(Stage2Directory);
2016-08-09 22:19:34 +00:00
</Properties>
</ProjectsToTest>
</ItemGroup>
<Message Text="Starting test execution" Importance="High" />
2016-08-09 22:19:34 +00:00
<MSBuild
BuildInParallel="True"
Projects="@(ProjectsToTest)">
</MSBuild>
<Message Text="Finished test execution" Importance="High" />
</Target>
<Target Name="PrepareTests"
DependsOnTargets="Init;
SetupTestProjectData">
<PropertyGroup>
<TestPackageBuildVersionSuffix>$(CommitCount)</TestPackageBuildVersionSuffix>
<TestOutputDir>$(RepoRoot)/artifacts/testpackages/</TestOutputDir>
<TestPackagesBuildDir>$(TestOutputDir)/packagesBuild/</TestPackagesBuildDir>
<TestPackagesDir>$(TestOutputDir)/packages/</TestPackagesDir>
<TestArtifactsDir>$(TestOutputDir)/artifacts/</TestArtifactsDir>
<TestResultXmlDir>$(TestOutputDir)/results/</TestResultXmlDir>
<TestDirectory>$(RepoRoot)/test/</TestDirectory>
<DotnetUnderTest>$(Stage2Directory)</DotnetUnderTest>
</PropertyGroup>
<MakeDir Directories="$(TestPackagesDir)" Condition="!Exists('$(TestPackagesDir)')"/>
</Target>
<Target Name="RestoreTests"
DependsOnTargets="PrepareTests;
CreateTestAssetPackageNuPkgs;">
2017-01-18 20:04:18 +00:00
<DotNetRestore ToolPath="$(Stage0Directory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;" />
</Target>
<Target Name="BuildTests"
DependsOnTargets="RestoreTests;">
<DotNetBuild ToolPath="$(Stage0Directory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;" />
</Target>
2016-08-09 22:19:34 +00:00
<Target Name="CreateTestAssetPackageNuPkgs"
DependsOnTargets="SetupTestPackageProjectData;"
Inputs="%(TestPackageProject.PackInputs)"
Outputs="%(TestPackageProject.PackOutputs)">
<PropertyGroup>
2017-01-10 22:12:04 +00:00
<Framework>%(TestPackageProject.Framework)</Framework>
<DoPackRuntime Condition=" '$(Framework)' == 'net45' Or '$(Framework)' == 'net451' ">true</DoPackRuntime>
<DotNetPackMsbuildArgs>/p:TargetFramework=$(Framework)</DotNetPackMsbuildArgs>
<DotNetPackMsbuildArgs Condition=" '$(IsDesktopAvailable)' == 'True' And '%(TestPackageProject.PackRuntime)' != '' And '$(DoPackRuntime)' != '' ">/p:RuntimeIdentifier=%(TestPackageProject.PackRuntime)</DotNetPackMsbuildArgs>
</PropertyGroup>
2017-01-10 18:47:10 +00:00
<DotNetRestore ToolPath="$(Stage2Directory)"
Source="$(TestPackagesDir)"
ConfigFile="$(RepoRoot)\NuGet.Config"
ProjectPath="%(TestPackageProject.ProjectPath)" />
2017-01-10 22:12:04 +00:00
<DotNetBuild Framework="$(Framework)"
Runtime="%(TestPackageProject.Runtime)"
ProjectPath="%(TestPackageProject.ProjectPath)"
ToolPath="$(Stage0Directory)" />
<!-- https://github.com/NuGet/Home/issues/4063 -->
<DotNetPack NoBuild="True"
Output="$(TestPackagesDir)"
ProjectPath="%(TestPackageProject.ProjectPath)"
ToolPath="$(Stage0Directory)"
VersionSuffix="%(TestPackageProject.VersionSuffix)"
MsbuildArgs="$(DotNetPackMsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" />
</Target>
</Project>