Incremental Test Part 2 - TestAssetProjects (#3854)

* Incremetntal build of TestAsset Projects

* Cleanup

* PR Feedback
This commit is contained in:
Piotr Puszkiewicz 2016-07-13 12:52:33 -07:00 committed by GitHub
parent 36369d2180
commit f63258ebaa
4 changed files with 73 additions and 19 deletions

View file

@ -4,7 +4,10 @@
<UsingTask TaskName="GenerateBuildVersionInfo" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="CheckPrereqs" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="SetEnvVar" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetBuild" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetPack" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DownloadFile" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="ExtractArchive" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="ArchiveDirectory" AssemblyFile="$(CLIBuildDll)" />

View file

@ -1,12 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="test/ProjectsToTest.props" />
<Import Project="test/TestPackageProjects.props" />
<UsingTask TaskName="DotNetBuild" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetPack" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDll)" />
<Import Project="test/TestPackageProjects.targets" />
<Import Project="test/TestAssetProjects.targets" />
<Target Name="Test"
DependsOnTargets="PrepareTests;
@ -36,8 +32,6 @@
<Target Name="PrepareTests"
DependsOnTargets="Init">
<PropertyGroup>
<PathSeparator>/</PathSeparator>
<PathSeparator Condition=" '$(OSName)' == 'win' ">\</PathSeparator>
<TestPackageBuildVersionSuffix>$(CommitCount)</TestPackageBuildVersionSuffix>
<TestOutputDir>$(BaseOutputDirectory)/tests/</TestOutputDir>
<TestPackagesBuildDir>$(TestOutputDir)/packagesBuild/</TestPackagesBuildDir>
@ -96,20 +90,15 @@
</Target>
<Target Name="BuildTestAssetProjects"
DependsOnTargets="RestoreTestAssetProjects">
<ItemGroup>
<NoAutoBuildTestAssets Include="$(RepoRoot)TestAssets$(PathSeparator)TestProjects$(PathSeparator)**$(PathSeparator).noautobuild" />
<NoAutoBuildTestAssetProjects Include="%(NoAutoBuildTestAssets.RelativeDir)project.json" />
<BuildableTestAssetProjects Include="$(RepoRoot)TestAssets$(PathSeparator)TestProjects$(PathSeparator)**$(PathSeparator)project.json"
Exclude="@(NoAutoBuildTestAssetProjects)" />
</ItemGroup>
<Message Text="Skipping projects with .noautobuild files:" />
<Message Text="%(NoAutoBuildTestAssetProjects.Identity)" />
DependsOnTargets="RestoreTestAssetProjects;
SetupTestAssetProjectData;"
Inputs="%(TestAssetProjects.BuildInputs)"
Outputs="%(TestAssetProjects.BuildOutput)">
<DotNetBuild Framework="netcoreapp1.0"
ProjectPath="$(RepoRoot)%(TestAssetProjects.ProjectPath)"
ToolPath="$(DotnetUnderTest)"
WorkingDirectory="%(BuildableTestAssetProjects.RelativeDir)" />
WorkingDirectory="%(TestAssetProjects.RelativeDir)" />
</Target>
<Target Name="RestoreTestAssetProjects"

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="SetupTestAssetProjectData"
DependsOnTargets="AssociateTestAssetInputFilesWithProject">
</Target>
<Target Name="AssociateTestAssetInputFilesWithProject"
DependsOnTargets="IdentifyTestAssetInputFilesForProject;"
Outputs="%(TestAssetProjects.ProjectPath)">
<PropertyGroup>
<CurrentProject>%(TestAssetProjects.ProjectPath)</CurrentProject>
</PropertyGroup>
<ItemGroup>
<TestAssetProjects Condition=" '%(ProjectPath)' == '$(CurrentProject)' ">
<BuildInputs>@(TestAssetProjectInputs)</BuildInputs>
</TestAssetProjects>
</ItemGroup>
</Target>
<Target Name="IdentifyTestAssetInputFilesForProject"
DependsOnTargets="SetupBuildTestAssetProjectInputs;"
Outputs="%(TestAssetProjects.ProjectPath)">
<ItemGroup>
<TestAssetProjectInputs Include="%(TestAssetProjects.BuildInputIncludeFilter)"
Exclude="%(TestAssetProjects.BuildInputExcludeFilter)">
<ProjectPath>%(TestAssetProjects.ProjectPath)</ProjectPath>
</TestAssetProjectInputs>
</ItemGroup>
</Target>
<Target Name="SetupBuildTestAssetProjectInputs">
<PropertyGroup>
<PathSeparator>/</PathSeparator>
<PathSeparator Condition=" '$(OSName)' == 'win' ">\</PathSeparator>
</PropertyGroup>
<ItemGroup>
<NoAutoBuildTestAssets Include="TestAssets$(PathSeparator)TestProjects$(PathSeparator)**$(PathSeparator).noautobuild" />
<NoAutoBuildTestAssetProjects Include="%(NoAutoBuildTestAssets.RelativeDir)project.json" />
<TestAssetProjects Include="TestAssets$(PathSeparator)TestProjects$(PathSeparator)**$(PathSeparator)project.json"
Exclude="@(NoAutoBuildTestAssetProjects)"/>
<TestAssetProjects>
<BuildInputIncludeFilter>%(RelativeDir)**/*.*</BuildInputIncludeFilter>
<BuildInputExcludeFilter>%(RelativeDir)bin/**/*.*;%(RelativeDir)obj/**/*.*</BuildInputExcludeFilter>
<ProjectDir>$([System.IO.Directory]::GetParent(%(Identity)))</ProjectDir>
<ProjectPath>%(Identity)</ProjectPath>
</TestAssetProjects>
<TestAssetProjects>
<OutputName>$([System.IO.Path]::GetFileName(%(ProjectDir)))</OutputName>
<OutputName Condition=" '%(RelativeDir)' == 'TestAssets/TestProjects/AppWithOutputAssemblyName/' ">MyApp</OutputName>
<OutputName Condition=" '%(RelativeDir)' == 'TestAssets/TestProjects/TestAppWithContentPackage/' ">AppWithContentPackage</OutputName>
</TestAssetProjects>
<TestAssetProjects>
<BuildOutput>%(TestAssetProjects.RelativeDir)bin/$(Configuration)/netcoreapp1.0/%(TestAssetProjects.OutputName).dll</BuildOutput>
</TestAssetProjects>
</ItemGroup>
</Target>
</Project>