-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 SDK and workload to support library mode #83487
Conversation
Introduces an experimental workload that supports building self-contained shared or static native libraries on iOS and Android.
…droidBuild.props)
...et/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj
Outdated
Show resolved
Hide resolved
...ono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in
Show resolved
Hide resolved
src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Sdk/Sdk.targets.in
Outdated
Show resolved
Hide resolved
/azp run runtime-android |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-android |
Azure Pipelines successfully started running 1 pipeline(s). |
_AndroidResolveReferences; | ||
_AndroidPrepareProfiledAot; | ||
_AndroidAotCompileApp; | ||
_AndroidAotCompile; | ||
_BuildNativeLibrary; |
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.
I think we should make this into a property and set the one that should be used depending if its app build or library build before importing AndroidBuild.props. In library builder SDK we could always set the property to _BuildNativeLibrary.
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.
I'd prefer doing this in a follow up.
@@ -1,28 +1,43 @@ | |||
<Project> |
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.
I think we should move the app specific properties and targets into a separate file that we import in the case we build and app instead of a library, or for in-tree where we currently only build apps, we can always import in the in-tree targets file.
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.
I'd prefer doing this in a follow up
_AppleAotCompileApp; | ||
$(_NativeLibraryTarget) | ||
_AppleAotCompile; | ||
_BuildNativeLibrary; | ||
_AppleGenerateAppBundle; |
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.
I think we should make this into a property and set the one that should be used depending if its app build or library build before importing AppleBuild.props. In library builder SDK we could always set the property to _BuildNativeLibrary.
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.
I'd prefer doing this in a follow up
@@ -1,24 +1,28 @@ | |||
<Project> |
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.
I think we should move the app specific properties and targets into a separate file that we import in the case we build and app instead of a library, or for in-tree, local builds where we currently only build apps, we can always import in the in-tree and/or local build targets file.
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.
I'd prefer doing this in a follow up.
src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Sdk/AutoImport.props
Outdated
Show resolved
Hide resolved
...ono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in
Show resolved
Hide resolved
/azp run runtime-android |
Azure Pipelines successfully started running 1 pipeline(s). |
add_definitions(-g) | ||
add_definitions(-fPIC) | ||
add_definitions(-fvisibility=hidden) | ||
set(USE_GCC_ATOMIC_OPS 1) |
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.
Right now this only applies to Android, didn't we want this applied to all?
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.
Unless I'm mistaken, we only apply these to android.
...ono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.targets.in
Show resolved
Hide resolved
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.
Is there a way to preview the workload generated??
Not yet. Wasm has been way ahead of us in that they can test workloads on CI. To get mobile going that way, it's a big collection of artifacts and most likely can't run per PR. |
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.
Looks good to me!
Introduces the experimental workload
mobile-librarybuilder-experimental
that supports building self-contained shared or static native libraries on iOS and Android.Once installed, the workload can be activated when the runtime identifier is android, ios, tvos, or maccatalyst based and the project contains the property
<NativeLib>true</NativeLib>
. NativeLib is a property NativeAOT uses to activate library mode and we will use that for consistency.The
Microsoft.NET.Runtime.LibraryBuilder.Sdk
is a new nuget package will contain all of the necessary msbuild props and targets that drive the whole library builder process.