summaryrefslogtreecommitdiff
path: root/tests/publishdependency.targets
blob: 346b1749f86d97127b47b5da2435067dc639979a (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?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"/>
  <ItemGroup>
    <TestTargetFramework Include=".NETCoreApp,Version=v3.0">
      <Folder>netcoreapp3.0</Folder>
    </TestTargetFramework>
  </ItemGroup>

  <PropertyGroup>
    <!-- defined in buildtools packaging.targets, but we need this before targets are imported -->
    <PackagePlatform Condition="'$(PackagePlatform)' == ''">$(__BuildArch)</PackagePlatform>
    <PackagePlatform Condition="'$(PackagePlatform)' == 'amd64'">x64</PackagePlatform>
    <MinOSForArch>win7</MinOSForArch>
    <MinOSForArch Condition="'$(PackagePlatform)' == 'arm'">win8</MinOSForArch>
    <MinOSForArch Condition="'$(PackagePlatform)' == 'arm64'">win10</MinOSForArch>
  </PropertyGroup>

  <ItemGroup>
    <CoreRootProjectLockJsonFiles Include="$(SourceDir)Common\test_runtime\obj\project.assets.json"/>
    <CoreRootProjectLockJsonFiles Include="$(SourceDir)Common\test_dependencies\obj\project.assets.json"/>
  </ItemGroup>

  <ItemGroup>
    <RefProjectLockJsonFiles Include="$(SourceDir)Common\targeting_pack_ref\obj\project.assets.json"/>
  </ItemGroup>

  <ItemGroup>
    <ProductProjectLockJsonFiles Include="$(SourceDir)Common\build_against_pkg_dependencies\obj\project.assets.json"/>
  </ItemGroup>

  <ItemGroup>
    <CrossGenFiles Include="..\packages\runtime.$(TargetRid).Microsoft.NETCore.Runtime.CoreCLR\$(DesiredPackageVersionArg)\tools\crossgen*"/>
    <VCRuntimeFiles Include="..\packages\vc-runtime\$(VCRuntimeVersion)\lib\netcoreapp1.1\*.dll"/>
  </ItemGroup>

  <PropertyGroup>
    <ProductDestination>$(ProjectDir)\..\bin\Product\$(BuildOS).$(BuildArch).$(BuildType)</ProductDestination>
    <RefDestination>$(ProductDestination)\ref</RefDestination>
  </PropertyGroup>

  <Target Name="CopyDependecyToCoreRoot"
    Inputs="@(CoreRootProjectLockJsonFiles)"
    Outputs="$(CORE_ROOT)\*.*">

    <!-- This will use the overridden PrereleaseResolveNuGetPackageAssets, which outputs copy local items
         for the xunit wrapper projects -->
    <PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="false"
                                         IncludeFrameworkReferences="false"
                                         NuGetPackagesDirectory="$(PackagesDir)"
                                         RuntimeIdentifier="$(TargetRid)"
                                         ProjectLanguage="$(Language)"
                                         ProjectLockFile="%(CoreRootProjectLockJsonFiles.Identity)"
                                         TargetMonikers="@(TestTargetFramework)">
      <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
      <Output TaskParameter="ResolvedReferences" ItemName="Reference" />
      <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RunTimeCopyLocal" />
    </PrereleaseResolveNuGetPackageAssets>
    <ItemGroup>
      <RunTimeDependecyExclude Include="$(CORE_ROOT)\**\*.*"  />
      <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName)%(Extension)')" />
      <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName).ni%(Extension)')" />
      <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName).pdb')" />
      <AllResolvedRuntimeDependencies Include="@(RunTimeCopyLocal -> '%(FileName)%(Extension)')">
        <File>%(Identity)</File>
      </AllResolvedRuntimeDependencies>
      <RunTimeDependecyCopyLocalFile Include="@(AllResolvedRuntimeDependencies)"  Exclude="@(RunTimeDependecyExcludeFiles)"/>
      <RunTimeDependecyCopyLocal Include="@(RunTimeDependecyCopyLocalFile -> '%(File)')"  />
      <RunTimeDependecyCopyLocal Include="$(TargetingPackPath)/*" />
    </ItemGroup>
    
    <Copy
      SourceFiles="@(RunTimeDependecyCopyLocal)"
      DestinationFolder="$(CORE_ROOT)"
      SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
      OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
      UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
      <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
    </Copy>
  </Target>

  <Target Name="CopyDependencyToRef"
    Inputs="@(RefProjectLockJsonFiles)"
    Outputs="$(RefDestination)\*.*">

    <!-- This will use the overridden PrereleaseResolveNuGetPackageAssets, which outputs copy local items
         for the xunit wrapper projects -->
    <PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true"
                                         IncludeFrameworkReferences="false"
                                         NuGetPackagesDirectory="$(PackagesDir)"
                                         RuntimeIdentifier="$(TargetRid)"
                                         ProjectLanguage="$(Language)"
                                         ProjectLockFile="%(RefProjectLockJsonFiles.Identity)"
                                         TargetMonikers="@(TestTargetFramework)">
      <Output TaskParameter="ResolvedAnalyzers" ItemName="RefAnalyzer" />
      <Output TaskParameter="ResolvedReferences" ItemName="RefReference" />
      <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RefRunTimeCopyLocal" />
    </PrereleaseResolveNuGetPackageAssets>
    
    <Copy
      SourceFiles="@(RefRunTimeCopyLocal)"
      DestinationFolder="$(RefDestination)"
      SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
      OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
      UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
      <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
    </Copy>
  </Target>

  <Target Name="CopyDependencyToProduct"
    Inputs="@(ProductProjectLockJsonFiles)"
    Outputs="$(ProductDestination)\*.*">

    <!-- This will use the overridden PrereleaseResolveNuGetPackageAssets, which outputs copy local items
         for the xunit wrapper projects -->
    <PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true"
                                         IncludeFrameworkReferences="false"
                                         NuGetPackagesDirectory="$(PackagesDir)"
                                         RuntimeIdentifier="$(TargetRid)"
                                         ProjectLanguage="$(Language)"
                                         ProjectLockFile="%(ProductProjectLockJsonFiles.Identity)"
                                         TargetMonikers="@(TestTargetFramework)">
      <Output TaskParameter="ResolvedAnalyzers" ItemName="RefAnalyzer" />
      <Output TaskParameter="ResolvedReferences" ItemName="RefReference" />
      <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RefRunTimeCopyLocal" />
    </PrereleaseResolveNuGetPackageAssets>
    
    <Copy
      SourceFiles="@(RefRunTimeCopyLocal)"
      DestinationFolder="$(ProductDestination)"
      SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
      OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
      UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
      <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
    </Copy>
  </Target>

  <Target Name="CopyCrossgenToProduct"
    AfterTargets="CopyDependencyToProduct"
    Outputs="$(ProductDestination)\crossgen.exe;$(CORE_OVERLAY)\crossgen.exe">

    <Copy
      SourceFiles="@(CrossGenFiles)"
      DestinationFolder="$(ProductDestination)"
      SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
      OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
      UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
      <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
    </Copy>

  </Target>

  <Target Name="CopyVCRuntimeToCoreRoot"
    AfterTargets="CopyDependecyToCoreRoot"
    Outputs="$(CORE_ROOT)\*.*"
    Condition="'$(BuildArch)' == 'arm'">

    <Copy
      SourceFiles="@(VCRuntimeFiles)"
      DestinationFolder="$(CORE_ROOT)"
      SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
      OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
      UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
      <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
    </Copy>

  </Target>

</Project>