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

[android][ios] Add LibraryBuilder task to support aot library mode #81919

Merged
merged 31 commits into from
Mar 6, 2023

Conversation

steveisok
Copy link
Member

This change adds a build task to generate a self-contained shared or static library when using the aot compiler and will only export symbols for methods decorated with UnmanagedCallersOnly attributes (similar to NativeAOT).

For android, there is full testing integration that can be triggered by supplying /p:NativeLib=shared|static. iOS will come at a later date as it is a bit more complex trying to generate a framework project.

Contributes to #79377

@ghost
Copy link

ghost commented Feb 9, 2023

Tagging subscribers to this area: @directhex
See info in area-owners.md if you want to be subscribed.

Issue Details

This change adds a build task to generate a self-contained shared or static library when using the aot compiler and will only export symbols for methods decorated with UnmanagedCallersOnly attributes (similar to NativeAOT).

For android, there is full testing integration that can be triggered by supplying /p:NativeLib=shared|static. iOS will come at a later date as it is a bit more complex trying to generate a framework project.

Contributes to #79377

Author: steveisok
Assignees: steveisok
Labels:

area-Infrastructure-mono

Milestone: -

src/mono/msbuild/common/LibraryBuilder.props Show resolved Hide resolved
src/mono/msbuild/android/build/AndroidApp.targets Outdated Show resolved Hide resolved
src/tests/FunctionalTests/iOS/Device/AOT-LLVM/Program.cs Outdated Show resolved Hide resolved
src/mono/msbuild/android/build/AndroidApp.targets Outdated Show resolved Hide resolved
src/mono/msbuild/android/build/AndroidApp.targets Outdated Show resolved Hide resolved
src/tasks/LibraryBuilder/LibraryBuilder.cs Show resolved Hide resolved
src/tasks/AppleAppBuilder/Xcode.cs Outdated Show resolved Hide resolved
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@steveisok
Copy link
Member Author

@akoeplinger @mdh1418 please give this another pass when you have a moment.

@steveisok
Copy link
Member Author

/azp run runtime-android

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

src/mono/msbuild/android/build/AndroidApp.targets Outdated Show resolved Hide resolved
<ItemGroup Condition="'$(_IsLibraryMode)' == 'true'">
<DirectPInvokes Include="libSystem.Native" />
<DirectPInvokes Include="libSystem.IO.Compression.Native" />
<DirectPInvokes Include="libSystem.Security.Cryptography.Native.Android" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is missing libSystem.Net.Security.Native and libSystem.Security.Cryptography.Native (for Linux Bionic) and libSystem.Globalization.Native (for Filip's ICU PR).

I wonder if we should generate this list based on the .a files instead of hardcoding.

I'm ok with addressing this in a follow-up PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be addressed in a follow up.

<Output TaskParameter="CompiledAssemblies" ItemName="_AndroidAssembliesInternal" />
</MonoAOTCompiler>

<ItemGroup>
<_AndroidAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" />
<AppAssembliesInternal Include="@(_AndroidAssembliesInternal)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still unresolved

src/mono/msbuild/apple/build/AppleApp.targets Outdated Show resolved Hide resolved
src/mono/msbuild/apple/build/AppleApp.targets Show resolved Hide resolved
@steveisok
Copy link
Member Author

/azp run runtime-android

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@steveisok
Copy link
Member Author

Failure is known build error #80619

@steveisok steveisok merged commit 88318ed into dotnet:main Mar 6, 2023
@steveisok steveisok deleted the lib-builder-mobile branch March 6, 2023 22:52
steveisok pushed a commit to steveisok/runtime that referenced this pull request Mar 9, 2023
dotnet#81919 introduced a regression where the gss framework was omitted from the sample build. This change adds it back in.

Fixes dotnet/performance#2924
steveisok added a commit that referenced this pull request Mar 9, 2023
#81919 introduced a regression where the gss framework was omitted from the sample build. This change adds it back in.

Fixes dotnet/performance#2924
@ghost ghost locked as resolved and limited conversation to collaborators Apr 6, 2023
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.

6 participants