Skip to content

Add bootstrapping build mechanism and enable for SourceBuild #114285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2c52e80
Revert "Publish with BaseOS RID when its present"
jkoritzinsky Apr 14, 2025
7c8bc6e
WIP: Bootstrap build instead of staged build
jkoritzinsky Apr 2, 2025
c5a67c0
Fix bootstrap restore.
jkoritzinsky Apr 2, 2025
5fc4b0a
Get ILC and crossgen2 publishing with bootstrap subset + use-bootstrap
jkoritzinsky Apr 3, 2025
3ae8a10
Remove two-stage build and convert to bootstrap build.
jkoritzinsky Apr 3, 2025
ae6824b
Don't build OOB libs in bootstrapping. They're not needed
jkoritzinsky Apr 3, 2025
6c353f8
Layout bootstrap files in a separate directory so our actual product …
jkoritzinsky Apr 4, 2025
4d69c06
Fix condition for bootstrap in SB
jkoritzinsky Apr 4, 2025
b22b99c
Various refactorings and put cdac on the same plan as ilc/crossgen2
jkoritzinsky Apr 8, 2025
64667ef
Strip double-dash options too as they can be specified
jkoritzinsky Apr 11, 2025
c12698a
Update eng/build.sh
jkoritzinsky Apr 14, 2025
b631070
Update eng/DotNetBuild.props
jkoritzinsky Apr 14, 2025
efeda56
Apply suggestion
jkoritzinsky Apr 15, 2025
0b066ed
Don't remove the source-built-upstream-cache folder
jkoritzinsky Apr 15, 2025
59c078f
Fix loongarch64 leg
jkoritzinsky Apr 16, 2025
f23c641
Generate breadcrumbs in runtime.proj (where we build the aotsdk folder).
jkoritzinsky Apr 16, 2025
9400e95
Adjust trimming tests to hook into targetingpacks.targets refactored …
jkoritzinsky Apr 16, 2025
2d6e806
Add documentation
jkoritzinsky Apr 16, 2025
de101ab
Fix local apphost path hookup
jkoritzinsky Apr 16, 2025
54630a9
Docs feedback
jkoritzinsky Apr 17, 2025
4c611b1
Merge branch 'main' of github.com:dotnet/runtime into dotnetbuild-loc…
jkoritzinsky Apr 17, 2025
9fb4c78
Build hosts in runtime-linker-tests now that we're using the live hosts.
jkoritzinsky Apr 17, 2025
bc6ec22
Use the targetingpacks.targets process for a live apphost
jkoritzinsky Apr 17, 2025
d798f2a
PR feedback
jkoritzinsky Apr 21, 2025
ef6a6f8
Add to build.sh
jkoritzinsky Apr 22, 2025
053dcae
Fix up RID graph in the bootstrapping
jkoritzinsky Apr 23, 2025
d109c64
Merge branch 'main' of github.com:dotnet/runtime into dotnetbuild-loc…
jkoritzinsky Apr 23, 2025
e494fa9
Pass the right RID graph for NativeExports
jkoritzinsky Apr 23, 2025
feff1e1
Fix bootstrap for community portable platforms
jkoritzinsky Apr 23, 2025
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
36 changes: 36 additions & 0 deletions Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,40 @@
<MSBuild Projects="$(RepoTasksDir)tasks.proj"
Targets="BuildIncrementally" />
</Target>

<Target Name="SetupBootstrapLayout"
AfterTargets="Build"
Condition="'$(Subset)' == 'bootstrap'">
<ItemGroup>
<AotSdkFile
Include="$(CoreCLRAotSdkDir)/*"
Condition="'$(UseNativeAotForComponents)' == 'true'" />
<AppHostFile
Include="$([MSBuild]::NormalizePath('$(DotNetHostBinDir)', 'apphost$(ExeSuffix)'))" />
<AppHostFile
Include="$([MSBuild]::NormalizePath('$(CoreCLRArtifactsPath)', 'corehost', 'singlefilehost$(ExeSuffix)'))"
Condition="'$(UseNativeAotForComponents)' != 'true'" />
<RefPackFile Include="$(MicrosoftNetCoreAppRefPackDir)/**/*" />
<RuntimePackFile Include="$(MicrosoftNetCoreAppRuntimePackDir)/**/*" />
<RidGraphFile Include="$(ArtifactsBinDir)Microsoft.NETCore.Platforms/*.json" />

<AotSdkFile
DestinationPath="$(BootstrapAotSdkDir)/%(Filename)%(Extension)" />
<AppHostFile
DestinationPath="$(BootstrapHostDir)/%(Filename)%(Extension)" />
<RefPackFile
DestinationPath="$(BootstrapRefPackDir)/%(RecursiveDir)%(Filename)%(Extension)" />
<RuntimePackFile
DestinationPath="$(BootstrapRuntimePackDir)/%(RecursiveDir)%(Filename)%(Extension)" />
<RidGraphFile
DestinationPath="$(BootstrapRidGraphDir)/%(RecursiveDir)%(Filename)%(Extension)" />
<BootstrapFile Include="@(AotSdkFile);@(AppHostFile);@(RefPackFile);@(RuntimePackFile);@(RidGraphFile)" />
</ItemGroup>

<Copy
SourceFiles="@(BootstrapFile)"
DestinationFiles="@(BootstrapFile->Metadata('DestinationPath'))"
SkipUnchangedFiles="true" />
<Message Importance="high" Text="Bootstrap files copied to $(ArtifactsDir)bootstrap" />
</Target>
</Project>
6 changes: 0 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,4 @@
<BeforeMicrosoftNETSdkTargets Condition="'$(MSBuildProjectExtension)' == '.ilproj'">$(BeforeMicrosoftNETSdkTargets);$(RepositoryEngineeringDir)ILSdk.BeforeTargets.targets</BeforeMicrosoftNETSdkTargets>
</PropertyGroup>

<PropertyGroup>
<!-- Keep in sync with outputs defined in Microsoft.NETCore.Platforms.csproj. -->
<BundledRuntimeIdentifierGraphFile>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Microsoft.NETCore.Platforms', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
<BundledRuntimeIdentifierGraphFile Condition="!Exists('$(BundledRuntimeIdentifierGraphFile)')">$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
</PropertyGroup>

</Project>
15 changes: 14 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,22 @@
<ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)liveBuilds.targets" />

<PropertyGroup Condition="'$(UseBootstrapLayout)' == 'true'">
<!-- Keep in sync with outputs defined in Microsoft.NETCore.Platforms.csproj. -->
<BundledRuntimeIdentifierGraphFile>$([MSBuild]::NormalizePath('$(BootstrapRidGraphDir)', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
<!-- If our bootstrap build didn't add a new RID to the graph, fall back to the frozen graph. -->
<BundledRuntimeIdentifierGraphFile Condition="!Exists('$(BundledRuntimeIdentifierGraphFile)')">$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should fallback to PortableRuntimeIdentifierGraph.json as it is default since .NET 8.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to keep this consistent with the non-bootstrapping path below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will likely be removed in the future, since there is no new distro version added in past few years, so it's just a legacy baggage at this point. The distro graph comes from SB and portable graph is used in official builds. Since .NET 10 is going to use VMR for official builds, we may want to double check. (not for this PR)

</PropertyGroup>
<PropertyGroup Condition="'$(UseBootstrapLayout)' != 'true'">
<!-- Keep in sync with outputs defined in Microsoft.NETCore.Platforms.csproj. -->
<BundledRuntimeIdentifierGraphFile>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Microsoft.NETCore.Platforms', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
<BundledRuntimeIdentifierGraphFile Condition="!Exists('$(BundledRuntimeIdentifierGraphFile)')">$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)Analyzers.targets" />
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="$(RepositoryEngineeringDir)liveBuilds.targets" />
<Import Project="$(RepositoryEngineeringDir)toolAot.targets" />
<Import Project="$(RepositoryEngineeringDir)generators.targets" />
<Import Project="$(RepositoryEngineeringDir)python.targets" />
Expand Down
12 changes: 12 additions & 0 deletions docs/workflow/building/coreclr/cross-building.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,15 @@ docker run --rm \
mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-freebsd-12 \
./build.sh --subset clr --cross --os freebsd
```

### Building CoreCLR with Bootstrapping

CoreCLR builds a few tools, including NativeAOT compiler itself, using NativeAOT (or single file where NativeAOT is not supported). The build defaults to using a "Last Known Good" version of NativeAOT to build the tools. This "Last Known Good" version comes from the .NET SDK referenced in the global.json file. This default was chosen for a good local build experience of most repo contributors. Building with live NativeAOT version would make the local build longer and it would make debugging local changes that impact NativeAOT compiler complicated.

The runtime's build scripts provide an additional set of options to build with the live NativeAOT version instead of the "Last Known Good" version. This is useful for testing changes to NativeAOT or the tools that are built with it, and is required for building those tools for target platforms that are not known to the "Last Known Good" version of NativeAOT, such as FreeBSD, community architectures, or non-portable builds of .NET. This is not yet implemented for Windows.

To build the bootstrap subset of the runtime repo, you can build the `bootstrap` subset. To use the bootstrap components in the runtime repo build, you can pass the `--use-bootstrap` argument to the build script. This will use the bootstrap components instead of the "Last Known Good" version of NativeAOT.

For simplicity, a `--bootstrap` option is also provided. This option will build the `bootstrap` subset, clean up the artifacts directory, and then build the runtime repo with the `--use-bootstrap` option. This is useful for building the runtime repo with the live NativeAOT version without having to run two separate commands.

The `--bootstrap` option is automatically specified when building the runtime repo for .NET Source Build, as the vast majority of Source Build scenarios use non-portable RIDs.
2 changes: 2 additions & 0 deletions docs/workflow/building/coreclr/freebsd-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Ensure you have all of the prerequisites installed from the [Linux Requirements]

Once that is done, refer to the [Linux section of the cross-building doc](/docs/workflow/building/coreclr/cross-building.md#linux-cross-building). There are detailed instructions on how to cross-compile using your Linux environment, including a section dedicated to FreeBSD building.

You'll also need to use the `--bootstrap` option as documented in the [cross-building doc](/docs/workflow/building/coreclr/cross-building.md#building-coreclr-with-bootstrapping) to build the cross-compilation toolchain.

## Build directly on FreeBSD

Ensure you have all of the prerequisites installed from the [FreeBSD Requirements](/docs/workflow/requirements/freebsd-requirements.md).
Expand Down
4 changes: 3 additions & 1 deletion eng/DotNetBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
<InnerBuildArgs Condition="'$(OS)' != 'Windows_NT'">$(InnerBuildArgs) --outputrid $(OutputRID)</InnerBuildArgs>
<!-- BaseOS is an expected known rid in the graph that OutputRID is compatible with.
It's used to add OutputRID in the graph if the parent can't be detected. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS) /p:BaseOS=$(BaseOS)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS)</InnerBuildArgs>
<!-- Source-build will use non-portable RIDs. To build for these non-portable RID scenarios, we must do a boostrapped build. -->
<InnerBuildArgs Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildUseMonoRuntime)' != 'true'">$(InnerBuildArgs) --bootstrap</InnerBuildArgs>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'$(DotNetBuildSourceOnly)' == 'true'

This is good for me. I wonder if TargetRid != NETCoreSdkRuntimeIdentifier might be an alternative?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use that by itself because that would cause this to trigger on some (but not all) Unified Build legs.

For Unified Build, we'll want this on either for 100% of the verticals or never.

<!-- Pass through special build modes controlled by properties -->
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeWasmEnableThreads)' == 'true'">$(InnerBuildArgs) /p:WasmEnableThreads=true</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildMonoEnableLLVM)' != ''">$(InnerBuildArgs) /p:MonoEnableLLVM=$(DotNetBuildMonoEnableLLVM)</InnerBuildArgs>
Expand Down
51 changes: 32 additions & 19 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@
<_NativeAotSupportedArch Condition="'$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'loongarch64' or '$(TargetArchitecture)' == 'riscv64' or ('$(TargetOS)' == 'windows' and '$(TargetArchitecture)' == 'x86')">true</_NativeAotSupportedArch>
<NativeAotSupported Condition="'$(_NativeAotSupportedOS)' == 'true' and '$(_NativeAotSupportedArch)' == 'true'">true</NativeAotSupported>

<!-- Determine if AOT tools can run on the specified target -->
<_AotToolsSupportedOS Condition="'$(TargetsMobile)' != 'true' and '$(TargetsLinuxBionic)' != 'true' and '$(StageOneBuild)' != 'true'">true</_AotToolsSupportedOS>
<_AotToolsSupportedArch Condition="'$(TargetArchitecture)' != 'armel'">true</_AotToolsSupportedArch>
<AotToolsSupported Condition="'$(_AotToolsSupportedOS)' == 'true' and '$(_AotToolsSupportedArch)' == 'true'">true</AotToolsSupported>
<!-- Determine if we support running the .NET SDK on the target platform -->
<_SdkToolsSupportedOS Condition="'$(TargetsMobile)' != 'true' and '$(TargetsLinuxBionic)' != 'true'">true</_SdkToolsSupportedOS>
<_SdkToolsSupportedArch Condition="'$(TargetArchitecture)' != 'armel'">true</_SdkToolsSupportedArch>
<SdkToolsSupported Condition="'$(_SdkToolsSupportedOS)' == 'true' and '$(_SdkToolsSupportedArch)' == 'true'">true</SdkToolsSupported>

<UseNativeAotForComponents Condition="'$(NativeAotSupported)' == 'true' and '$(TargetOS)' == '$(HostOS)' and '$(TargetsLinuxBionic)' != 'true'">true</UseNativeAotForComponents>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -147,6 +149,12 @@
<DefaultPacksSubsets Condition="'$(DotNetBuildSourceOnly)' != 'true'">$(DefaultPacksSubsets)+packs.installers</DefaultPacksSubsets>
<DefaultPacksSubsets Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and '$(DotNetBuildSourceOnly)' != 'true'">$(DefaultPacksSubsets)+packs.tests</DefaultPacksSubsets>
<DefaultPacksSubsets Condition="'$(RuntimeFlavor)' != 'Mono' and '$(ForceBuildMobileManifests)' == 'true'">$(DefaultPacksSubsets)+mono.manifests</DefaultPacksSubsets>

<BootstrapSubsets>host.native+libs.sfx+libs.pretest</BootstrapSubsets>
<BootstrapSubsets Condition="'$(UseNativeAotForComponents)' != 'true'">$(BootstrapSubsets)+clr.runtime+clr.corelib</BootstrapSubsets>
<BootstrapSubsets Condition="'$(UseNativeAotForComponents)' == 'true'">$(BootstrapSubsets)+clr.nativeaotlibs+clr.nativeaotruntime+libs.native</BootstrapSubsets>

<SwapNativeForIL Condition="$(_subset.Contains('+bootstrap+')) and '$(RuntimeFlavor)' == 'CoreCLR'">true</SwapNativeForIL>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -158,6 +166,7 @@
<_subset>$(_subset.Replace('+tools+', '+$(DefaultToolsSubsets)+'))</_subset>
<_subset>$(_subset.Replace('+host+', '+$(DefaultHostSubsets)+'))</_subset>
<_subset>$(_subset.Replace('+packs+', '+$(DefaultPacksSubsets)+'))</_subset>
<_subset>$(_subset.Replace('+bootstrap+', '+bootstrap+$(BootstrapSubsets)+'))</_subset>
<_subset Condition="'$(TargetOS)' == 'browser'">$(_subset.Replace('+clr.runtime+', '+mono.emsdk+clr.runtime+'))</_subset>

<!-- Surround _subset in dashes to simplify checks below -->
Expand All @@ -168,8 +177,6 @@
</PropertyGroup>

<PropertyGroup>
<_IsCommunityCrossArchitecture Condition="'$(CrossBuild)' == 'true' and ('$(TargetArchitecture)' == 'loongarch64' or '$(TargetArchitecture)' == 'riscv64')">true</_IsCommunityCrossArchitecture>
<UseNativeAotForComponents Condition="'$(NativeAotSupported)' == 'true' and '$(TargetOS)' == '$(HostOS)' and '$(TargetsLinuxBionic)' != 'true' and '$(_IsCommunityCrossArchitecture)' != 'true'">true</UseNativeAotForComponents>
<!-- If we're building clr.nativeaotlibs and not building the CLR runtime, compile libraries against NativeAOT CoreLib -->
<UseNativeAotCoreLib Condition="'$(TestNativeAot)' == 'true' or ($(_subset.Contains('+clr.nativeaotlibs+')) and !$(_subset.Contains('+clr.native+')) and !$(_subset.Contains('+clr.runtime+')) and !$(_subset.Contains('+clr.corelib+')))">true</UseNativeAotCoreLib>
</PropertyGroup>
Expand Down Expand Up @@ -258,6 +265,7 @@
<SubsetName Include="RegenerateDownloadTable" OnDemand="true" Description="Regenerates the nightly build download table" />
<SubsetName Include="RegenerateThirdPartyNotices" OnDemand="true" Description="Regenerates the THIRD-PARTY-NOTICES.TXT file based on other repos' TPN files." />
<SubsetName Include="tasks" OnDemand="true" Description="Build the repo local task projects." />
<SubsetName Include="bootstrap" OnDemand="true" Description="Build the projects needed to build shipping assets in the repo against live assets." />

</ItemGroup>

Expand Down Expand Up @@ -440,22 +448,22 @@
$(CoreClrProjectRoot)tools\PdbChecker\PdbChecker.csproj;
$(CoreClrProjectRoot)tools\AssemblyChecker\AssemblyChecker.csproj;
$(ToolsProjectRoot)StressLogAnalyzer\src\StressLogAnalyzer.csproj" Category="clr" Condition="'$(DotNetBuildSourceOnly)' != 'true'"/>
<!-- We may use these targets with the in-build ILCompiler or with the shipping ILCompiler. Produce them whenever we may use them. -->
<ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(AotToolsSupported)' == 'true' or '$(NativeAotSupported)' == 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.Build.Tasks\ILCompiler.Build.Tasks.csproj" Category="clr" Condition="'$(AotToolsSupported)' == 'true' or '$(NativeAotSupported)' == 'true'" />
<!-- skip the architectures that don't have LKG runtime packs -->
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_publish.csproj" Condition="'$(AotToolsSupported)' == 'true'" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_publish.csproj" Category="clr" Condition="'$(AotToolsSupported)' == 'true'" />

<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Condition="'$(AotToolsSupported)' == 'true'" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Condition="'$(AotToolsSupported)' == 'true'" Category="clr" />

<!--
Always build the in-build variants of these tools. They run on the host machine, which we always have LKG packs for.
For two-stage builds, we omit this step during stage2 since stage1 covers it.
-->
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_inbuild.csproj" Category="clr" Condition="'$(StageTwoBuild)' != 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_inbuild.csproj" Category="clr" Condition="'$(StageTwoBuild)' != 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_inbuild.csproj" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_inbuild.csproj" Category="clr" />

<!-- We may use these targets with the in-build ILCompiler or with the shipping ILCompiler. Produce them whenever we may use them. -->
<ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(SdkToolsSupported)' == 'true' or '$(NativeAotSupported)' == 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler.Build.Tasks\ILCompiler.Build.Tasks.csproj" Category="clr" Condition="'$(SdkToolsSupported)' == 'true' or '$(NativeAotSupported)' == 'true'" />

<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_publish.csproj" Condition="'$(SdkToolsSupported)' == 'true'" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_publish.csproj" Condition="'$(SdkToolsSupported)' == 'true'" Category="clr" />


<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Condition="'$(SdkToolsSupported)' == 'true'" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Condition="'$(SdkToolsSupported)' == 'true'" Category="clr" />

<ProjectToBuild Condition="'$(TargetOS)' == 'windows' or ('$(TargetOS)' == 'linux' and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64')) or '$(TargetOS)' == 'osx'" Include="$(CoreClrProjectRoot)tools\SuperFileCheck\SuperFileCheck.csproj" Category="clr" />

Expand Down Expand Up @@ -716,6 +724,11 @@
<ProjectToBuild Include="$(RepoTasksDir)tasks.proj" Category="tasks" />
</ItemGroup>

<!-- Bootstrap -->
<ItemGroup Condition="$(_subset.Contains('+bootstrap+'))">
<ProjectToBuild Include="$(LibrariesProjectRoot)Microsoft.NETCore.Platforms\src\Microsoft.NETCore.Platforms.csproj" Category="libraries" />
</ItemGroup>

<!-- Set default configurations. -->
<ItemGroup>
<ProjectToBuild Update="@(ProjectToBuild)">
Expand Down
30 changes: 30 additions & 0 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ usage()
echo " --usemonoruntime Product a .NET runtime with Mono as the underlying runtime."
echo " --verbosity (-v) MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]."
echo " [Default: Minimal]"
echo " --use-bootstrap Use the results of building the bootstrap subset to build published tools on the target machine."
echo " --bootstrap Build the bootstrap subset and then build the repo with --use-bootstrap."
echo ""

echo "Actions (defaults to --restore --build):"
Expand Down Expand Up @@ -156,6 +158,7 @@ cmakeargs=''
extraargs=''
crossBuild=0
portableBuild=1
bootstrap=0

source $scriptroot/common/native/init-os-and-arch.sh

Expand Down Expand Up @@ -508,6 +511,16 @@ while [[ $# > 0 ]]; do
shift 1
;;

-use-bootstrap)
arguments="$arguments /p:UseBootstrap=true"
shift 1
;;

-bootstrap)
bootstrap=1
shift 1
;;

-fsanitize)
if [ -z ${2+x} ]; then
echo "No value for -fsanitize is supplied. See help (--help) for supported values." 1>&2
Expand Down Expand Up @@ -570,4 +583,21 @@ export DOTNETSDK_ALLOW_TARGETING_PACK_CACHING=0
cmakeargs="${cmakeargs// /%20}"
arguments="$arguments /p:TargetArchitecture=$arch /p:BuildArchitecture=$hostArch"
arguments="$arguments /p:CMakeArgs=\"$cmakeargs\" $extraargs"

if [[ "$bootstrap" == "1" ]]; then
# Strip build actions other than -restore and -build from the arguments for the bootstrap build.
bootstrapArguments="$arguments"
for flag in --sign --publish --pack --test -sign -publish -pack -test; do
bootstrapArguments="${bootstrapArguments//$flag/}"
done
"$scriptroot/common/build.sh" $bootstrapArguments /p:Subset=bootstrap -bl:$scriptroot/../artifacts/log/bootstrap.binlog

# Remove artifacts from the bootstrap build so the product build is a "clean" build.
echo "Cleaning up artifacts from bootstrap build..."
rm -r "$scriptroot/../artifacts/bin"
# Remove all directories in obj except for the source-built-upstream-cache directory to avoid breaking SourceBuild.
find "$scriptroot/../artifacts/obj" -mindepth 1 -maxdepth 1 ! -name 'source-built-upstream-cache' -exec rm -rf {} +
arguments="$arguments /p:UseBootstrap=true"
fi

"$scriptroot/common/build.sh" $arguments
Loading
Loading