Welcome to mirror list, hosted at ThFree Co, Russian Federation.

publishtest.targets « Tools-Override - github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a81390288b0960e0c970ee00ecfce5e7ce42991d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?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>
      <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>