1 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <!-- Default priority building values. -->
4 <CLRTestKind Condition="'$(CLRTestKind)' == '' and '$(OutputType)' == 'Library'">SharedLibrary</CLRTestKind>
5 <CLRTestKind Condition="'$(CLRTestKind)' == ''">BuildAndRun</CLRTestKind>
6 <CLRTestPriority Condition="'$(CLRTestPriority)' == ''">0</CLRTestPriority>
9 <!-- All CLRTests need to be of a certain "kind". These kinds are enumerated below.
10 By default all tests are BuildAndRun. This means that the build system will Build them
11 and construct a run-batch-script for them. -->
13 <When Condition=" '$(CLRTestKind)'=='SharedLibrary'">
15 <_CLRTestCompilesSource>true</_CLRTestCompilesSource>
16 <_CLRTestNeedsToRun>false</_CLRTestNeedsToRun>
17 <GenerateRunScript>false</GenerateRunScript>
18 <_CLRTestBuildsExecutable>false</_CLRTestBuildsExecutable>
21 <When Condition=" '$(CLRTestKind)'=='BuildAndRun' ">
23 <GenerateRunScript>true</GenerateRunScript>
24 <_CLRTestNeedsToRun>true</_CLRTestNeedsToRun>
25 <_CLRTestCompilesSource>true</_CLRTestCompilesSource>
26 <_CLRTestBuildsExecutable>true</_CLRTestBuildsExecutable>
29 <When Condition=" '$(CLRTestKind)'=='BuildOnly'">
31 <_CLRTestNeedsToRun>false</_CLRTestNeedsToRun>
32 <GenerateRunScript>false</GenerateRunScript>
33 <_CLRTestCompilesSource>true</_CLRTestCompilesSource>
34 <_CLRTestBuildsExecutable>true</_CLRTestBuildsExecutable>
37 <When Condition=" '$(CLRTestKind)'=='RunOnly' ">
39 <GenerateRunScript>true</GenerateRunScript>
40 <SkipSigning>true</SkipSigning>
41 <_CLRTestBuildsExecutable>false</_CLRTestBuildsExecutable>
42 <_CLRTestNeedsToRun>true</_CLRTestNeedsToRun>
43 <_CLRTestCompilesSource>false</_CLRTestCompilesSource>
49 <_CLRTestNeedsProjectToRun>false</_CLRTestNeedsProjectToRun>
50 <_CLRTestNeedsProjectToRun Condition=" '$(_CLRTestNeedsToRun)' and '!$(_CLRTestBuildsExecutable)' ">true</_CLRTestNeedsProjectToRun>
54 <!-- Since bug in Roslyn for Linux empty DebugType property leads to build failure. See issue Roslyn@20343 -->
55 <DebugType Condition=" '$(DebugType)' == '' and '$(RunningOnUnix)' == 'true' ">None</DebugType>
59 If it needs ProjectToRun, turn the project into a ProjectReference so it gets built
61 <ItemGroup Condition=" $(_CLRTestNeedsProjectToRun) ">
62 <ProjectReference Include="$(CLRTestProjectToRun)">
63 <Private>false</Private>
68 <ErrorIfBuildToolsRestoredFromIndividualProject Condition="!Exists('$(ToolsDir)')">true</ErrorIfBuildToolsRestoredFromIndividualProject>
71 <Import Project="..\dir.targets" />
73 <Target Name="CreateManifestResourceNames" />
74 <Target Name="CoreCompile" />
76 <!-- If we are a run-only, that depends on another project, this is the "Build" we use. I.e. build all dependency projects, absolutely.
80 <BuildAllProjects Condition=" '$(BuildAllProjects)' == ''">false</BuildAllProjects>
81 <_WillCLRTestProjectBuild Condition="'$(_WillCLRTestProjectBuild)' == ''">false</_WillCLRTestProjectBuild>
82 <_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != true">true</_WillCLRTestProjectBuild>
83 <_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' != true And '$(BuildAllProjects)' == true And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
86 <Target Name="Build" Condition="('$(CLRTestKind)'=='RunOnly') And '$(_WillCLRTestProjectBuild)'">
87 <MSBuild Projects="@(ProjectReference)" />
88 <MakeDir Condition="'$(CLRTestKind)' == 'RunOnly'" ContinueOnError="false" Directories="$(OutputPath)" />
91 <!-- 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
92 a test with a higher priority. -->
93 <Import Project="$(ToolsDir)Build.Common.targets" Condition="('$(CLRTestKind)'!='RunOnly') And $(_CLRTestCompilesSource) And ('$(_WillCLRTestProjectBuild)')"/>
96 <Import Project="..\override.targets" Condition="Exists('..\override.targets')"/>
98 <!-- We enable auto-unification of assembly references after importing the common targets. Binding redirects are not needed
99 for coreclr since it auto-unifies, so the warnings we get without this setting are just noise -->
101 <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
104 <!-- Project language -->
105 <!-- TODO: This might just be the Language property -->
106 <PropertyGroup Condition="'$(ProjectLanguage)' == ''">
107 <ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.ilproj' OR '$(Language)' == 'IL'">IL</ProjectLanguage>
108 <ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.csproj' OR '$(Language)' == 'C#' OR '$(ProjectLanguage)'==''">CSharp</ProjectLanguage>
110 <SkipImportILTargets Condition="'$(CLRTestPriority)' > '$(CLRTestPriorityToBuild)'">true</SkipImportILTargets>
113 <Import Project="CLRTest.Execute.targets" />
114 <Target Name="CreateExecuteScript"
116 Condition="'$(GenerateRunScript)' != 'false' And ('$(_WillCLRTestProjectBuild)')"
117 DependsOnTargets="GenerateExecutionScriptsInternal" />
119 <Target Name="CopyNativeProjectBinaries">
121 <NativeProjectBinaries Include="$(NativeProjectOutputFolder)\**\*.*" />
124 <Error Text="The native project files are missing in $(NativeProjectOutputFolder) please run build from the root of the repo at least once"
125 Condition="'@(NativeProjectBinaries)' == ''" />
128 SourceFiles="@(NativeProjectBinaries)"
129 DestinationFiles="@(NativeProjectBinaries -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')"
130 SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
131 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
132 Retries="$(CopyRetryCount)"
133 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
134 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
135 <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
139 <Target Name="ResolveCmakeNativeProjectReference"
140 Condition="'@(ProjectReference)' != ''"
141 BeforeTargets="BeforeResolveReferences;BeforeClean" >
143 <NativeProjectReference Include="%(ProjectReference.Identity)" Condition="$([System.String]::Copy(%(ProjectReference.FileName)).ToUpper()) == 'CMAKELISTS'" />
144 <ProjectReference Remove="%(NativeProjectReference.Identity)" />
145 <NativeProjectReferenceNormalized Include="@(NativeProjectReference -> '%(FullPath)')" />
149 <Target Name="ConsolidateNativeProjectReference"
150 Condition="'@(NativeProjectReferenceNormalized)' != ''"
151 BeforeTargets="Build" >
153 <NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(SourceDir),$(__NativeTestIntermediatesDir)\src\))" Condition="'$(RunningOnUnix)' == 'true'" />
154 <NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(SourceDir),$(__NativeTestIntermediatesDir)\src\))$(Configuration)\" Condition="'$(RunningOnUnix)' != 'true'" />
157 <Message Text= "Full native project references are :%(NativeProjectReferenceNormalized.Identity)" />
158 <Message Text= "Native binaries will be copied from :%(NativeProjectOutputFoldersToCopy.Identity)" />
159 <MSBuild Projects="$(MSBuildProjectFile)" Targets="CopyNativeProjectBinaries" Properties="NativeProjectOutputFolder=%(NativeProjectOutputFoldersToCopy.Identity)" Condition="'@(NativeProjectReference)' != '' And '$(RunningOnUnix)' != 'true'" />
164 <PrepareForRunDependsOn>$(PrepareForRunDependsOn);ResetReferenceCopyLocalPaths</PrepareForRunDependsOn>
167 <Target Name="ResetReferenceCopyLocalPaths"
168 Condition="'@(ReferenceCopyLocalPaths)' != ''"
169 BeforeTargets="_CopyFilesMarkedCopyLocal">
171 <ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.CopyLocal)' != 'true'"/>
175 <Target Name="UpdateReferenceItems"
176 BeforeTargets="BeforeResolveReferences"
179 <Reference Include="$(TargetingPackPath)/*.dll" >
180 <Private>false</Private>
186 <Target Name="AfterBuild">
187 <Copy SourceFiles="$(AssemblyName).reflect.xml"
188 DestinationFolder="$(OutputPath)"
189 Condition="Exists('$(AssemblyName).reflect.xml')"/>
193 <ProjectAssetsFile>$(SourceDir)Common\test_dependencies\obj\project.assets.json</ProjectAssetsFile>
196 <PropertyGroup Condition="'$(ReferenceSystemPrivateCoreLib)' == 'true'">
197 <ProjectAssetsFile></ProjectAssetsFile >