[xabt] Filter non-Android .so files from _ResolvedNativeLibraries#10936
Open
jonathanpeppers wants to merge 2 commits intomainfrom
Open
[xabt] Filter non-Android .so files from _ResolvedNativeLibraries#10936jonathanpeppers wants to merge 2 commits intomainfrom
jonathanpeppers wants to merge 2 commits intomainfrom
Conversation
NuGet packages like Microsoft.Testing.Extensions.CodeCoverage ship native .so files under runtimes/linux-x64/native/. The .NET SDK stamps RuntimeIdentifier=android-arm64 metadata on all ResolvedFileToPublish items during inner builds, causing ProcessNativeLibraries to treat these non-Android libraries as valid Android native libs. This leads to spurious XA0141 warnings about 16 KB page alignment. Use %(PathInPackage) metadata to detect the actual source RID and exclude .so files from non-Android runtimes (linux-x64, linux-musl-x64, osx-x64, win-x64, etc.) while preserving android-* and linux-bionic-* RIDs which are valid Android targets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Android SDK MSBuild assembly/native resolution pipeline to avoid treating non-Android .so runtime assets (e.g., runtimes/linux-x64/native/*.so from NuGet packages) as Android native libraries, preventing downstream ABI/alignment checks from producing spurious XA0141 warnings.
Changes:
- Adds a filtering step for
_ResolvedNativeLibrariesbased on%(PathInPackage)to exclude.sofiles coming from non-Android runtime folders underruntimes/. - Explicitly preserves
runtimes/android*andruntimes/linux-bionic*native assets as valid Android targets.
...d.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AssemblyResolution.targets
Outdated
Show resolved
Hide resolved
Use %(Identity) path instead of %(PathInPackage) metadata to filter non-Android .so files from _ResolvedNativeLibraries, since runtime pack items don't define PathInPackage (causing MSB4096). Add NonAndroidNativeLibrariesDoNotProduceWarnings test that injects a fake linux-x64 .so into ResolvedFileToPublish with RuntimeIdentifier set to android-arm64, verifying the filter prevents spurious warnings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
NuGet packages like Microsoft.Testing.Extensions.CodeCoverage ship native .so files under runtimes/linux-x64/native/. The .NET SDK stamps RuntimeIdentifier=android-arm64 metadata on all ResolvedFileToPublish items during inner builds, causing ProcessNativeLibraries to treat these non-Android libraries as valid Android native libs. This leads to spurious XA0141 warnings about 16 KB page alignment.
Use %(PathInPackage) metadata to detect the actual source RID and exclude .so files from non-Android runtimes (linux-x64, linux-musl-x64, osx-x64, win-x64, etc.) while preserving android-* and linux-bionic-* RIDs which are valid Android targets.