Allow explicitly skipping crossgen#54094
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new -skipCrossgen command-line option to eng/build.sh to let users skip Crossgen when invoking the repo build script, aligning the shell script’s surface area more closely with eng/build.ps1.
Changes:
- Add
-skipcrossgenoption parsing ineng/build.shto setSkipUsingCrossgen=truefor the MSBuild invocation.
|
Currently, it's |
|
There might be other use cases, since the Powershell script also supports this option: Line 23 in 1ec3763 |
|
IMO, crossgen2 and NativeAOT are becoming exceedingly “essential” components of .NET that I think we shouldn’t consider them optional but rather mandatory part of port. One reason is their “support=false” modes are not exercised in CI so they go stale from time to time. As you noted in another thread that it was not too much of a problem to port them for new OS (for new architecture like riscv, it took me a few weeks last year, but only because AI was poor back then). Maybe it’s best to keep these patches local for now until your PRs are merged (and we don’t need to disable it for haiku anyway)? |
|
This got refactored in 0a74d57, before that there was a comment: |
Bash and powershell version are doing the same thing in main branch, PR is changing that. It is just a workaround for local dev. For full build (with packs), crossgen2 is mandatory even in powershell version. |
df31323 to
544f38d
Compare
|
I think this makes sense but we should make sure the powershell version has matching behavior (i.e. also allow overriding crossgen skipping when packing) |
|
What we aren't realizing is skipping crossgen2 step during build is a major performance degradation (every method in corelib won't be precompiled and start jitting). This shouldn't be an option for production at all, especially when the only use-case here is to support work-in-progress port which is already blocked on multiple other things. |
The latest commit should do it. I had a closer look and it seems that Lines 36 to 45 in b1aec5e |
You are making it sound like the end of the world when it has been the reality for every .NET version until .NET 8? Also, aren't build scripts meant to also support development work, and not just CI machines?
If the team is aware that skipping Crossgen in production script is harmful, then why should there be any release script that passes |
Add a `-skipCrossgen` option to `build.sh`, similar to the option in `build.ps1`. This allows the user to both enable `-pack` and skip Crossgen.
This avoids clashing with the `-pack` argument. Previously, it was the last one which wins between `-pack` and `-skipcrossgen`.
Previously, `-skipCrossgen` and `-skipInstallers` were useless. If `-pack` was set, they would be ignored. If `-pack` was not set, those flags were `-or`ed with `-not $pack`, which is effectively always `true`. This change now allows the flags to: 1. Override `-pack`, preventing it from setting the underlying properties to `false`. 2. Conditionally translate the underlying property to true only when they are passed. Otherwise, the defaults set by the MSBuild project will be used.
949e332 to
46c5d1c
Compare
All versions of .NET Core have crossgened version of corelib in production. crossgen2 replaced ngen/crossgen(1) at one point. This hasn't changed.
Following the right order of porting prevents blocking on these things. First port runtime (which you did), then shared framework/BCL (which is almost done for Haiku +/- your opened PRs in runtime), then these tools and then SDK and other repos are involved. Besides porting crossgen2 and NativeAOT are pretty trivial for new OS as you've already done in dotnet/runtime#127431. |
Doesn't this flag only disable Crossgen for the SDK? From what I understand, even with a Crossgen runtime present, we would still be blocked on that change being released and published before the normal build process starts working. |
Codeflow is automatic; runtime PR merged, few hours later bot will open PR in VMR repo (dotnet/dotnet), once that one is merged, bot will open PR in SDK and other repos with "from dotnet/dotnet". That's a continuous sync process. My suggestion is that we align |
The non-trivial thing here would be the review process - which is perfectly understandable given the massive scale of this project and the great work they are doing - so some quick unblocker like this is desirable. |
|
Haiku port is going on since 2021, we are clearly not in a rush that we can't live with a local patch for a few more weeks. |
you could say the same thing about many other options across the stack, while porting you often need to make choices that are not optimal to make progress. I think there are two things here:
This PR is about number one and it makes sense to me to have it. Whether it will be used for number two as well is a separate topic IMO |
The port which is still in progress in runtime shouldn't need SDK in first place.
Do we have this option in other repos in VMR? e.g. aspnetcore also uses crossgen2. |
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
SDK is what half of the The runtime port is, once again, usable(-ish?), but is undergoing a long review process that can only proceed when everybody has time. |
no, but we do have the option here so why not make it actually useful? let me know if you feel strongly about this being wrong, otherwise I'd be inclined to merge it. |
No problem with getting this merged, just trying to prevent this mode from spreading since it's not what gets exercised in the CI (and not the configuration any platform/distro maintainer ships .NET with). For porting of .NET to new platform, the high-level order is:
I know when @trungnt2910 started Haiku's port, this process was different and a bit unclear for "new platform bringup", now things more streamlined (still there is margin for improvement).
We can use |
ok, yeah we're in agreement here. |
Add a
-skipCrossgenoption tobuild.sh, similar to the option inbuild.ps1.This allows the user to both enable
-packand skip Crossgen.