Skip to content

Commit

Permalink
Skip checked builds from AOT
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Jan 7, 2023
1 parent a213249 commit 79c6554
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</Target>

<Target Name="RunPublishedCrossgen" AfterTargets="PublishCrossgen"
Condition="'$(TargetOS)' == '$(HostOS)' and '$(TargetArchitecture)' == '$(BuildArchitecture)'">
Condition="'$(TargetOS)' == '$(HostOS)' and '$(TargetArchitecture)' == '$(BuildArchitecture)' and '$(SkipRunPublishedCrossgen)' != 'true'">
<!-- Run the published crossgen if we're not cross-compiling -->
<Exec Command="@(FilesToPackage) $(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll --out $(IntermediateOutputPath)S.P.C.tmp" Condition="'%(FileName)%(Extension)' == 'crossgen2$(ExeSuffix)'">
<Output TaskParameter="ExitCode" PropertyName="CrossgenExitCode" />
Expand Down
45 changes: 22 additions & 23 deletions src/tests/Common/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildFromSource)' != 'true'">true</CopyCoreDisToolsToCoreRoot>
<!-- Non-desktop OS's use a custom dotnet host, instead of corerun -->
<IsDesktopOS Condition="'$(TargetsBrowser)' != 'true' and '$(TargetsAndroid)' != 'true' and '$(TargetstvOS)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetsMacCatalyst)' != 'true'">true</IsDesktopOS>
<Crossgen2Supported Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'">true</Crossgen2Supported>
<UsePublishedCrossgen2 Condition="'$(Crossgen2Supported)' == 'true' and '$(Configuration)' != 'checked'">true</UsePublishedCrossgen2>
</PropertyGroup>

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

<!--
Publish crossgen2 on supported platforms.
Publish to a temp directory to avoid msbuild glob computation problems.
-->
<MakeDir Directories="$(CORE_ROOT)" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true' and '$(UsePublishedCrossgen2)' != 'true'"
Targets="Restore;Publish"
BuildInParallel="true"
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2;PublishSelfContained=true;NativeAotSupported=false;PublishSingleFile=false;PublishReadyToRun=false;SkipRunPublishedCrossgen=true"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(UsePublishedCrossgen2)' == 'true'"
Targets="Restore;Publish"
BuildInParallel="true"
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<ItemGroup>
<RunTimeDependencyExclude Include="$(CORE_ROOT)\**\*.*" />
<RunTimeDependencyExcludeFiles Include="@(RunTimeDependencyExclude -> '%(FileName)%(Extension)')" />
Expand Down Expand Up @@ -92,11 +112,6 @@
</ItemGroup>

<ItemGroup>
<Crossgen2DependencyCopyLocal
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
Include="$(CoreCLRArtifactsPath)crossgen2\$(OutputRid)\publish\**\*"
TargetDir="%(RunTimeArtifactsIncludeFolders.Identity)" />

<!-- Add binary dependencies to copy-local items -->
<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' != 'True'"
Expand All @@ -122,7 +137,7 @@
$(Crossgen2Dir)/clrjit_*;
$(Crossgen2Dir)/jitinterface_*;
$(Crossgen2Dir)/Microsoft.DiaSymReader.Native.*.dll"
TargetDir="crossgen2/" />
TargetDir="../crossgen2/" />
</ItemGroup>

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

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>

<MSBuild Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
Targets="Restore;Publish"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<Copy
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
SourceFiles="@(Crossgen2DependencyCopyLocal)"
DestinationFiles="@(Crossgen2DependencyCopyLocal -> '$(CORE_ROOT)\crossgen2\%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
48 changes: 20 additions & 28 deletions src/tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<CLRTestPriority Condition="'$(CLRTestPriority)' == ''">0</CLRTestPriority>
<!-- Merged test runner assemblies might not have any non-generated sources, and that's okay -->
<NoWarn Condition="'$(IsMergedTestRunnerAssembly)' == 'true'">$(NoWarn);CS2008</NoWarn>
<Crossgen2Supported Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'">true</Crossgen2Supported>
<UsePublishedCrossgen2 Condition="'$(Crossgen2Supported)' == 'true' and '$(Configuration)' != 'checked'">true</UsePublishedCrossgen2>
</PropertyGroup>

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

<!--
Publish crossgen2 on supported platforms.
Publish to a temp directory to avoid msbuild glob computation problems.
-->
<MakeDir Directories="$(CORE_ROOT)" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true' and '$(UsePublishedCrossgen2)' != 'true'"
Targets="Restore;PublishCrossgen"
BuildInParallel="true"
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2;PublishSelfContained=true;NativeAotSupported=false;PublishSingleFile=false;PublishReadyToRun=false;SkipRunPublishedCrossgen=true"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(UsePublishedCrossgen2)' == 'true'"
Targets="Restore;Publish"
BuildInParallel="true"
Properties="PublishDir=$(CORE_ROOT)\..\crossgen2"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<ItemGroup>
<RunTimeDependencyExclude Include="$(CORE_ROOT)\**\*.*" />
<RunTimeDependencyExcludeFiles Include="@(RunTimeDependencyExclude -> '%(FileName)%(Extension)')" />
Expand Down Expand Up @@ -487,11 +507,6 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" />

<!-- Used for Crossgen2 R2R tests -->
<RunTimeArtifactsIncludeFolders Include="crossgen2/">
<IncludeSubFolders>True</IncludeSubFolders>
</RunTimeArtifactsIncludeFolders>

<!-- Used for capturing symbolic stack traces using Watson -->
<RunTimeArtifactsIncludeFolders Include="PDB/" />

Expand All @@ -510,11 +525,6 @@
</ItemGroup>

<ItemGroup>
<Crossgen2DependencyCopyLocal
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
Include="$(CoreCLRArtifactsPath)crossgen2\$(OutputRid)\publish\**\*"
TargetDir="%(RunTimeArtifactsIncludeFolders.Identity)" />

<!-- Add binary dependencies to copy-local items -->
<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' != 'True'"
Expand All @@ -527,8 +537,6 @@
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.Identity)" />


</ItemGroup>

<ItemGroup Condition="'$(TargetArchitecture)' == 'wasm'">
Expand Down Expand Up @@ -586,22 +594,6 @@
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>

<MSBuild Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
Targets="Restore;Publish"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<Copy
Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'"
SourceFiles="@(Crossgen2DependencyCopyLocal)"
DestinationFiles="@(Crossgen2DependencyCopyLocal -> '$(CORE_ROOT)\crossgen2\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>

</Target>

<Target Name="GetProjectsWithDisabledBuild" Returns="@(ProjectWithDisabledBuild)">
Expand Down
7 changes: 7 additions & 0 deletions src/tests/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ set "__BinDir=%__RootBinDir%\bin\coreclr\%__OSPlatformConfig%"
set "__TestRootDir=%__RootBinDir%\tests\coreclr"
set "__TestBinDir=%__TestRootDir%\%__OSPlatformConfig%"
set "__TestIntermediatesDir=%__TestRootDir%\obj\%__OSPlatformConfig%"
set "CORE_ROOT=%__TestBinDir%\Tests\Core_Root"

if "%__RebuildTests%" == "1" (
echo Removing test build dir^: !__TestBinDir!
Expand Down Expand Up @@ -305,6 +306,12 @@ REM ===
REM =========================================================================================
:TestBuildDone

REM copy crossgen2 from temp location to destination.
REM without going through the temp location, MSBuild
REM fails to compute globs correctly.
rmdir /s /q "%CORE_ROOT%\crossgen2" 2>null
move "%CORE_ROOT%\..\crossgen2" "%CORE_ROOT%\crossgen2" 2>nul

echo %__MsgPrefix%Test build succeeded. Finished at %TIME%
echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
exit /b 0
Expand Down
8 changes: 7 additions & 1 deletion src/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ __Mono=0
__MonoAot=0
__MonoFullAot=0
__BuildLogRootName="TestBuild"
CORE_ROOT=

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

Expand Down Expand Up @@ -387,6 +386,7 @@ __IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig"
__TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig"
__CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
__MonoBinDir="$__RootBinDir/bin/mono/$__OSPlatformConfig"
CORE_ROOT="$__TestBinDir/Tests/Core_Root"

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

# copy crossgen2 from temp location to destination.
# without going through the temp location, MSBuild
# fails to compute globs correctly.
rm -rf "$CORE_ROOT/crossgen2"
mv "$CORE_ROOT/../crossgen2" "$CORE_ROOT/crossgen2" 2>/dev/null || true

if [[ "$__RunTests" -ne 0 ]]; then

echo "Run Tests..."
Expand Down

0 comments on commit 79c6554

Please sign in to comment.