-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[android][ios] Add LibraryBuilder task to support aot library mode #81919
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
Changes from 16 commits
1d8483b
6cc724f
bbf6992
0055975
76cdbe4
9caea1f
9c3d805
37fde1a
e3d1fd4
3911d2c
9bb0dd9
4ed46bf
fde2bda
d6fd785
cde3f9d
6ba6aa9
ba37138
d3c03ac
04acf6c
f4c204f
2ccf282
807844e
55e98f5
340a02f
09aab3c
c99889b
223cf3a
e641c28
6a23439
e272bb0
f30804d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |
| AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)" /> | ||
|
|
||
| <PropertyGroup> | ||
| <AndroidGenerateAppBundle Condition="'$(GenerateAppBundle)' != ''">$(GenerateAppBundle)</AndroidGenerateAppBundle> | ||
steveisok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <AndroidGenerateAppBundle Condition="'$(AndroidGenerateAppBundle)' == '' and '$(_IsLibraryMode)' == 'true'">false</AndroidGenerateAppBundle> | ||
| <AndroidGenerateAppBundle Condition="'$(AndroidGenerateAppBundle)' == ''">true</AndroidGenerateAppBundle> | ||
| </PropertyGroup> | ||
|
|
||
|
|
@@ -16,6 +18,110 @@ | |
| <PropertyGroup> | ||
| <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile'))</_MobileIntermediateOutputPath> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <BundleDir>$(AndroidAppBundleDir)</BundleDir> | ||
| <_MonoHeaderPath>$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0</_MonoHeaderPath> | ||
| <_AotModuleTablePath>$(AndroidAppBundleDir)\modules.c</_AotModuleTablePath> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- | ||
| LibraryBuilder takes the approach of accepting items to help what is being linked | ||
| as opposed to figuring it out in the task. | ||
| --> | ||
|
|
||
| <!-- common linker arguments for app and library builds --> | ||
| <ItemGroup> | ||
| <_CommonLinkerArgs Include="libz.so" /> | ||
| <_CommonLinkerArgs Include="log" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_LoadICU" /> | ||
steveisok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <_CommonLinkerArgs Include="-u GlobalizationNative_GetLatestJapaneseEra" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_ChangeCase" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_CloseSortHandle" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_GetLocales" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_GetLocaleInfoInt" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_GetLocaleTimeFormat" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_ToUnicode" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_NormalizeString" /> | ||
| <_CommonLinkerArgs Include="-u GlobalizationNative_GetTimeZoneDisplayName" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(_IsLibraryMode)' == 'true'"> | ||
| <!-- add all non stub libs first --> | ||
| <!-- if runtimecompoents is empty, exclude -static.a and include -stub-static.a instead --> | ||
| <!-- if runtimecomponents is *, we're ok because all -static.a is included --> | ||
| <!-- if runtimecomponents is a list, add to items and only pull in -static.a --> | ||
steveisok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <!-- libmonosgen needs to be statically linked always --> | ||
| <_UsedComponents | ||
| Condition="'$(RuntimeComponents)' != '' and '$(RuntimeComponents)' != '*'" | ||
| Include="$(RuntimeComponents)" /> | ||
|
|
||
| <_RuntimeLibraries | ||
| Condition="'$(_TargetsDevice)' == 'true'" | ||
|
||
| Include="$(AndroidAppDir)\*.a" | ||
| Exclude="$(AndroidAppDir)\*-stub-static.a" /> | ||
| <_RuntimeLibraries | ||
| Condition="'$(_TargetsDevice)' == ''" | ||
| Include="$(AndroidAppDir)\*.dylib;$(AndroidAppDir)\libmonosgen*.a;$(AndroidAppDir)\*-static.a" | ||
steveisok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Exclude="$(AndroidAppDir)\libmonosgen*.dylib;$(AndroidAppDir)\*-stub-static.a" /> | ||
steveisok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <!-- and not contains %(_UsedComponents)-static*.a --> | ||
| <!-- if count > 0, remove all *-static components except in _UsedComponents --> | ||
| <!-- if count > 0, include all stubs except the ones in _UsedComponents --> | ||
| <_RuntimeLibraries | ||
| Condition="'@(_UsedComponents->Count())' > 0" | ||
| Remove="$(AndroidAppDir)\libmono-component-*-static.a" /> | ||
| <_RuntimeLibraries | ||
| Condition="'@(_UsedComponents->Count())' > 0" | ||
| Include="$(AndroidAppDir)\*-stub-static.a" /> | ||
| <_RuntimeLibraries | ||
| Condition="'@(_UsedComponents->Count())' == 0" | ||
| Remove="$(AndroidAppDir)\*-static.a" /> | ||
| <_RuntimeLibraries | ||
| Condition="'@(_UsedComponents->Count())' == 0" | ||
steveisok marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Include="$(AndroidAppDir)\*-stub-static.a" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- | ||
| This exists for the time being in order to support runtime initialization in library mode. | ||
| It will go away once we have support for auto initialization. | ||
|
||
| --> | ||
| <ItemGroup Condition="'$(_IsLibraryMode)' == 'true'"> | ||
| <_RuntimeSymbolsToKeep Include=" | ||
| register_aot_modules; | ||
| mono_jit_init_version; | ||
| mono_jit_exec; | ||
| mono_assembly_get_name; | ||
| mono_assembly_name_get_culture; | ||
| mono_assembly_name_get_name; | ||
| mono_assembly_open; | ||
| mono_class_get_method_from_name; | ||
| mono_class_get_name; | ||
| mono_class_get_namespace; | ||
| mono_debug_init; | ||
| mono_dllmap_insert; | ||
| mono_domain_get; | ||
| mono_gc_init_finalizer_thread; | ||
| mono_get_exception_class; | ||
| mono_install_assembly_preload_hook; | ||
| mono_install_load_aot_data_hook; | ||
| mono_install_unhandled_exception_hook; | ||
| mono_jit_cleanup; | ||
| mono_jit_parse_options; | ||
| mono_jit_set_aot_mode; | ||
| mono_object_get_class; | ||
| mono_object_get_virtual_method; | ||
| mono_runtime_invoke; | ||
| mono_set_crash_chaining; | ||
| mono_set_signal_chaining; | ||
| mono_string_to_utf8; | ||
| mono_trace_set_log_handler; | ||
| monovm_initialize; | ||
| monovm_runtimeconfig_initialize; | ||
| mono_aot_register_module; | ||
| mono_polling_required; | ||
| mono_thread_interruption_request_flag;" /> | ||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <Target Name="_BeforeAndroidBuildApp"> | ||
|
|
@@ -104,22 +210,28 @@ | |
| <ProfiledAOTProfilePaths Include="$(MibcFilePath)" /> | ||
| </ItemGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <_EnableUnmanagedCallersOnlyMethodsExport Condition="'$(_IsLibraryMode)' == 'true'">true</_EnableUnmanagedCallersOnlyMethodsExport> | ||
| </PropertyGroup> | ||
|
|
||
| <MonoAOTCompiler | ||
| CompilerBinaryPath="@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())'))" | ||
| OutputDir="$(_MobileIntermediateOutputPath)" | ||
| Mode="$(_AOTMode)" | ||
| OutputType="AsmOnly" | ||
| AotModulesTablePath="$(_AotModuleTablePath)" | ||
| Assemblies="@(_AotInputAssemblies)" | ||
| AotModulesTablePath="$(AndroidAppBundleDir)\modules.c" | ||
| CompilerBinaryPath="@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','$(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())'))" | ||
| EnableUnmanagedCallersOnlyMethodsExport="$(_EnableUnmanagedCallersOnlyMethodsExport)" | ||
| IntermediateOutputPath="$(_MobileIntermediateOutputPath)" | ||
| LLVMPath="$(MonoAotCrossDir)" | ||
| MibcProfilePath="@(ProfiledAOTProfilePaths)" | ||
| UseLLVM="$(MonoEnableLLVM)" | ||
| LLVMPath="$(MonoAotCrossDir)"> | ||
| Mode="$(_AOTMode)" | ||
| OutputDir="$(_MobileIntermediateOutputPath)" | ||
| OutputType="AsmOnly" | ||
| UseLLVM="$(MonoEnableLLVM)"> | ||
| <Output TaskParameter="CompiledAssemblies" ItemName="_AndroidAssembliesInternal" /> | ||
| </MonoAOTCompiler> | ||
|
|
||
| <ItemGroup> | ||
| <_AndroidAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" /> | ||
| <AppAssembliesInternal Include="@(_AndroidAssembliesInternal)" /> | ||
|
||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
|
|
@@ -133,23 +245,33 @@ | |
| <RuntimeComponents Condition="'$(RuntimeComponents)' == ''" >marshal-ilgen</RuntimeComponents> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup Condition="'$(_IsLibraryMode)' == 'true'"> | ||
| <_NativeDependencies Include="$(LibraryOutputPath)" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <_ExtraAppLinkerArgs Include="@(_CommonLinkerArgs)" /> | ||
| </ItemGroup> | ||
|
|
||
| <AndroidAppBuilderTask | ||
| RuntimeIdentifier="$(RuntimeIdentifier)" | ||
| ProjectName="$(AssemblyName)" | ||
| MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0" | ||
| AppDir="$(AndroidAppDir)" | ||
| Assemblies="@(_AndroidAssembliesInternal)" | ||
| MainLibraryFileName="$(MainLibraryFileName)" | ||
| DiagnosticPorts="$(DiagnosticPorts)" | ||
| EnvironmentVariables="@(AndroidEnv)" | ||
| ExtraLinkerArguments="@(_ExtraAppLinkerArgs)" | ||
| ForceAOT="$(RunAOTCompilation)" | ||
| ForceFullAOT="$(ForceFullAOT)" | ||
| ForceInterpreter="$(MonoForceInterpreter)" | ||
| StripDebugSymbols="False" | ||
| RuntimeComponents="$(RuntimeComponents)" | ||
| DiagnosticPorts="$(DiagnosticPorts)" | ||
| IsLibraryMode="$(_IsLibraryMode)" | ||
| MainLibraryFileName="$(MainLibraryFileName)" | ||
| MonoRuntimeHeaders="$(_MonoHeaderPath)" | ||
| NativeDependencies="@(_NativeDependencies)" | ||
| OutputDir="$(AndroidAppBundleDir)" | ||
| AppDir="$(AndroidAppDir)"> | ||
| <Output TaskParameter="ApkPackageId" PropertyName="ApkPackageId" /> | ||
| ProjectName="$(AssemblyName)" | ||
| RuntimeComponents="$(RuntimeComponents)" | ||
| RuntimeIdentifier="$(RuntimeIdentifier)" | ||
| StripDebugSymbols="False"> | ||
| <Output TaskParameter="ApkBundlePath" PropertyName="ApkBundlePath" /> | ||
| <Output TaskParameter="ApkPackageId" PropertyName="ApkPackageId" /> | ||
| </AndroidAppBuilderTask> | ||
|
|
||
| <Message Importance="High" Text="PackageId: $(ApkPackageId)"/> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,7 @@ | |
| <DevTeamProvisioning Condition="'$(DevTeamProvisioning)' == '' and '$(TargetOS)' == 'maccatalyst'">adhoc</DevTeamProvisioning> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- TODO: this breaks runtime tests on Helix due to the file not being there for some reason. Once this is fixed we can remove the UpdateRuntimePack target here --> | ||
| <!--<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" Condition="'$(TargetingpacksTargetsImported)' != 'true'"/>--> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't we keep this? |
||
| <Import Project="..\..\common\LibraryBuilder.targets" /> | ||
| <Import Project="$(MSBuildThisFileDirectory)AppleApp.targets" /> | ||
|
|
||
| <!-- Use local runtime pack --> | ||
|
|
@@ -24,22 +23,4 @@ | |
| </ItemGroup> | ||
| <Message Text="Used runtime pack: %(ResolvedRuntimePack.PackageDirectory)" Importance="high" /> | ||
| </Target> | ||
|
|
||
| <Target Name="CopyAppZipToHelixTestDir" | ||
| Condition="'$(AppleCopyAppZipToHelixTestDir)' == 'true'" | ||
| AfterTargets="Build" | ||
| DependsOnTargets="Publish"> | ||
| <PropertyGroup> | ||
| <WasmHelixTestAppRelativeDir Condition="'$(WasmHelixTestAppRelativeDir)' == ''">$(MSBuildProjectName)</WasmHelixTestAppRelativeDir> | ||
| <!-- Helix properties --> | ||
| <!-- AnyCPU as Platform--> | ||
| <OSPlatformConfig>$(TargetOS).AnyCPU.$(Configuration)</OSPlatformConfig> | ||
| <HelixArchiveRoot>$([MSBuild]::NormalizeDirectory($(ArtifactsDir), 'helix'))</HelixArchiveRoot> | ||
| <HelixArchiveRunOnlyRoot>$([MSBuild]::NormalizeDirectory($(HelixArchiveRoot), 'runonly'))</HelixArchiveRunOnlyRoot> | ||
| <HelixArchiveRunOnlyAppsDir>$([MSBuild]::NormalizeDirectory($(HelixArchiveRunOnlyRoot), $(OSPlatformConfig), $(WasmHelixTestAppRelativeDir)))</HelixArchiveRunOnlyAppsDir> | ||
| <ZippedApp>$(OutputPath)$(AssemblyName).zip</ZippedApp> | ||
| </PropertyGroup> | ||
| <ZipDirectory SourceDirectory="$(WasmAppDir)" DestinationFile="$(ZippedApp)" /> | ||
| <Copy SourceFiles="$(ZippedApp)" DestinationFolder="$(HelixArchiveRunOnlyAppsDir)" /> | ||
| </Target> | ||
| </Project> | ||
Uh oh!
There was an error while loading. Please reload this page.