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 If it needs ProjectToRun, turn the project into a ProjectReference so it gets built
56 <ItemGroup Condition=" $(_CLRTestNeedsProjectToRun) ">
57 <ProjectReference Include="$(CLRTestProjectToRun)">
58 <Private>false</Private>
63 <ErrorIfBuildToolsRestoredFromIndividualProject Condition="!Exists('$(ToolsDir)')">true</ErrorIfBuildToolsRestoredFromIndividualProject>
66 <Import Project="..\dir.targets" />
68 <Target Name="CreateManifestResourceNames" />
69 <Target Name="CoreCompile" />
71 <!-- If we are a run-only, that depends on another project, this is the "Build" we use. I.e. build all dependency projects, absolutely.
75 <BuildAllProjects Condition=" '$(BuildAllProjects)' == ''">false</BuildAllProjects>
76 <_WillCLRTestProjectBuild Condition="'$(_WillCLRTestProjectBuild)' == ''">false</_WillCLRTestProjectBuild>
77 <_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != true">true</_WillCLRTestProjectBuild>
78 <_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' != true And '$(BuildAllProjects)' == true And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
81 <Target Name="Build" Condition="('$(CLRTestKind)'=='RunOnly') And '$(_WillCLRTestProjectBuild)'">
82 <MSBuild Projects="@(ProjectReference)" />
83 <MakeDir Condition="'$(CLRTestKind)' == 'RunOnly'" ContinueOnError="false" Directories="$(OutputPath)" />
86 <!-- 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
87 a test with a higher priority. -->
88 <Import Project="$(ToolsDir)Build.Common.targets" Condition="('$(CLRTestKind)'!='RunOnly') And $(_CLRTestCompilesSource) And ('$(_WillCLRTestProjectBuild)')"/>
91 <Import Project="..\override.targets" Condition="Exists('..\override.targets')"/>
93 <!-- We enable auto-unification of assembly references after importing the common targets. Binding redirects are not needed
94 for coreclr since it auto-unifies, so the warnings we get without this setting are just noise -->
96 <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
99 <!-- Project language -->
100 <!-- TODO: This might just be the Language property -->
101 <PropertyGroup Condition="'$(ProjectLanguage)' == ''">
102 <ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.ilproj' OR '$(Language)' == 'IL'">IL</ProjectLanguage>
103 <ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.csproj' OR '$(Language)' == 'C#' OR '$(ProjectLanguage)'==''">CSharp</ProjectLanguage>
106 <!-- TODO (#1122): import this from the ToolsDir once it becomes available -->
107 <Import Project="$(ProjectDir)src\IL.targets" Condition="'$(ProjectLanguage)' == 'IL' And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'" />
110 <Import Project="CLRTest.Execute.targets" />
111 <Target Name="CreateExecuteScript"
113 Condition="'$(GenerateRunScript)' != 'false' And ('$(_WillCLRTestProjectBuild)')"
114 DependsOnTargets="GenerateExecutionScriptsInternal" />
116 <Target Name="CopyNativeProjectBinaries">
118 <NativeProjectBinaries Include="$(NativeProjectOutputFolder)\**\*.*" />
121 <Error Text="The native project files are missing in $(NativeProjectOutputFolder) please run build from the root of the repo at least once"
122 Condition="'@(NativeProjectBinaries)' == ''" />
125 SourceFiles="@(NativeProjectBinaries)"
126 DestinationFiles="@(NativeProjectBinaries -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')"
127 SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
128 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
129 Retries="$(CopyRetryCount)"
130 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
131 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
132 <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
136 <Target Name="ResolveCmakeNativeProjectReference"
137 Condition="'@(ProjectReference)' != ''"
138 BeforeTargets="BeforeResolveReferences;BeforeClean" >
140 <NativeProjectReference Include="%(ProjectReference.Identity)" Condition="$([System.String]::Copy(%(ProjectReference.FileName)).ToUpper()) == 'CMAKELISTS'" />
141 <ProjectReference Remove="%(NativeProjectReference.Identity)" />
142 <NativeProjectReferenceNormalized Include="@(NativeProjectReference -> '%(FullPath)')" />
146 <Target Name="ConsolidateNativeProjectReference"
147 Condition="'@(NativeProjectReferenceNormalized)' != ''"
148 BeforeTargets="Build" >
150 <NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(SourceDir),$(__NativeTestIntermediatesDir)\src\))$(Configuration)\"/>
153 <Message Text= "Full native project references are :%(NativeProjectReferenceNormalized.Identity)" />
154 <Message Text= "Native binaries will be copied from :%(NativeProjectOutputFoldersToCopy.Identity)" />
155 <MSBuild Projects="$(MSBuildProjectFile)" Targets="CopyNativeProjectBinaries" Properties="NativeProjectOutputFolder=%(NativeProjectOutputFoldersToCopy.Identity)" Condition="'@(NativeProjectReference)' != ''" />
160 <PrepareForRunDependsOn>$(PrepareForRunDependsOn);ResetReferenceCopyLocalPaths</PrepareForRunDependsOn>
163 <Target Name="ResetReferenceCopyLocalPaths"
164 Condition="'@(ReferenceCopyLocalPaths)' != ''"
165 BeforeTargets="_CopyFilesMarkedCopyLocal">
167 <ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.CopyLocal)' != 'true'"/>
171 <Target Name="UpdateReferenceItems"
172 BeforeTargets="BeforeResolveReferences"
175 <Reference Include="$(TargetingPackPath)/*.dll" >
176 <Private>false</Private>
182 <Target Name="AfterBuild">
183 <Copy SourceFiles="$(AssemblyName).reflect.xml"
184 DestinationFolder="$(OutputPath)"
185 Condition="Exists('$(AssemblyName).reflect.xml')"/>
189 <ProjectAssetsFile>$(SourceDir)Common\test_dependencies\obj\project.assets.json</ProjectAssetsFile>
192 <PropertyGroup Condition="'$(ReferenceSystemPrivateCoreLib)' == 'true'">
193 <ProjectAssetsFile></ProjectAssetsFile >