blob: 4e6c61802131e20221eac02e0c419b26bc6f5d7e (
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Default priority building values. -->
<PropertyGroup>
<CLRTestKind Condition="'$(CLRTestKind)' == '' and '$(OutputType)' == 'Library'">SharedLibrary</CLRTestKind>
<CLRTestKind Condition="'$(CLRTestKind)' == ''">BuildAndRun</CLRTestKind>
<CLRTestPriority Condition="'$(CLRTestPriority)' == ''">0</CLRTestPriority>
</PropertyGroup>
<!-- All CLRTests need to be of a certain "kind". These kinds are enumerated below.
By default all tests are BuildAndRun. This means that the build system will Build them
and construct a run-batch-script for them. -->
<Choose>
<When Condition=" '$(CLRTestKind)'=='SharedLibrary'">
<PropertyGroup>
<_CLRTestCompilesSource>true</_CLRTestCompilesSource>
<_CLRTestNeedsToRun>false</_CLRTestNeedsToRun>
<GenerateRunScript>false</GenerateRunScript>
<_CLRTestBuildsExecutable>false</_CLRTestBuildsExecutable>
</PropertyGroup>
</When>
<When Condition=" '$(CLRTestKind)'=='BuildAndRun' ">
<PropertyGroup>
<GenerateRunScript>true</GenerateRunScript>
<_CLRTestNeedsToRun>true</_CLRTestNeedsToRun>
<_CLRTestCompilesSource>true</_CLRTestCompilesSource>
<_CLRTestBuildsExecutable>true</_CLRTestBuildsExecutable>
</PropertyGroup>
</When>
<When Condition=" '$(CLRTestKind)'=='BuildOnly'">
<PropertyGroup>
<_CLRTestNeedsToRun>false</_CLRTestNeedsToRun>
<GenerateRunScript>false</GenerateRunScript>
<_CLRTestCompilesSource>true</_CLRTestCompilesSource>
<_CLRTestBuildsExecutable>true</_CLRTestBuildsExecutable>
</PropertyGroup>
</When>
<When Condition=" '$(CLRTestKind)'=='RunOnly' ">
<PropertyGroup>
<GenerateRunScript>true</GenerateRunScript>
<SkipSigning>true</SkipSigning>
<_CLRTestBuildsExecutable>false</_CLRTestBuildsExecutable>
<_CLRTestNeedsToRun>true</_CLRTestNeedsToRun>
<_CLRTestCompilesSource>false</_CLRTestCompilesSource>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup>
<_CLRTestNeedsProjectToRun>false</_CLRTestNeedsProjectToRun>
<_CLRTestNeedsProjectToRun Condition=" '$(_CLRTestNeedsToRun)' and '!$(_CLRTestBuildsExecutable)' ">true</_CLRTestNeedsProjectToRun>
</PropertyGroup>
<!--
If it needs ProjectToRun, turn the project into a ProjectReference so it gets built
-->
<ItemGroup Condition=" $(_CLRTestNeedsProjectToRun) ">
<ProjectReference Include="$(CLRTestProjectToRun)">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<ErrorIfBuildToolsRestoredFromIndividualProject Condition="!Exists('$(ToolsDir)')">true</ErrorIfBuildToolsRestoredFromIndividualProject>
</PropertyGroup>
<Import Project="..\dir.targets" />
<Target Name="CreateManifestResourceNames" />
<Target Name="CoreCompile" />
<!-- If we are a run-only, that depends on another project, this is the "Build" we use. I.e. build all dependency projects, absolutely.
-->
<PropertyGroup>
<BuildAllProjects Condition=" '$(BuildAllProjects)' == ''">false</BuildAllProjects>
<_WillCLRTestProjectBuild Condition="'$(_WillCLRTestProjectBuild)' == ''">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != true">true</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' != true And '$(BuildAllProjects)' == true And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
</PropertyGroup>
<Target Name="Build" Condition="('$(CLRTestKind)'=='RunOnly') And '$(_WillCLRTestProjectBuild)'">
<MSBuild Projects="@(ProjectReference)" />
<MakeDir Condition="'$(CLRTestKind)' == 'RunOnly'" ContinueOnError="false" Directories="$(OutputPath)" />
</Target>
<!-- We will use an imported build here in the instance that we have source that we need to build, and we are the correct priority...OR if we are being asked to build for
a test with a higher priority. -->
<Import Project="$(ToolsDir)Build.Common.targets" Condition="('$(CLRTestKind)'!='RunOnly') And $(_CLRTestCompilesSource) And ('$(_WillCLRTestProjectBuild)')"/>
<Import Project="..\override.targets" Condition="Exists('..\override.targets')"/>
<!-- We enable auto-unification of assembly references after importing the common targets. Binding redirects are not needed
for coreclr since it auto-unifies, so the warnings we get without this setting are just noise -->
<PropertyGroup>
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
</PropertyGroup>
<!-- Project language -->
<!-- TODO: This might just be the Language property -->
<PropertyGroup Condition="'$(ProjectLanguage)' == ''">
<ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.ilproj' OR '$(Language)' == 'IL'">IL</ProjectLanguage>
<ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.csproj' OR '$(Language)' == 'C#' OR '$(ProjectLanguage)'==''">CSharp</ProjectLanguage>
</PropertyGroup>
<!-- TODO (#1122): import this from the ToolsDir once it becomes available -->
<Import Project="$(ProjectDir)src\IL.targets" Condition="'$(ProjectLanguage)' == 'IL' And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'" />
<Import Project="CLRTest.Execute.targets" />
<Target Name="CreateExecuteScript"
AfterTargets="Build"
Condition="'$(GenerateRunScript)' != 'false' And ('$(_WillCLRTestProjectBuild)')"
DependsOnTargets="GenerateExecutionScriptsInternal" />
<Target Name="CopyNativeProjectBinaries">
<ItemGroup>
<NativeProjectBinaries Include="$(NativeProjectOutputFolder)\**\*.*" />
</ItemGroup>
<Error Text="The native project files are missing in $(NativeProjectOutputFolder) please run build from the root of the repo at least once"
Condition="'@(NativeProjectBinaries)' == ''" />
<Copy
SourceFiles="@(NativeProjectBinaries)"
DestinationFiles="@(NativeProjectBinaries -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<Target Name="ResolveCmakeNativeProjectReference"
Condition="'@(ProjectReference)' != ''"
BeforeTargets="BeforeResolveReferences;BeforeClean" >
<ItemGroup>
<NativeProjectReference Include="%(ProjectReference.Identity)" Condition="$([System.String]::Copy(%(ProjectReference.FileName)).ToUpper()) == 'CMAKELISTS'" />
<ProjectReference Remove="%(NativeProjectReference.Identity)" />
<NativeProjectReferenceNormalized Include="@(NativeProjectReference -> '%(FullPath)')" />
</ItemGroup>
</Target>
<Target Name="ConsolidateNativeProjectReference"
Condition="'@(NativeProjectReferenceNormalized)' != ''"
BeforeTargets="Build" >
<ItemGroup>
<NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(SourceDir),$(__NativeTestIntermediatesDir)\src\))$(Configuration)\"/>
</ItemGroup>
<Message Text= "Full native project references are :%(NativeProjectReferenceNormalized.Identity)" />
<Message Text= "Native binaries will be copied from :%(NativeProjectOutputFoldersToCopy.Identity)" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="CopyNativeProjectBinaries" Properties="NativeProjectOutputFolder=%(NativeProjectOutputFoldersToCopy.Identity)" Condition="'@(NativeProjectReference)' != ''" />
</Target>
<PropertyGroup>
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);ResetReferenceCopyLocalPaths</PrepareForRunDependsOn>
</PropertyGroup>
<Target Name="ResetReferenceCopyLocalPaths"
Condition="'@(ReferenceCopyLocalPaths)' != ''"
BeforeTargets="_CopyFilesMarkedCopyLocal">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.CopyLocal)' != 'true'"/>
</ItemGroup>
</Target>
<Target Name="UpdateReferenceItems"
BeforeTargets="BeforeResolveReferences"
>
<ItemGroup>
<Reference Include="$(TargetingPackPath)/*.dll" >
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>
<Target Name="AfterBuild">
<Copy SourceFiles="$(AssemblyName).reflect.xml"
DestinationFolder="$(OutputPath)"
Condition="Exists('$(AssemblyName).reflect.xml')"/>
</Target>
<PropertyGroup>
<ProjectAssetsFile>$(SourceDir)Common\test_dependencies\obj\project.assets.json</ProjectAssetsFile>
</PropertyGroup>
<PropertyGroup Condition="'$(ReferenceSystemPrivateCoreLib)' == 'true'">
<ProjectAssetsFile></ProjectAssetsFile >
</PropertyGroup>
</Project>
|