Xamarin Public Jenkins (auto-signing) 6bdd276d05 Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
2017-04-10 11:41:01 +00:00

111 lines
6.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="PrereleaseResolveNuGetPackageAssets" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="RemoveDuplicatesWithLastOneWinsPolicy" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="ZipFileCreateFromDirectory" Condition="'$(ArchiveTests)' == 'true'" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="GenerateAssemblyList" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="GetTargetMachineInfo" Condition="'$(TestWithLocalLibraries)'=='true'" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<PropertyGroup>
<SerializeProjects Condition="'$(TestWithLocalLibraries)'=='true'">true</SerializeProjects>
</PropertyGroup>
<!--
Temporary until we have proper nuget support to deploy content files.
Copies supplemental test data to the build output and test directories.
-->
<Target Name="CopySupplementalTestData" DependsOnTargets="DiscoverTestInputs">
<!-- coalesce supplemental test data items with and without DestinationDir metadata -->
<ItemGroup>
<_SupplementalTestData Include="@(SupplementalTestData)" Condition="'%(DestinationDir)' != ''">
<DestinationDir>%(DestinationDir)</DestinationDir>
</_SupplementalTestData>
<_SupplementalTestData Include="@(SupplementalTestData)" Condition="'%(DestinationDir)' == ''">
<DestinationDir>%(RecursiveDir)</DestinationDir>
</_SupplementalTestData>
</ItemGroup>
<ItemGroup>
<SupplementalTestDataTestDir Include="@(_SupplementalTestData->'$(TestPath)/%(DestinationDir)%(Filename)%(Extension)')" />
<SupplementalTestDataOutDir Include="@(_SupplementalTestData->'$(OutDir)%(DestinationDir)%(Filename)%(Extension)')" />
</ItemGroup>
<Copy
SourceFiles="@(_SupplementalTestData)"
DestinationFiles="@(SupplementalTestDataTestDir)"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Copy
SourceFiles="@(_SupplementalTestData)"
DestinationFiles="@(SupplementalTestDataOutDir)"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<!-- Workaround for VS execution: This will form the same list and copy the same files as
copied via RunTests script so VS can work when the test dir is initially clean.
-->
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)'=='true'">
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);CopyDefaultTestAssetsForVS</PrepareForRunDependsOn>
</PropertyGroup>
<Target Name="CopyDefaultTestAssetsForVS" DependsOnTargets="DiscoverTestInputs;CopySupplementalTestData">
<!-- This was copied from RunTestsForProject in tests.targets
The RunTestsForProject target does not execute in VS context and would be confused by the script based runner.
_TestCopyLocalByFileNameWithoutDuplicates are the precise items that are fed to the runner script generation code.
-->
<ItemGroup>
<!-- Not all platforms can use the .ni.dlls that come from packages. If TestWithoutNativeImages is specified, we'll exclude them from copy generation.
If we end up needing this for any other sorts of filtering, we'll want to add a list of filtered extensions to be matched on EndsWith. -->
<_IncludedFileForTestsInVS Include="@(_TestCopyLocalByFileNameWithoutDuplicates)"
Condition="'$(TestWithoutNativeImages)' != 'true' Or !$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').EndsWith('.ni.dll'))" >
<PackageRelativePath Condition="'%(_TestCopyLocalByFileNameWithoutDuplicates.NugetPackageId)' != ''">$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').Replace('$(PackagesDir)',''))</PackageRelativePath>
<UseAbsolutePath Condition="'$(TestWithLocalLibraries)'=='true'">$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').StartsWith('$(BinDir)'))</UseAbsolutePath>
<DestinationPath>$(TestPath)\%(Filename)%(Extension)</DestinationPath>
</_IncludedFileForTestsInVS>
<_IncludedFileForTestsInVs Remove="@(_IncludedFileForTestsInVS)" Condition="Exists('%(DestinationPath)')" />
</ItemGroup>
<Copy
SourceFiles="@(_IncludedFileForTestsInVS -> '%(SourcePath)')"
DestinationFiles="@(_IncludedFileForTestsInVS->'%(DestinationPath)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<!-- archive the test binaries along with some supporting files -->
<Target Name="ArchiveTestBuild"
Condition="'$(ArchiveTests)' == 'true'"
DependsOnTargets="GenerateTestExecutionScripts">
<PropertyGroup>
<TestArchiveDir>$(TestWorkingDir)$(OSPlatformConfig)/archive/tests/$(TargetOutputRelPath)</TestArchiveDir>
<TestArchiveDir Condition="'$(TestTFM)' != ''">$(TestArchiveDir)$(TestTFM)/</TestArchiveDir>
<ProjectJson Condition="!Exists('$(ProjectJson)')">$(OriginalProjectJson)</ProjectJson>
</PropertyGroup>
<PropertyGroup Condition="'$(TestProjectName)'==''">
<TestProjectName>$(MSBuildProjectName)</TestProjectName>
</PropertyGroup>
<!-- the project json and runner script files need to be included in the archive -->
<Copy SourceFiles="$(ProjectJson);$(ProjectLockJson)" DestinationFolder="$(TestPath)" />
<MakeDir Directories="$(TestArchiveDir)" />
<ZipFileCreateFromDirectory SourceDirectory="$(TestPath)" DestinationArchive="$(TestArchiveDir)$(TestProjectName).zip" OverwriteDestination="true" />
</Target>
</Project>