-
Notifications
You must be signed in to change notification settings - Fork 569
[NativeAOT] Enable workload-provided linker for NDK-free builds #11303
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
sbomer
wants to merge
10
commits into
main
Choose a base branch
from
dev/sbomer/nativelink-workload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
47e7301
Add NativeAOT no-NDK smoke test
sbomer c9890dc
Include CRT objects in NativeAOT runtime pack
sbomer 93eee9d
WIP: system lib stubs fix and workload linker test
sbomer 66e6601
Add NativeAOT-specific redist directory with API 24 stubs
sbomer b75bc5e
Update submodules to match main
sbomer 099b90a
Include toolchain libraries in NativeAOT runtime pack
sbomer 891a72d
Remove CompressDebugSections from NativeAOT link step
sbomer 06aac9a
Address PR review feedback
sbomer bcccc62
Remove sysroot stub .so files from NativeAOT publish output
sbomer d4f2671
Fix NativeAOT test: override _AndroidNdkDirectory to prevent NDK disc…
sbomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/NativeAotBuildTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| using NUnit.Framework; | ||
| using Xamarin.Android.Tasks; | ||
| using Xamarin.ProjectTools; | ||
|
|
||
| namespace Xamarin.Android.Build.Tests | ||
| { | ||
| /// <summary> | ||
| /// Build tests specific to the NativeAOT runtime. | ||
| /// </summary> | ||
| [TestFixture] | ||
| [Category ("Node-2")] | ||
| public class NativeAotBuildTests : BaseTest | ||
| { | ||
| [Test] | ||
| public void BuildNativeAot_WithoutNdk_Fails () | ||
| { | ||
| var proj = new XamarinAndroidApplicationProject { | ||
| IsRelease = true, | ||
| }; | ||
| proj.SetRuntime (AndroidRuntime.NativeAOT); | ||
|
|
||
| using var builder = CreateApkBuilder (); | ||
| builder.ThrowOnBuildFailure = false; | ||
| // Override _AndroidNdkDirectory (the internal resolved path) to simulate no NDK. | ||
| // Setting AndroidNdkDirectory alone is not sufficient because ResolveSdks has a | ||
| // fallback chain that discovers NDK from the SDK directory, environment variables, | ||
| // and other standard locations. /p: has highest MSBuild precedence and cannot be | ||
| // overridden by task outputs. | ||
| Assert.IsFalse ( | ||
| builder.Build (proj, parameters: new [] { "_AndroidNdkDirectory=" }), | ||
| "Build should have failed without NDK." | ||
| ); | ||
| } | ||
|
|
||
| [Test] | ||
| public void BuildNativeAot_WithWorkloadLinker_WithoutNdk () | ||
| { | ||
| var proj = new XamarinAndroidApplicationProject { | ||
| IsRelease = true, | ||
| }; | ||
| proj.SetRuntime (AndroidRuntime.NativeAOT); | ||
|
|
||
| using var builder = CreateApkBuilder (); | ||
| // Use workload-provided linker and sysroot instead of NDK | ||
| Assert.IsTrue ( | ||
| builder.Build (proj, parameters: new [] { | ||
| "_AndroidNdkDirectory=", | ||
| "_AndroidUseWorkloadNativeLinker=true", | ||
| }), | ||
| "Build should succeed with workload linker and no NDK." | ||
| ); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.