-
Notifications
You must be signed in to change notification settings - Fork 516
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
Fix non-NativeAOT builds with PublishAot=true in the project file #18727
Fix non-NativeAOT builds with PublishAot=true in the project file #18727
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
<!-- | ||
Workaround for SDK issue where setting PublishAot=true during build cannot resolve correct | ||
runtime pack and IL compiler pack. | ||
|
||
Setting PublishAotUsingRuntimePack=true unconditionally results in the runtime pack label to | ||
be updated to "NativeAOT" instead of "Mono" and trying to build against NativeAOT runtime | ||
pack instead of the Mono one. | ||
|
||
Setting PublishAotUsingRuntimePack=false causes the NuGet resolution to check for known | ||
ILCompiler packs and these don't exist for iOS-like platforms. | ||
|
||
The workaround ensure that PublishAotUsingRuntimePack is false when SDK updates the runtime | ||
pack labels, and thus the "Mono" label is used. We then set it to true right before | ||
ProcessFrameworkReferences target to skip downloading the target ILCompiler pack. | ||
--> | ||
<Target Name="_WorkaroundAotRuntimePackResolution" BeforeTargets="ProcessFrameworkReferences" Condition="'$(PublishAot)' == 'true' And '$(_UseNativeAot)' != 'true'"> | ||
<PropertyGroup> | ||
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack> | ||
</PropertyGroup> | ||
</Target> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct fix here: dotnet/sdk#34640
If it's accepted and ingested then we should remove this workaround and unconditionally set <PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
when PublishAot=true
in dotnet/targets/Xamarin.Shared.Sdk.props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed to #18741 to not forget to remove the workaround.
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes)
NET (empty diffs)
❗ API diff vs stable (Breaking changes)Legacy Xamarin (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
.NET (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻✅ All tests on macOS M1 - Mac Ventura (13.0) passed. Pipeline on Agent |
💻 [CI Build] Windows Integration Tests passed 💻✅ All Windows Integration Tests passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻✅ All tests on macOS M1 - Mac Big Sur (11.5) passed. Pipeline on Agent |
📚 [PR Build] Artifacts 📚Packages generatedView packagesPipeline on Agent |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just trying to follow, but I believe ILC is referring to the intermediate language? So in the case of when we are not publishing but still using aot mode there is no need to go through the hassle of linking the IL since its not actively getting distributed anywhere?
ILC refers to IL Compiler here, which is the NativeAOT compiler that translates intermediate language into native code.
We only do NativeAOT compilation for This PR tries to repair the case of |
🚀 [CI Build] Test results 🚀Test results✅ All tests passed on VSTS: simulator tests. 🎉 All 232 tests passed 🎉 Tests counts✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
The gist is:
<PublishAot>true</PublishAot>
then the NativeAOT build targets get included.NativeCompilationDuringPublish
is disabled, the NativeAOT targets are chained throughBeforeTargets
attribute to some publish targets (computing the resolved publish paths). Xamarin runs those publish targets even for non-publish builds, so it brings the whole ILC compilation along. That's undesirable.RunILLink
property is set unconditionally by the NativeAOT build integration. If we don't fix it then ILLink never runs, and neither do all the custom steps to generate registrars andmain()
.Update: Apparently, we still need to fix runtime pack resolution for iOS-like platforms with
PublishAotUsingRuntimePack=true
.