Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Revert "Copy published crossgen2 in artifacts/tests (#80154)" by jakobbotsch · Pull Request #106956 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Revert "Copy published crossgen2 in artifacts/tests (#80154)" by jakobbotsch · Pull Request #106956 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Revert "Copy published crossgen2 in artifacts/tests (#80154)" by jakobbotsch · Pull Request #106956 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Revert "Copy published crossgen2 in artifacts/tests (#80154)" by jakobbotsch · Pull Request #106956 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Revert "Copy published crossgen2 in artifacts/tests (#80154)" by jakobbotsch · Pull Request #106956 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Revert "Copy published crossgen2 in artifacts/tests (#80154)" by jakobbotsch · Pull Request #106956 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Revert "Copy published crossgen2 in artifacts/tests (#80154)" by jakobbotsch · Pull Request #106956 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,7 +244,7 @@ jobs:
# Compose the Core_Root folder containing all artifacts needed for running
# CoreCLR tests. This step also compiles the framework using Crossgen2
# in ReadyToRun jobs.
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg)
displayName: Generate CORE_ROOT

# Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64)
Expand Down
15 changes: 11 additions & 4 deletions src/coreclr/scripts/superpmi.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -693,6 +693,14 @@ def __init__(self, coreclr_args):
self.pmi_location = determine_pmi_location(coreclr_args)
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

if coreclr_args.crossgen2:
self.corerun = os.path.join(self.core_root, self.corerun_tool_name)
if coreclr_args.dotnet_tool_path is None:
self.crossgen2_driver_tool = self.corerun
else:
self.crossgen2_driver_tool = coreclr_args.dotnet_tool_path
logging.debug("Using crossgen2 driver tool %s", self.crossgen2_driver_tool)

if coreclr_args.pmi or coreclr_args.crossgen2:
self.assemblies = coreclr_args.assemblies
self.exclude = coreclr_args.exclude
Expand DownExpand Up@@ -1058,7 +1066,7 @@ async def run_crossgen2(print_prefix, assembly, self):
#
# invoke with:
#
# <Core_Root>\crossgen2\crossgen2.exe @<temp.rsp>
# dotnet <Core_Root>\crossgen2\crossgen2.dll @<temp.rsp>
#
# where "dotnet" is one of:
# 1. <runtime_root>\dotnet.cmd/sh
Expand All@@ -1081,7 +1089,7 @@ async def run_crossgen2(print_prefix, assembly, self):
# Log what is in the response file
write_file_to_log(rsp_filepath)

command = [self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command = [self.crossgen2_driver_tool, self.coreclr_args.crossgen2_tool_path, "@" + rsp_filepath]
command_string = " ".join(command)
logging.debug("%s%s", print_prefix, command_string)

Expand DownExpand Up@@ -4908,8 +4916,7 @@ def verify_base_diff_args():

if coreclr_args.crossgen2:
# Can we find crossgen2?

crossgen2_tool_name = "crossgen2.exe" if platform.system() == "Windows" else "crossgen2"
crossgen2_tool_name = "crossgen2.dll"
crossgen2_tool_path = os.path.abspath(os.path.join(coreclr_args.core_root, "crossgen2", crossgen2_tool_name))
if not os.path.exists(crossgen2_tool_path):
print("`--crossgen2` is specified, but couldn't find " + crossgen2_tool_path + ". (Is it built?)")
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />

<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
<PublishAot>true</PublishAot>
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
Expand Down
19 changes: 6 additions & 13 deletions src/coreclr/tools/r2rtest/Crossgen2Runner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,19 +24,15 @@ class Crossgen2RunnerOptions
class Crossgen2Runner : CompilerRunner
{
private Crossgen2RunnerOptions Crossgen2RunnerOptions;
private bool IsAssembly => _options.Crossgen2Path != null && _options.Crossgen2Path.FullName.EndsWith(".dll");
public override CompilerIndex Index => CompilerIndex.CPAOT;

// Crossgen2 runs as a standalone binary
// Crossgen2 runs on top of corerun.
protected override string CompilerRelativePath => "";
protected override string CompilerFileName => "";

protected override string CompilerPath => IsAssembly ? _options.DotNetCli : _options.Crossgen2Path?.FullName
?? Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "crossgen2.exe" : "crossgen2");

public override CompilerIndex Index => CompilerIndex.CPAOT;

protected readonly List<string> _referenceFiles = new();
protected override string CompilerFileName => _options.DotNetCli;
protected readonly List<string> _referenceFiles = new List<string>();

private string Crossgen2Path => _options.Crossgen2Path != null ? _options.Crossgen2Path.FullName : Path.Combine(_options.CoreRootDirectory.FullName, "crossgen2", "crossgen2.dll");
private bool CompositeMode => Crossgen2RunnerOptions != null ? Crossgen2RunnerOptions.Composite : _options.Composite;

public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2RunnerOptions, IEnumerable<string> references, string overrideOutputPath = null)
Expand DownExpand Up@@ -68,9 +64,7 @@ public Crossgen2Runner(BuildOptions options, Crossgen2RunnerOptions crossgen2Run
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable<string> inputAssemblyFileNames)
{
ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames);
if (IsAssembly)
processParameters.Arguments = $"{_options.Crossgen2Path.FullName} {processParameters.Arguments}";

processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}";
// DOTNET_ variables
processParameters.EnvironmentOverrides["DOTNET_GCStress"] = "";
processParameters.EnvironmentOverrides["DOTNET_HeapVerify"] = "";
Expand All@@ -82,7 +76,6 @@ public override ProcessParameters CompilationProcess(string outputFileName, IEnu
processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = "";
processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = "";
processParameters.EnvironmentOverrides["COMPlus_GCName"] = "";

return processParameters;
}

Expand Down
18 changes: 9 additions & 9 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,17 +85,16 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__ResponseFile="$__OutputFile.rsp"
rm $__ResponseFile 2>/dev/null

__R2RDumpCommand=$_DebuggerFullPath
__Command=$_DebuggerFullPath
# Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
__R2RDumpCommand+=" $__TestDotNetCmd"
__Command+=" $__TestDotNetCmd"
else
__R2RDumpCommand+=" dotnet"
__Command+=" dotnet"
fi
__R2RDumpCommand+=" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand=$__Command" $CORE_ROOT/R2RDump/R2RDump.dll"
__R2RDumpCommand+=" --header --sc --in $__OutputFile --out $__OutputFile.r2rdump --val"

__Command="$_DebuggerFullPath $CORE_ROOT/crossgen2/crossgen2"
__Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

Expand DownExpand Up@@ -248,10 +247,11 @@ if defined RunCrossGen2 (
) else (
set __DotNet="dotnet"
)
set __R2RDumpCommand=!_DebuggerFullPath! !__DotNet! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __Command=!_DebuggerFullPath!
set __Command=!__Command! !__DotNet!
set __R2RDumpCommand=!__Command! "!CORE_ROOT!\r2rdump\r2rdump.dll"
set __R2RDumpCommand=!__R2RDumpCommand! --header --sc --in !__OutputFile! --out !__OutputFile!.r2rdump --val

set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!
echo !__InputFile!>>!__ResponseFile!
Expand Down
52 changes: 8 additions & 44 deletions src/tests/Common/Directory.Build.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
<CopyCoreDisToolsToCoreRoot Condition="$(GCStressDependsOnCoreDisTools) And '$(DotNetBuildSourceOnly)' != '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>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)coredistools.targets" Condition="$(CopyCoreDisToolsToCoreRoot)" />
Expand All@@ -35,47 +34,7 @@
</ItemDefinitionGroup>

<Target Name="CopyDependencyToCoreRoot"
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<!-- Copy apphost to crossgen2_publish directory.
The default configuration between product and tests are flipped. When we build project like:
`build -c debug -rc checked`, the corresponding test command is `src/tests/build -checked -p:LibrariesConfiguration=debug`,
instead of `-debug -p:RuntimeConfiguration=checked`. That forces us to either pass the
`HostConfiguration=debug` explicitly or fix this disparity; both of which will break the dev workflow.

As a workaround, we will first check if the directory pointed by `HostConfiguration` exists, then check
`LibrariesConfiguration`.
-->

<PropertyGroup Condition="'$(Crossgen2Supported)' == 'true'">
<_targetOS>$(TargetOS)</_targetOS>
<_targetOS Condition="'$(_targetOS)' == 'windows'">win</_targetOS>
<_apphostPath Condition="Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(HostConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_apphostPath Condition="'$(_apphostPath)' == '' and Exists('$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)')">$(ArtifactsBinDir)$(_targetOS)-$(TargetArchitecture).$(LibrariesConfiguration)\corehost\apphost$(ExeSuffix)</_apphostPath>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(ToolsConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(ToolsConfiguration)</_toolsConfiguration>
<_toolsConfiguration Condition="Exists('$(ArtifactsBinDir)ILLink.Tasks\$(LibrariesConfiguration)\$(NetCoreAppToolCurrent)\ILLink.Tasks.dll')">$(LibrariesConfiguration)</_toolsConfiguration>
</PropertyGroup>

<MakeDir Condition="'$(Crossgen2Supported)' == 'true'" Directories="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)" />

<Copy
SourceFiles="$(_apphostPath)"
DestinationFiles="$(ArtifactsObjDir)coreclr\crossgen2_publish\$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)\apphost$(ExeSuffix)"
Condition="'$(Crossgen2Supported)' == 'true'" />

<!-- Publish crossgen2 on supported platforms. -->

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="Restore"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid());"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />

<MSBuild Condition="'$(Crossgen2Supported)' == 'true'"
Targets="PublishToDisk"
BuildInParallel="true"
Properties="NativeAotSupported=$(NativeAotSupported);UseNativeAotForComponents=$(UseNativeAotForComponents);ToolsConfiguration=$(_toolsConfiguration);OutputPath=$(CORE_ROOT)\crossgen2;"
Projects="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
DependsOnTargets="ResolveAssemblyReferences;ResolveRuntimeFilesFromLocalBuild">

<ItemGroup>
<RunTimeDependencyCopyLocal Include="@(RuntimeCopyLocalItems)" />
Expand DownExpand Up@@ -121,6 +80,11 @@
<!-- Used by the Crossgen comparison job -->
<RunTimeArtifactsIncludeFolders Include="IL/" TargetDir="IL/" />

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

<!-- Used for NativeAOT tests -->
<RunTimeArtifactsIncludeFolders Include="ilc-published/" TargetDir="ilc-published/">
<IncludeSubFolders>True</IncludeSubFolders>
Expand DownExpand Up@@ -171,7 +135,7 @@

<RunTimeDependencyCopyLocal
Condition="'%(RuntimeArtifactsIncludeFolders.IncludeSubFolders)' == 'True'"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**\*"
Include="$(CoreCLRArtifactsPath)%(RunTimeArtifactsIncludeFolders.Identity)**/*"
Exclude="@(RunTimeArtifactsExcludeFiles -> '$(CoreCLRArtifactsPath)%(Identity)')"
TargetDir="%(RunTimeArtifactsIncludeFolders.TargetDir)" />
</ItemGroup>
Expand DownExpand Up@@ -259,7 +223,7 @@

<Copy
SourceFiles="@(RunTimeDependencyCopyLocal)"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)\%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(RunTimeDependencyCopyLocal -> '$(CORE_ROOT)/%(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ set "DOTNET_GCStress="
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

"%CORE_ROOT%\crossgen2\crossgen2.exe" --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll
"%CORE_ROOT%\corerun" %CORE_ROOT%\crossgen2\crossgen2.dll --out r2r\$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r %CORE_ROOT%\*.dll

endlocal
set CLRCustomTestLauncher=RunBasicTestWithMcj.cmd --runCustomTest
Expand All@@ -47,7 +47,7 @@ mkdir r2r
# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun

"$CORE_ROOT/crossgen2/crossgen2" --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll
"$CORE_ROOT/corerun" $CORE_ROOT/crossgen2/crossgen2.dll --out r2r/$(MSBuildProjectName).dll $(MSBuildProjectName).dll -r $CORE_ROOT/*.dll

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
chmod +x ./RunBasicTestWithMcj.sh
Expand Down
4 changes: 3 additions & 1 deletion src/tests/build.proj
Original file line numberDiff line numberDiff line change
Expand Up@@ -651,6 +651,8 @@
Condition="'$(__BuildTestWrappersOnly)' != '1' and '$(__CopyNativeTestBinaries)' != '1' and '$(__TestBuildMode)' == 'crossgen2' and !$(MonoAot) and !$(MonoFullAot)" >

<PropertyGroup>
<CrossgenDir>$(__BinDir)\$(BuildArchitecture)</CrossgenDir>

<CrossgenOutputDir>$(__TestIntermediatesDir)\crossgen.out</CrossgenOutputDir>

<CrossgenCmd>$(DotNetCli)</CrossgenCmd>
Expand All@@ -670,7 +672,7 @@
<CrossgenCmd Condition="'$(__CompositeBuildMode)' == ''">$(CrossgenCmd) --crossgen2-parallelism 1</CrossgenCmd>

<CrossgenCmd>$(CrossgenCmd) --verify-type-and-field-layout</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(__BinDir)\$(BuildArchitecture)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
<CrossgenCmd>$(CrossgenCmd) --crossgen2-path "$(CrossgenDir)\crossgen2\tools\crossgen2.dll"</CrossgenCmd>
</PropertyGroup>

<Message Importance="High" Text="$(MsgPrefix)Compiling framework using Crossgen2: $(CrossgenCmd)" />
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,36 +48,36 @@ goto Loop

if "%COMPOSITENAME%"=="" goto done

set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll --composite %COMPILEARG%
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll.log 2>&1
if NOT EXIST %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%Composite.dll del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\a.dll
goto done

:CG2Single
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2NoMethods
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll --compile-no-methods -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleInputBubble
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\*.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done

:CG2SingleBubbleADOnly
del %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll
set BUILDCMD=%CORE_ROOT%\crossgen2\crossgen2.exe -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
set BUILDCMD=%TESTBATCHROOT%\..\..\..\..\..\..\.dotnet\dotnet %CORE_ROOT%\crossgen2\crossgen2.dll -r %CORE_ROOT%\* -r %TESTINITIALBINPATH%\d.dll -o %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll --inputbubble %TESTINITIALBINPATH%\%COMPOSITENAME%.dll
echo %BUILDCMD% > %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log
call %BUILDCMD% >> %TESTINITIALBINPATH%\%TESTTARGET_DIR%\%COMPOSITENAME%.dll.log 2>&1
goto done
Expand Down
Loading