Skip to content
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

Move MSBuild projects out of the native build scripts #31701

Merged
81 commits merged into from
Mar 4, 2020

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Feb 4, 2020

Summary

Significantly simplify our native build scripts by moving all of the managed builds up to the Arcade build infrastructure and splitting them into subsets to help save developer time on their inner builds.

Additionally, since it isn't easily possible to make Arcade build a project as self-contained publish, this PR also changes the crossgen2 build to build framework-dependent, have the Helix SDK pull down a .NET CLI for the test runs, and update the test run scripts to resolve the local dotnet CLI or the one in the path based on environment variables.

Subsets

The coreclr build is split into these subsets:

  • corelib
    • Contains System.Private.CoreLib
  • runtime
    • The native build as well as crossgenning of System.Private.CoreLib
  • linuxdac (Windows-only)
    • The cross-OS Windows->Linux DAC
  • alpinedac (Windows-only)
    • The cross-OS Windows->Alpine Linux DAC
  • nativecorelib
    • Crossgens System.Private.Corelib
  • tools
    • The managed tools such as R2RDump and Crossgen2
  • packages
    • The coreclr packages

Local build improvements

The managed eventing headers are generated during the System.Private.CoreLib build by discovering python and running the script during the build in MSBuild.

The ucrt copy and enforce-pgo steps run as part of the native build instead of the managed build, which makes significantly more sense logically.

Due to keeping all of the managed builds within a single MSBuild invocation instead of nested invocations, this change saves around a minute in local build times.

Workflow changes

CoreCLR developers will have to use the root build.cmd/sh scripts to build any of the managed components. The src/coreclr/build-rutnime.cmd/sh scripts only support building the native coreclr CMake project. The src/coreclr/crossgen-corelib.cmd/sh scripts support running crossgen on System.Private.CoreLib. The old src/coreclr/build.cmd/sh scripts are kept so as to give developers a transition period from the scripts to the new scripts.

Workflow examples

I've included some workflow examples below.

Build CoreCLR, System.Private.CoreLib, crossgen System.Private.CoreLib, managed tools, CoreCLR packages in Checked configuration for x86:

D:\source\runtime>./build.cmd -subsetCategory coreclr -c checked -arch x86

Build CoreCLR, System.Private.CoreLib, crossgen System.Private.CoreLib, skip managed tools, skip coreclr packages:

D:\source\runtime>./build.cmd -subsetcategory coreclr -subset runtime-corelib-nativecorelib

Build CoreCLR and managed tools only:

D:\source\runtime>./build.cmd -subsetcategory coreclr -subset runtime-tools

Build CoreCLR, System.Private.CoreLib, crossgen System.Private.CoreLib, managed tools, CoreCLR packages in debug and libraries in release (already works today):

D:\source\runtime> ./build.cmd -subsetcategory coreclr-libraries -c Release -runtimeConfiguration debug

Future improvements

This PR will enable us to build System.Private.CoreLib in a job before running the coreclr or libraries builds. As a result, this moves us closer to being able to build coreclr and libraries in parallel in CI. Additionally, this does most of the work to Arcadify coreclr's build, so we can focus more on what our next steps and "final" build script design will be.

….Private.CoreLib into their own subsets in Subsets.props and drive their builds via Arcade instead of the coreclr scripts.
…nstead of in the build.cmd/sh scripts. Clean up the build.sh usage documentation (lots of copy-paste errors).
…ldOS to enable building System.Private.CoreLib for the correct output given the script parameters.
…ile. Enable the test shell scripts to either resolve the dotnet CLI from the path or from relative to Core_Root if the __DotNet variable is undefined.
@AaronRobinsonMSFT
Copy link
Member

To help make this more visible, I'm thinking about renaming the build.cmd/sh scripts to be build-native.cmd/sh and splitting out the crossgen script to be more explicit.

This renaming is a good idea that I strongly suggest. Instead of completely removing the build.cmd/sh scripts I would instead leave them intact for some amount of time (2 - 3 weeks) and have them print out the new workflow (i.e. point to a readme/URL/PR). The breadcrumb of what to do next would be very helpful.

eng/build.sh Outdated Show resolved Hide resolved
eng/run-test.sh Outdated Show resolved Hide resolved
@jkoritzinsky
Copy link
Member Author

There's no single exit point for src/coreclr/build.sh, so I'm just going to put the warning at the beginning and at the "success" end.

@jkoritzinsky
Copy link
Member Author

jkoritzinsky commented Mar 2, 2020

@jkoritzinsky jkoritzinsky added this to the 5.0 milestone Mar 2, 2020
Clean up build-runtime parameters and passing the official build ID from runtime.proj.
@jkoritzinsky
Copy link
Member Author

Yep. We're passing it as an "unprocessed build arg", which gets passed along to the MSBuild invocation for GenerateNativeVersionFile. If you check the official build I linked to, the outputs of the CoreCLR native build have the correct version info.

@jkoritzinsky
Copy link
Member Author

Only failure is due to #32764

Anyone else have any feedback? If not, I'm going to merge this at EOD.

@ghost
Copy link

ghost commented Mar 3, 2020

Hello @jkoritzinsky!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 389835b into dotnet:master Mar 4, 2020
@jkoritzinsky jkoritzinsky deleted the hoist-S.P.CL branch March 4, 2020 02:19
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants