|
18 | 18 | <CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != 'true'">true</CopyCoreDisToolsToCoreRoot>
|
19 | 19 | <!-- Non-desktop OS's use a custom dotnet host, instead of corerun -->
|
20 | 20 | <IsDesktopOS Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsAndroid)' != 'true' and '$(TargetstvOS)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetsMacCatalyst)' != 'true'">true</IsDesktopOS>
|
| 21 | + <UsePublishedCrossgen2 Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'">true</UsePublishedCrossgen2> |
21 | 22 | </PropertyGroup>
|
22 | 23 |
|
23 | 24 | <Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
|
|
34 | 35 | </ItemDefinitionGroup>
|
35 | 36 |
|
36 | 37 | <Target Name="CopyDependencyToCoreRoot"
|
37 |
| - DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild"> |
| 38 | + DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild"> |
| 39 | + |
| 40 | + <!-- Copy apphost to crossgen2_publish directory. |
| 41 | + The default configuration between product and tests are flipped. When we build project like: |
| 42 | + `build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`, |
| 43 | + instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the |
| 44 | + `HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow. |
| 45 | + |
| 46 | + As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check |
| 47 | + `LibrariesConfiguration`. |
| 48 | + --> |
| 49 | + |
| 50 | + <PropertyGroup Condition="'$(UsePublishedCrossgen2)' == 'true'"> |
| 51 | + <_targetOS>$(TargetOS)</_targetOS> |
| 52 | + <_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS> |
| 53 | + <_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath> |
| 54 | + <_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath> |
| 55 | + <_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration> |
| 56 | + <_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration> |
| 57 | + </PropertyGroup> |
| 58 | + |
| 59 | + <MakeDir Condition="'$(UsePublishedCrossgen2)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" /> |
| 60 | + |
| 61 | + <Copy |
| 62 | + SourceFiles="$(_apphostPath)" |
| 63 | + DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)" |
| 64 | + Condition="'$(UsePublishedCrossgen2)' == 'true'" /> |
| 65 | + |
| 66 | + <!-- Publish crossgen2 on supported platforms. --> |
| 67 | + |
| 68 | + <MSBuild Condition="'$(UsePublishedCrossgen2)' == 'true'" |
| 69 | + Targets="Restore" |
| 70 | + BuildInParallel="true" |
| 71 | + Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" |
| 72 | + Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" /> |
| 73 | + |
| 74 | + <MSBuild Condition="'$(UsePublishedCrossgen2)' == 'true'" |
| 75 | + Targets="PublishToDisk" |
| 76 | + BuildInParallel="true" |
| 77 | + Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;LibrariesConfiguration=$(LibrariesConfiguration)" |
| 78 | + Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" /> |
38 | 79 |
|
39 | 80 | <ItemGroup>
|
40 | 81 | <RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
|
|
81 | 122 | <RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />
|
82 | 123 |
|
83 | 124 | <!-- Used for Crossgen2 R2R tests -->
|
84 |
| - <RunTimeArtifactsIncludeFolders Include="crossgen2/" TargetDir="crossgen2/"> |
| 125 | + <RunTimeArtifactsIncludeFolders Include="crossgen2/" TargetDir="crossgen2/" Condition="'$(UsePublishedCrossgen2)' != 'true'"> |
85 | 126 | <IncludeSubFolders>True</IncludeSubFolders>
|
86 | 127 | </RunTimeArtifactsIncludeFolders>
|
87 | 128 |
|
|
135 | 176 |
|
136 | 177 | <RunTimeDependencyCopyLocal
|
137 | 178 | Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
|
138 |
| - Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*" |
| 179 | + Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*" |
139 | 180 | Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
|
140 | 181 | TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
|
141 | 182 | </ItemGroup>
|
|
223 | 264 |
|
224 | 265 | <Copy
|
225 | 266 | SourceFiles="@(RunTimeDependencyCopyLocal)"
|
226 |
| - DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')" |
| 267 | + DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')" |
227 | 268 | SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
|
228 | 269 | OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
|
229 | 270 | Retries="$(CopyRetryCount)"
|
|
0 commit comments