Skip to content

Commit 79c6554

Browse files
committed
Skip checked builds from AOT
1 parent a213249 commit 79c6554

File tree

5 files changed

+57
-53
lines changed

5 files changed

+57
-53
lines changed

src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
</Target>
6666

6767
<Target Name="RunPublishedCrossgen" AfterTargets="PublishCrossgen"
68-
Condition="'$(TargetOS)' == '$(HostOS)' and '$(TargetArchitecture)' == '$(BuildArchitecture)'">
68+
Condition="'$(TargetOS)' == '$(HostOS)' and '$(TargetArchitecture)' == '$(BuildArchitecture)' and '$(SkipRunPublishedCrossgen)' != 'true'">
6969
<!-- Run the published crossgen if we're not cross-compiling -->
7070
<Exec Command="@(FilesToPackage) $(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll --out $(IntermediateOutputPath)S.P.C.tmp" Condition="'%(FileName)%(Extension)' == 'crossgen2$(ExeSuffix)'">
7171
<Output TaskParameter="ExitCode" PropertyName="CrossgenExitCode" />

src/tests/Common/Directory.Build.targets

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildFromSource)' != 'true'">true</CopyCoreDisToolsToCoreRoot>
1919
<!-- Non-desktop OS's use a custom dotnet host, instead of corerun -->
2020
<IsDesktopOS Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsAndroid)' != 'true' and '$(TargetstvOS)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetsMacCatalyst)' != 'true'">true</IsDesktopOS>
21+
<Crossgen2Supported Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'">true</Crossgen2Supported>
22+
<UsePublishedCrossgen2 Condition="'$(Crossgen2Supported)' == 'true' and '$(Configuration)' != 'checked'">true</UsePublishedCrossgen2>
2123
</PropertyGroup>
2224

2325
<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
@@ -30,6 +32,24 @@
3032
<Target Name="CopyDependencyToCoreRoot"
3133
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">
3234

35+
<!--
36+
Publish crossgen2 on supported platforms.
37+
Publish to a temp directory to avoid msbuild glob computation problems.
38+
-->
39+
<MakeDir Directories="$(CORE_ROOT)" />
40+
41+
<MSBuild Condition="'$(Crossgen2Supported)' == 'true' and '$(UsePublishedCrossgen2)' != 'true'"
42+
Targets="Restore;Publish"
43+
BuildInParallel="true"
44+
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2;PublishSelfContained=true;NativeAotSupported=false;PublishSingleFile=false;PublishReadyToRun=false;SkipRunPublishedCrossgen=true"
45+
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
46+
47+
<MSBuild Condition="'$(UsePublishedCrossgen2)' == 'true'"
48+
Targets="Restore;Publish"
49+
BuildInParallel="true"
50+
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2"
51+
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
52+
3353
<ItemGroup>
3454
<RunTimeDependencyExclude Include="$(CORE_ROOT)\**\*.*" />
3555
<RunTimeDependencyExcludeFiles Include="@(RunTimeDependencyExclude -> '%(FileName)%(Extension)')" />
@@ -92,11 +112,6 @@
92112
</ItemGroup>
93113

94114
<ItemGroup>
95-
<Crossgen2DependencyCopyLocal
96-
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
97-
Include="$(CoreCLRArtifactsPath)crossgen2\$(OutputRid)\publish\**\*"
98-
TargetDir="%(RunTimeArtifactsIncludeFolders.Identity)" />
99-
100115
<!-- Add binary dependencies to copy-local items -->
101116
<RunTimeDependencyCopyLocal
102117
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' != 'True'"
@@ -122,7 +137,7 @@
122137
$(Crossgen2Dir)/clrjit_*;
123138
$(Crossgen2Dir)/jitinterface_*;
124139
$(Crossgen2Dir)/Microsoft.DiaSymReader.Native.*.dll"
125-
TargetDir="crossgen2/" />
140+
TargetDir="../crossgen2/" />
126141
</ItemGroup>
127142

128143
<ItemGroup Condition="'$(TargetArchitecture)' == 'wasm'">
@@ -185,23 +200,7 @@
185200

186201
<Copy
187202
SourceFiles="@(RunTimeDependencyCopyLocal)"
188-
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
189-
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
190-
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
191-
Retries="$(CopyRetryCount)"
192-
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
193-
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
194-
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
195-
</Copy>
196-
197-
<MSBuild Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
198-
Targets="Restore;Publish"
199-
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
200-
201-
<Copy
202-
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
203-
SourceFiles="@(Crossgen2DependencyCopyLocal)"
204-
DestinationFiles="@(Crossgen2DependencyCopyLocal -> '$(CORE_ROOT)\crossgen2\%(RecursiveDir)%(Filename)%(Extension)')"
203+
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
205204
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
206205
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
207206
Retries="$(CopyRetryCount)"

src/tests/Directory.Build.targets

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<CLRTestPriority Condition="'$(CLRTestPriority)' == ''">0</CLRTestPriority>
1919
<!-- Merged test runner assemblies might not have any non-generated sources, and that's okay -->
2020
<NoWarn Condition="'$(IsMergedTestRunnerAssembly)' == 'true'">$(NoWarn);CS2008</NoWarn>
21+
<Crossgen2Supported Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'">true</Crossgen2Supported>
22+
<UsePublishedCrossgen2 Condition="'$(Crossgen2Supported)' == 'true' and '$(Configuration)' != 'checked'">true</UsePublishedCrossgen2>
2123
</PropertyGroup>
2224

2325
<!-- All CLRTests need to be of a certain "kind". These kinds are enumerated below.
@@ -446,6 +448,24 @@
446448
<Target Name="CopyDependencyToCoreRoot"
447449
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">
448450

451+
<!--
452+
Publish crossgen2 on supported platforms.
453+
Publish to a temp directory to avoid msbuild glob computation problems.
454+
-->
455+
<MakeDir Directories="$(CORE_ROOT)" />
456+
457+
<MSBuild Condition="'$(Crossgen2Supported)' == 'true' and '$(UsePublishedCrossgen2)' != 'true'"
458+
Targets="Restore;PublishCrossgen"
459+
BuildInParallel="true"
460+
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2;PublishSelfContained=true;NativeAotSupported=false;PublishSingleFile=false;PublishReadyToRun=false;SkipRunPublishedCrossgen=true"
461+
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
462+
463+
<MSBuild Condition="'$(UsePublishedCrossgen2)' == 'true'"
464+
Targets="Restore;Publish"
465+
BuildInParallel="true"
466+
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2"
467+
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
468+
449469
<ItemGroup>
450470
<RunTimeDependencyExclude Include="$(CORE_ROOT)\**\*.*" />
451471
<RunTimeDependencyExcludeFiles Include="@(RunTimeDependencyExclude -> '%(FileName)%(Extension)')" />
@@ -487,11 +507,6 @@
487507
<!-- Used by the Crossgen comparison job -->
488508
<RunTimeArtifactsIncludeFolders Include="IL/" />
489509

490-
<!-- Used for Crossgen2 R2R tests -->
491-
<RunTimeArtifactsIncludeFolders Include="crossgen2/">
492-
<IncludeSubFolders>True</IncludeSubFolders>
493-
</RunTimeArtifactsIncludeFolders>
494-
495510
<!-- Used for capturing symbolic stack traces using Watson -->
496511
<RunTimeArtifactsIncludeFolders Include="PDB/" />
497512

@@ -510,11 +525,6 @@
510525
</ItemGroup>
511526

512527
<ItemGroup>
513-
<Crossgen2DependencyCopyLocal
514-
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
515-
Include="$(CoreCLRArtifactsPath)crossgen2\$(OutputRid)\publish\**\*"
516-
TargetDir="%(RunTimeArtifactsIncludeFolders.Identity)" />
517-
518528
<!-- Add binary dependencies to copy-local items -->
519529
<RunTimeDependencyCopyLocal
520530
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' != 'True'"
@@ -527,8 +537,6 @@
527537
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
528538
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
529539
TargetDir="%(RunTimeArtifactsIncludeFolders.Identity)" />
530-
531-
532540
</ItemGroup>
533541

534542
<ItemGroup Condition="'$(TargetArchitecture)' == 'wasm'">
@@ -586,22 +594,6 @@
586594
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
587595
</Copy>
588596

589-
<MSBuild Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
590-
Targets="Restore;Publish"
591-
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
592-
593-
<Copy
594-
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
595-
SourceFiles="@(Crossgen2DependencyCopyLocal)"
596-
DestinationFiles="@(Crossgen2DependencyCopyLocal -> '$(CORE_ROOT)\crossgen2\%(RecursiveDir)%(Filename)%(Extension)')"
597-
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
598-
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
599-
Retries="$(CopyRetryCount)"
600-
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
601-
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
602-
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
603-
</Copy>
604-
605597
</Target>
606598

607599
<Target Name="GetProjectsWithDisabledBuild" Returns="@(ProjectWithDisabledBuild)">

src/tests/build.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ set "__BinDir=%__RootBinDir%\bin\coreclr\%__OSPlatformConfig%"
140140
set "__TestRootDir=%__RootBinDir%\tests\coreclr"
141141
set "__TestBinDir=%__TestRootDir%\%__OSPlatformConfig%"
142142
set "__TestIntermediatesDir=%__TestRootDir%\obj\%__OSPlatformConfig%"
143+
set "CORE_ROOT=%__TestBinDir%\Tests\Core_Root"
143144

144145
if "%__RebuildTests%" == "1" (
145146
echo Removing test build dir^: !__TestBinDir!
@@ -305,6 +306,12 @@ REM ===
305306
REM =========================================================================================
306307
:TestBuildDone
307308

309+
REM copy crossgen2 from temp location to destination.
310+
REM without going through the temp location, MSBuild
311+
REM fails to compute globs correctly.
312+
rmdir /s /q "%CORE_ROOT%\crossgen2" 2>null
313+
move "%CORE_ROOT%\..\crossgen2" "%CORE_ROOT%\crossgen2" 2>nul
314+
308315
echo %__MsgPrefix%Test build succeeded. Finished at %TIME%
309316
echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
310317
exit /b 0

src/tests/build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ __Mono=0
339339
__MonoAot=0
340340
__MonoFullAot=0
341341
__BuildLogRootName="TestBuild"
342-
CORE_ROOT=
343342

344343
source $__RepoRootDir/src/coreclr/_build-commons.sh
345344

@@ -387,6 +386,7 @@ __IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig"
387386
__TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig"
388387
__CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
389388
__MonoBinDir="$__RootBinDir/bin/mono/$__OSPlatformConfig"
389+
CORE_ROOT="$__TestBinDir/Tests/Core_Root"
390390

391391
# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
392392
# This is needed by CLI to function.
@@ -417,6 +417,12 @@ fi
417417
echo "${__MsgPrefix}Test build successful."
418418
echo "${__MsgPrefix}Test binaries are available at ${__TestBinDir}"
419419

420+
# copy crossgen2 from temp location to destination.
421+
# without going through the temp location, MSBuild
422+
# fails to compute globs correctly.
423+
rm -rf "$CORE_ROOT/crossgen2"
424+
mv "$CORE_ROOT/../crossgen2" "$CORE_ROOT/crossgen2" 2>/dev/null || true
425+
420426
if [[ "$__RunTests" -ne 0 ]]; then
421427

422428
echo "Run Tests..."

0 commit comments

Comments
 (0)