Skip to content

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

Merged
steveisok merged 31 commits into
dotnet:mainfrom
steveisok:lib-builder-mobile
Mar 6, 2023
Merged

[android][ios] Add LibraryBuilder task to support aot library mode#81919
steveisok merged 31 commits into
dotnet:mainfrom
steveisok:lib-builder-mobile

Conversation

@steveisok

Copy link
Copy Markdown
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

ghost commented Feb 9, 2023

Copy link
Copy Markdown

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:-

Comment threadsrc/mono/msbuild/common/LibraryBuilder.props
Comment threadsrc/mono/msbuild/android/build/AndroidApp.targets Outdated
Comment threadsrc/tests/FunctionalTests/Android/Device_Emulator/AOT_LLVM/Program.cs Outdated
Comment threadsrc/tests/FunctionalTests/iOS/Device/AOT-LLVM/Program.cs Outdated
Comment threadsrc/mono/msbuild/android/build/AndroidApp.targets Outdated
Comment threadsrc/mono/msbuild/android/build/AndroidApp.targets Outdated
Comment threadsrc/tasks/LibraryBuilder/LibraryBuilder.cs
Comment threadsrc/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template Outdated
Comment threadsrc/tasks/AppleAppBuilder/Xcode.cs Outdated
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@steveisok

Copy link
Copy Markdown
MemberAuthor

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

Comment threadsrc/mono/msbuild/common/LibraryBuilder.targets Outdated
@steveisok

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-android

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment threadsrc/mono/msbuild/android/build/AndroidApp.targets Outdated
<ItemGroup Condition="'$(_IsLibraryMode)' == 'true'">
<DirectPInvokes Include="libSystem.Native" />
<DirectPInvokes Include="libSystem.IO.Compression.Native" />
<DirectPInvokes Include="libSystem.Security.Cryptography.Native.Android" />

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

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.


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

Copy link
Copy Markdown
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

Comment threadsrc/mono/msbuild/apple/build/AppleApp.targets Outdated
Comment threadsrc/mono/msbuild/apple/build/AppleApp.targets
@steveisok

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-android

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@steveisok

Copy link
Copy Markdown
MemberAuthor

Failure is known build error #80619

@steveisok
steveisok merged commit 88318ed into dotnet:mainMar 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.
Fixesdotnet/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.
Fixesdotnet/performance#2924
@ghostghost locked as resolved and limited conversation to collaborators Apr 6, 2023
Sign up for freeto 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

@steveisok@lambdageek@lateralusX@akoeplinger@mdh1418@ivanpovazan