blob: 64f0d804f85d6b6ef77188cc10ec15c1c84f1c91 (
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
197
198
199
200
201
|
<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>
<PropertyGroup Condition="'$(UsingMicrosoftNETSdk)' == 'true'">
<!-- Many parts of the tests expect the output file to be an exe. We override the extension to match here, but in future we should probably update the infrastructure to look for dlls -->
<TargetExt Condition="'$(OutputType)' == 'Exe' and '$(TargetExt)' == '.dll'">.exe</TargetExt>
</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>
<PropertyGroup>
<!-- Since bug in Roslyn for Linux empty DebugType property leads to build failure. See issue Roslyn@20343 -->
<DebugType Condition=" '$(DebugType)' == '' and '$(RunningOnUnix)' == 'true' ">None</DebugType>
</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" />
<!-- Determine if this project should be built or not -->
<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>
<!-- if we have determined that there is nothing to build, overwrite the build targets so that nothing happens -->
<Import Project="nobuild.targets" Condition="'$(_WillCLRTestProjectBuild)' == 'false'" />
<!-- RunOnly projects have a special build for dependent projects -->
<Import Project="runonly.targets" Condition="'$(CLRTestKind)' == 'RunOnly'" />
<!-- We will use an imported build here in the instance that we're a non-sdk style project, 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="('$(UsingMicrosoftNETSdk)' != 'true') And ('$(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>
<SkipImportILTargets Condition="'$(CLRTestPriority)' > '$(CLRTestPriorityToBuild)'">true</SkipImportILTargets>
</PropertyGroup>
<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\))" Condition="'$(RunningOnUnix)' == 'true'" />
<NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(SourceDir),$(__NativeTestIntermediatesDir)\src\))$(Configuration)\" Condition="'$(RunningOnUnix)' != 'true'" />
</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)' != '' And '$(RunningOnUnix)' != 'true'" />
</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' and '$(UsingMicrosoftNETSdk)' != 'true'">
<ProjectAssetsFile></ProjectAssetsFile>
</PropertyGroup>
</Project>
|