summaryrefslogtreecommitdiff
path: root/tests/publishdependency.targets
blob: 6d1c6bdc788ff2480c4ae2c6e5260b9814efcc8d (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
<?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=v2.0">
      <Folder>netcoreapp2.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\project.lock.json"/>
    <CoreRootProjectLockJsonFiles Include="$(SourceDir)Common\test_dependencies\project.lock.json"/>
  </ItemGroup>

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

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

  <ItemGroup>
    <CrossGenFiles Include="..\packages\runtime.$(TargetRid).Microsoft.NETCore.Runtime.CoreCLR\$(CoreClrPackageVersion)\tools\crossgen*"/>
  </ItemGroup>

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

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

    <MSBuild Projects="$(SourceDir)Common\test_runtime\test_runtime.csproj"/>

    <MSBuild Projects="$(SourceDir)Common\test_dependencies\test_dependencies.csproj"/>

    <!-- 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)\*.*">

    <MSBuild Projects="$(SourceDir)Common\targeting_pack_ref\targeting_pack_ref.csproj"/>

    <!-- 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)\*.*">

    <MSBuild Projects="$(SourceDir)Common\build_against_pkg_dependencies\build_against_pkg_dependencies.csproj"/>

    <!-- 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>

</Project>