2016-07-11 19:46:27 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<Project ToolsVersion="14.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2016-07-15 07:20:23 +00:00
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
<PathSeparator>/</PathSeparator>
|
|
|
|
<PathSeparator Condition=" '$(OSName)' == 'win' ">\</PathSeparator>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
2016-07-13 19:52:33 +00:00
|
|
|
<Import Project="test/TestPackageProjects.targets" />
|
|
|
|
<Import Project="test/TestAssetProjects.targets" />
|
2016-07-15 07:20:23 +00:00
|
|
|
<Import Project="test/TestProjects.targets" />
|
2016-07-11 19:46:27 +00:00
|
|
|
|
2016-08-09 22:19:34 +00:00
|
|
|
<Target Name="Test"
|
2016-12-05 21:36:35 +00:00
|
|
|
Condition=" '$(CLIBUILD_SKIP_TESTS)' != 'true' "
|
2016-07-11 19:46:27 +00:00
|
|
|
DependsOnTargets="PrepareTests;
|
|
|
|
BuildTestAssets;
|
|
|
|
BuildTests;">
|
2016-11-12 07:46:29 +00:00
|
|
|
|
2016-07-11 19:46:27 +00:00
|
|
|
<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);
|
|
|
|
Configuration=$(Configuration);
|
|
|
|
EnvironmentVariables=$(RunTestEnvironmentVariables);
|
2016-11-12 07:46:29 +00:00
|
|
|
TestProject=%(TestProjects.ProjectPath);
|
2016-08-09 22:19:34 +00:00
|
|
|
TestProjectName=%(TestProjects.OutputName);
|
|
|
|
TestResultXmlDir=$(TestResultXmlDir);
|
2017-01-05 20:40:23 +00:00
|
|
|
ToolPath=$(Stage0Directory);
|
2016-08-09 22:19:34 +00:00
|
|
|
WorkingDirectory=%(TestProjects.ProjectDir)
|
|
|
|
</Properties>
|
|
|
|
</ProjectsToTest>
|
|
|
|
</ItemGroup>
|
|
|
|
|
2016-12-13 22:15:35 +00:00
|
|
|
<Message Text="Starting test execution" Importance="High" />
|
|
|
|
|
2016-08-09 22:19:34 +00:00
|
|
|
<MSBuild
|
|
|
|
BuildInParallel="True"
|
|
|
|
Projects="@(ProjectsToTest)">
|
|
|
|
</MSBuild>
|
2016-12-13 22:15:35 +00:00
|
|
|
|
|
|
|
<Message Text="Finished test execution" Importance="High" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="PrepareTests"
|
|
|
|
DependsOnTargets="Init">
|
|
|
|
<PropertyGroup>
|
|
|
|
<TestPackageBuildVersionSuffix>$(CommitCount)</TestPackageBuildVersionSuffix>
|
2016-10-28 01:46:43 +00:00
|
|
|
<TestOutputDir>$(RepoRoot)/artifacts/testpackages/</TestOutputDir>
|
2016-07-13 00:10:48 +00:00
|
|
|
<TestPackagesBuildDir>$(TestOutputDir)/packagesBuild/</TestPackagesBuildDir>
|
|
|
|
<TestPackagesDir>$(TestOutputDir)/packages/</TestPackagesDir>
|
|
|
|
<TestArtifactsDir>$(TestOutputDir)/artifacts/</TestArtifactsDir>
|
|
|
|
<TestResultXmlDir>$(TestOutputDir)/results/</TestResultXmlDir>
|
|
|
|
<TestDirectory>$(RepoRoot)/test/</TestDirectory>
|
|
|
|
<DotnetUnderTest>$(Stage2Directory)</DotnetUnderTest>
|
2016-07-11 19:46:27 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
</Target>
|
|
|
|
|
2016-08-09 22:19:34 +00:00
|
|
|
<Target Name="BuildTests"
|
2016-07-15 07:20:23 +00:00
|
|
|
DependsOnTargets="RestoreTests;
|
|
|
|
SetupTestProjectData;"
|
|
|
|
Inputs="%(TestProjects.BuildInputs)"
|
|
|
|
Outputs="%(TestProjects.BuildOutput)">
|
2016-11-12 07:46:29 +00:00
|
|
|
<DotNetBuild Configuration="$(Configuration)"
|
|
|
|
Framework="%(TestProjects.Framework)"
|
2017-01-05 20:40:23 +00:00
|
|
|
ToolPath="$(Stage0Directory)"
|
2016-11-12 07:46:29 +00:00
|
|
|
ProjectPath="%(TestProjects.ProjectPath)" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="RestoreTests"
|
|
|
|
DependsOnTargets="CreateTestAssetPackageNuPkgs;
|
2016-11-12 07:46:29 +00:00
|
|
|
CleanTestProjectsBinObj;
|
2016-07-11 19:46:27 +00:00
|
|
|
SetupRestoreTestsInputs;"
|
|
|
|
Inputs="@(RestoreTestsInputs)"
|
2016-11-12 07:46:29 +00:00
|
|
|
Outputs="@(RestoreTestsInputs->'%(RelativeDir)/obj/project.assets.json');@(RestoreTestsInputs->'%(RelativeDir)/obj/%(Filename).csproj.nuget.g.props');@(RestoreTestsInputs->'%(RelativeDir)/obj/%(Filename).csproj.nuget.g.targets')">
|
2016-07-15 07:20:23 +00:00
|
|
|
<CallTarget Targets="CleanTestProjectsLockFiles"/>
|
|
|
|
|
2017-01-05 20:40:23 +00:00
|
|
|
<DotNetRestore ToolPath="$(Stage0Directory)"
|
2016-11-12 07:46:29 +00:00
|
|
|
ProjectPath=""%(RestoreTestsInputs.FullPath)"" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
2016-08-09 22:19:34 +00:00
|
|
|
|
2016-11-12 07:46:29 +00:00
|
|
|
<Target Name="CleanTestProjectsBinObj"
|
|
|
|
DependsOnTargets="SetupRestoreTestsInputs;">
|
2016-07-13 00:10:48 +00:00
|
|
|
<ItemGroup>
|
2016-11-12 07:46:29 +00:00
|
|
|
<FilesToDelete Include="$(TestDirectory)**/bin/**/project.assets.json;$(TestDirectory)**/bin/**/*.csproj.nuget.g.props;$(TestDirectory)**/bin/**/*.csproj.nuget.g.targets" />
|
|
|
|
<FilesToDelete Include="$(TestDirectory)**/obj/**/project.assets.json;$(TestDirectory)**/obj/**/*.csproj.nuget.g.props;$(TestDirectory)**/obj/**/*.csproj.nuget.g.targets" />
|
2016-08-09 22:19:34 +00:00
|
|
|
</ItemGroup>
|
2016-07-13 00:10:48 +00:00
|
|
|
|
|
|
|
<Delete Files="@(FilesToDelete)" />
|
|
|
|
|
|
|
|
<ItemGroup>
|
|
|
|
<FilesToDelete Remove="*" />
|
|
|
|
</ItemGroup>
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="SetupRestoreTestsInputs"
|
|
|
|
DependsOnTargets="PrepareTests;" >
|
|
|
|
<ItemGroup>
|
2016-11-12 07:46:29 +00:00
|
|
|
<RestoreTestsInputs Include="$(TestDirectory)/**/*.csproj"
|
|
|
|
Exclude="$(TestDirectory)/**/bin/**/*.csproj" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</ItemGroup>
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="BuildTestAssets"
|
|
|
|
DependsOnTargets="BuildTestAssetProjects;
|
|
|
|
BuildDesktopTestAssetProjects;">
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="BuildTestAssetProjects"
|
2016-07-13 19:52:33 +00:00
|
|
|
DependsOnTargets="RestoreTestAssetProjects;
|
|
|
|
SetupTestAssetProjectData;"
|
|
|
|
Inputs="%(TestAssetProjects.BuildInputs)"
|
|
|
|
Outputs="%(TestAssetProjects.BuildOutput)">
|
2016-07-11 19:46:27 +00:00
|
|
|
|
2016-11-03 06:01:57 +00:00
|
|
|
<DotNetBuildPj Framework="netcoreapp1.0"
|
|
|
|
ProjectPath="$(RepoRoot)%(TestAssetProjects.ProjectPath)"
|
2016-11-12 07:46:29 +00:00
|
|
|
ToolPath="$(Stage0PjDirectory)" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="RestoreTestAssetProjects"
|
|
|
|
DependsOnTargets="CreateTestAssetPackageNuPkgs;
|
|
|
|
SetupRestoreTestAssetProjectsInputs;"
|
|
|
|
Inputs="@(RestoreTestAssetProjectsInputs)"
|
|
|
|
Outputs="@(RestoreTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')">
|
2016-07-13 00:10:48 +00:00
|
|
|
|
2016-11-03 06:01:57 +00:00
|
|
|
<DotNetRestorePj FallbackSource="$(TestPackagesDir)"
|
|
|
|
ToolPath="$(Stage0PjDirectory)"
|
|
|
|
WorkingDirectory="$(RepoRoot)TestAssets/TestProjects/" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="SetupRestoreTestAssetProjectsInputs" >
|
|
|
|
<ItemGroup>
|
|
|
|
<RestoreTestAssetProjectsInputs Include="$(RepoRoot)/TestAssets/TestProjects/**/project.json" />
|
|
|
|
</ItemGroup>
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="CleanTestAssetProjectsLockFiles" >
|
|
|
|
<ItemGroup>
|
|
|
|
<TestAssetProjectsLockFiles Include="$(RepoRoot)/TestAssets/TestProjects/**/project.lock.json" />
|
|
|
|
</ItemGroup>
|
2016-08-09 22:19:34 +00:00
|
|
|
<Delete Files="@(TestAssetProjectsLockFiles)" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
2016-07-15 07:20:23 +00:00
|
|
|
<Target Name="CleanTestProjectsLockFiles" >
|
|
|
|
<ItemGroup>
|
2016-11-12 07:46:29 +00:00
|
|
|
<TestProjectsLockFiles Include="$(RepoRoot)/test/**/project.assets.json;$(RepoRoot)/test/**/*.csproj.nuget.g.props;$(RepoRoot)/test/**/*.csproj.nuget.g.targets" />
|
2016-07-15 07:20:23 +00:00
|
|
|
</ItemGroup>
|
2016-08-09 22:19:34 +00:00
|
|
|
<Delete Files="@(TestProjectsLockFiles)" />
|
2016-07-15 07:20:23 +00:00
|
|
|
</Target>
|
|
|
|
|
2016-08-09 22:19:34 +00:00
|
|
|
<Target Name="BuildDesktopTestAssetProjects"
|
|
|
|
Condition=" '$(IsDesktopAvailable)' == 'True' "
|
2016-07-11 19:46:27 +00:00
|
|
|
DependsOnTargets="RestoreDesktopTestAssetProjects">
|
|
|
|
<ItemGroup>
|
|
|
|
<NoAutoBuildDesktopTestAssets Include="$(RepoRoot)TestAssets\DesktopTestProjects\**\.noautobuild" />
|
|
|
|
<NoAutoBuildDesktopTestAssetProjects Include="%(NoAutoBuildDesktopTestAssets.RelativeDir)project.json" />
|
2016-08-09 22:19:34 +00:00
|
|
|
<BuildableDesktopTestAssetProjects Include="$(RepoRoot)TestAssets\DesktopTestProjects\**\project.json"
|
2016-07-11 19:46:27 +00:00
|
|
|
Exclude="@(NoAutoBuildDesktopTestAssetProjects)" />
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
<Message Text="Skipping projects with .noautobuild files:" />
|
|
|
|
<Message Text="%(NoAutoBuildDesktopTestAssetProjects.FullPath)" />
|
|
|
|
|
2016-11-14 22:26:03 +00:00
|
|
|
<DotNetBuild Condition="'@(BuildableDesktopTestAssetProjects)' != ''"
|
|
|
|
Configuration="$(Configuration)"
|
2016-10-11 21:01:03 +00:00
|
|
|
Framework="net46"
|
2016-07-13 00:10:48 +00:00
|
|
|
ProjectPath="%(BuildableDesktopTestAssetProjects.FullPath)"
|
2016-11-12 07:46:29 +00:00
|
|
|
ToolPath="$(Stage0PjDirectory)" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="RestoreDesktopTestAssetProjects"
|
2016-08-09 22:19:34 +00:00
|
|
|
Condition=" '$(IsDesktopAvailable)' == 'True' "
|
2016-07-11 19:46:27 +00:00
|
|
|
DependsOnTargets="CreateTestAssetPackageNuPkgs;
|
|
|
|
SetupRestoreDesktopTestAssetProjectsInputs;"
|
|
|
|
Inputs="@(RestoreDesktopTestAssetProjectsInputs)"
|
|
|
|
Outputs="@(RestoreDesktopTestAssetProjectsInputs->'%(RelativeDir)/project.lock.json')">
|
2016-07-13 00:10:48 +00:00
|
|
|
|
2016-11-03 06:01:57 +00:00
|
|
|
<DotNetRestorePj FallbackSource="$(TestPackagesDir)"
|
|
|
|
ToolPath="$(Stage0PjDirectory)"
|
|
|
|
WorkingDirectory="$(RepoRoot)TestAssets\DesktopTestProjects\" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="SetupRestoreDesktopTestAssetProjectsInputs">
|
|
|
|
<ItemGroup>
|
|
|
|
<RestoreDesktopTestAssetProjectsInputs Include="$(RepoRoot)TestAssets\DesktopTestProjects\**\project.json" />
|
|
|
|
</ItemGroup>
|
|
|
|
</Target>
|
|
|
|
|
2016-08-09 22:19:34 +00:00
|
|
|
<Target Name="CreateTestAssetPackageNuPkgs"
|
2016-11-15 22:12:28 +00:00
|
|
|
DependsOnTargets="BuildTestAssetPackageProjects;
|
2016-07-11 19:46:27 +00:00
|
|
|
SetupTestPackageProjectData;"
|
2016-07-13 00:10:48 +00:00
|
|
|
Inputs="%(TestPackageProject.PackInputs)"
|
|
|
|
Outputs="%(TestPackageProject.PackOutputs)">
|
2016-07-11 19:46:27 +00:00
|
|
|
|
2016-11-15 22:12:28 +00:00
|
|
|
<PropertyGroup>
|
|
|
|
<DotNetPackMsbuildArgs>/p:TargetFramework=%(TestPackageProject.Framework)</DotNetPackMsbuildArgs>
|
|
|
|
<DotNetPackMsbuildArgs Condition=" '$(IsDesktopAvailable)' == 'True' And '%(TestPackageProject.PackRuntime)' != '' ">/p:RuntimeIdentifier=%(TestPackageProject.PackRuntime)</DotNetPackMsbuildArgs>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
2016-12-09 08:30:02 +00:00
|
|
|
<!-- https://github.com/NuGet/Home/issues/4063 -->
|
2016-11-15 22:12:28 +00:00
|
|
|
<DotNetPack NoBuild="True"
|
2016-11-14 22:26:03 +00:00
|
|
|
Output="$(TestPackagesDir)"
|
2016-11-15 22:12:28 +00:00
|
|
|
ProjectPath="%(TestPackageProject.ProjectPath)"
|
2017-01-05 20:40:23 +00:00
|
|
|
ToolPath="$(Stage0Directory)"
|
2016-11-15 22:12:28 +00:00
|
|
|
VersionSuffix="%(TestPackageProject.VersionSuffix)"
|
2016-12-09 08:30:02 +00:00
|
|
|
MsbuildArgs="$(DotNetPackMsbuildArgs) /p:SdkNuGetVersion=$(SdkNugetVersion)" />
|
2016-11-14 22:26:03 +00:00
|
|
|
</Target>
|
2016-07-11 19:46:27 +00:00
|
|
|
|
2016-11-15 22:12:28 +00:00
|
|
|
<Target Name="BuildTestAssetPackageProjects"
|
|
|
|
DependsOnTargets="RestoreTestAssetPackageProjects;
|
2016-07-11 19:46:27 +00:00
|
|
|
SetupTestPackageProjectData;"
|
2016-07-13 00:10:48 +00:00
|
|
|
Inputs="%(TestPackageProject.BuildInputs)"
|
|
|
|
Outputs="%(TestPackageProject.BuildOutputs)">
|
2016-08-09 22:19:34 +00:00
|
|
|
|
2016-11-15 22:12:28 +00:00
|
|
|
<DotNetBuild Framework="%(TestPackageProject.Framework)"
|
|
|
|
Runtime="%(TestPackageProject.Runtime)"
|
|
|
|
ProjectPath="%(TestPackageProject.ProjectPath)"
|
2017-01-05 20:40:23 +00:00
|
|
|
ToolPath="$(Stage0Directory)" />
|
2016-11-14 22:26:03 +00:00
|
|
|
</Target>
|
2016-11-15 22:12:28 +00:00
|
|
|
|
|
|
|
<Target Name="RestoreTestAssetPackageProjects"
|
2016-07-11 19:46:27 +00:00
|
|
|
DependsOnTargets="PrepareTests;
|
2016-12-13 22:15:35 +00:00
|
|
|
SetupTestPackageProjectData;">
|
2016-11-14 22:26:03 +00:00
|
|
|
|
2016-12-13 22:15:35 +00:00
|
|
|
<DotNetRestore ToolPath="$(Stage2Directory)"
|
|
|
|
WorkingDirectory="%(TestPackageProject.FullPath)" />
|
2016-07-11 19:46:27 +00:00
|
|
|
</Target>
|
2016-12-13 22:15:35 +00:00
|
|
|
</Project>
|