Skip to content

Commit

Permalink
[monodroid] Build the Xamarin.Android runtime for net6
Browse files Browse the repository at this point in the history
This commit makes changes to build the native Xamarin.Android runtime
against Mono VM shipped from the `dotnet/runtime` repository in nuget
packages which also contain header files necessary to embed Mono in
Xamarin.Android.

Xamarin.Android runtime is now built separately for the "legacy" target,
using Mono from the SDK archives, and for net6.  This change required
introduction of new target directories in `$XA_INSTALL_ROOT/lib`:

  * arm64-v8a-net6
  * armeabi-v7a-net6
  * x86_64-net6
  * x86-net6

These directories now contain only the shared libraries together
comprising the Xamarin.Android runtime:

  * libmono-android.*.so
  * libxamarin-debug-app-helper*.so
  * libxamarin-app.so

Mono runtime libraries are not copied from their respective nuget
packages.  Compared to the "legacy" builds, we are missing the
`libMonoPosixHelper.so` library.  The helper DSO will be eventually
placed in a `Mono.Posix` nuget, once we are able to separate
`Mono.Posix` files from the Mono sources and place them in a separate
repository.

`xaprepare` is modified to generate MSBuild and cmake fragments
responsible for building net6 runtime binaries.

Native runtime now doesn't export any p/invoke entry points, instead it
uses the new `PINVOKE_OVERRIDE` mechanism to handle the p/invoke
dispatch internally.  This allows us to not only hide the public
symbols, but also remove the `libxa-internal-api.so` library completely.
  • Loading branch information
grendello committed Mar 2, 2021
1 parent f66356e commit 3ed9431
Show file tree
Hide file tree
Showing 48 changed files with 2,044 additions and 250 deletions.
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xamarin/monodroid:main@2e93b630e47701dae56f426fe5934846d571832b
xamarin/monodroid:main@dade1f497271f3ae5ceb1fe8c6c672b399a369ec
mono/mono:2020-02@c66141a8c7ba2566c578c2dd012b2b723e006213
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@
path = external/xamarin-android-tools
url = https://github.com/xamarin/xamarin-android-tools
branch = main
[submodule "external/robin-map"]
path = external/robin-map
url = https://github.com/Tessil/robin-map.git
branch = master
3 changes: 3 additions & 0 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@
<DotNetPreviewPath Condition=" '$(DotNetPreviewPath)' == '' ">$(AndroidToolchainDirectory)\dotnet\</DotNetPreviewPath>
<DotNetPreviewTool Condition=" '$(DotNetPreviewTool)' == '' ">$(DotNetPreviewPath)dotnet</DotNetPreviewTool>
<!-- Version number from: https://github.com/dotnet/installer#installers-and-binaries -->
<!-- Please update DotNetRuntimePacksVersion below accordingly -->
<DotNetPreviewVersionBand Condition=" '$(DotNetPreviewVersionBand)' == '' ">6.0.100</DotNetPreviewVersionBand>
<DotNetPreviewVersionFull Condition=" '$(DotNetPreviewVersionFull)' == '' ">$(DotNetPreviewVersionBand)-preview.1.21109.8</DotNetPreviewVersionFull>
<!-- This version comes from the a file in the dotnet distribution: sdk/$(DotNetPreviewVersionFull)/dotnet.runtimeconfig.json (the `runtimeOptions/framework/version key`) -->
<DotNetRuntimePacksVersion Condition=" '$(DotNetRuntimePacksVersion)' == '' ">6.0.0-preview.2.21108.2</DotNetRuntimePacksVersion>
<ILLinkVersionBand Condition=" '$(ILLinkVersionBand)' == '' ">6.0.0</ILLinkVersionBand>
<ILLinkVersionFull Condition=" '$(ILLinkVersionFull)' == '' ">$(ILLinkVersionBand)-alpha.1.21109.1</ILLinkVersionFull>
<WixToolPath Condition=" '$(WixToolPath)' == '' ">$(AndroidToolchainDirectory)\wix\</WixToolPath>
Expand Down
29 changes: 29 additions & 0 deletions ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The attached notices are provided for information only.
2. bazelbuild/bazel (https://github.com/bazelbuild/bazel/)
3. force-net/crc32.net (https://github.com/force-net/Crc32.NET)
4. nunit/nunitlite (https://github.com/nunit/nunitlite/)
5. tessil/robin-map (https://github.com/Tessil/robin-map)

%% android/platform/tools/base NOTICES AND INFORMATION BEGIN HERE
=================================================================
Expand Down Expand Up @@ -487,3 +488,31 @@ THE SOFTWARE.
=====================================================
END OF nunit/nunitlite NOTICES AND INFORMATION

%% tessil/robin-map NOTICES AND INFORMATION BEGIN HERE
======================================================
MIT License

Copyright (c) 2017 Thibaut Goetghebuer-Planchon <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


======================================================
END OF tessil/robin-map NOTICES AND INFORMATION

2 changes: 1 addition & 1 deletion build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ variables:
TestAssembliesArtifactName: test-assemblies
NUnitConsoleVersion: 3.11.1
DotNetCoreVersion: 3.1.405
DotNet5Version: 5.0.100
DotNet5Version: 5.0.200
HostedMacImage: macOS-10.15
HostedWinVS2019: Hosted Windows 2019 with VS2019
VSEngWinVS2019: Xamarin-Android-Win2019-1120
Expand Down
8 changes: 4 additions & 4 deletions build-tools/create-packs/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
<Target Name="CreateAllPacks"
DependsOnTargets="BuildILLinkCustomStep;DeleteExtractedWorkloadPacks;_SetGlobalProperties">
<RemoveDir Directories="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm -p:AndroidABI=armeabi-v7a &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm64 -p:AndroidABI=arm64-v8a &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-x86 -p:AndroidABI=x86 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-x64 -p:AndroidABI=x86_64 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm -p:AndroidABI=armeabi-v7a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm64 -p:AndroidABI=arm64-v8a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-x86 -p:AndroidABI=x86-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidRID=android-x64 -p:AndroidABI=x86_64-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidHostRID=linux-x64 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Sdk.proj&quot;" Condition=" '$(HostOS)' == 'Linux' " />
<Exec Command="$(DotNetPreviewTool) pack @(_GlobalProperties, ' ') -p:AndroidHostRID=osx-x64 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Sdk.proj&quot;" Condition=" '$(HostOS)' == 'Darwin' " />
Expand Down
3 changes: 1 addition & 2 deletions build-tools/create-packs/Microsoft.Android.Runtime.proj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ projects that use the Microsoft.Android framework in .NET 5.

<PropertyGroup>
<AndroidRID Condition=" '$(AndroidRID)' == '' ">android-arm64</AndroidRID>
<AndroidABI Condition=" '$(AndroidABI)' == '' ">arm64-v8a</AndroidABI>
<AndroidABI Condition=" '$(AndroidABI)' == '' ">arm64-v8a-net6</AndroidABI>
<PackageId>Microsoft.Android.Runtime.$(AndroidRID)</PackageId>
<Description>Microsoft.Android runtime components. Please do not reference directly.</Description>
<_AndroidRuntimePackAssemblyPath>runtimes\$(AndroidRID)\lib\net6.0</_AndroidRuntimePackAssemblyPath>
Expand Down Expand Up @@ -39,7 +39,6 @@ projects that use the Microsoft.Android framework in .NET 5.
<_AndroidRuntimePackAssemblies Include="$(_MonoAndroidNETOutputDir)Mono.Android.Export.dll" />
<_AndroidRuntimePackAssets Include="$(XAInstallPrefix)xbuild\Xamarin\Android\lib\$(AndroidABI)\libmono-android.debug.so" />
<_AndroidRuntimePackAssets Include="$(XAInstallPrefix)xbuild\Xamarin\Android\lib\$(AndroidABI)\libmono-android.release.so" />
<_AndroidRuntimePackAssets Include="$(XAInstallPrefix)xbuild\Xamarin\Android\lib\$(AndroidABI)\libxa-internal-api.so" />
<_AndroidRuntimePackAssets Include="$(XAInstallPrefix)xbuild\Xamarin\Android\lib\$(AndroidABI)\libxamarin-debug-app-helper.so" />
<FrameworkListFileClass Include="@(_AndroidRuntimePackAssemblies->'%(Filename)%(Extension)')" Profile="Android" />
<FrameworkListFileClass Include="@(_AndroidRuntimePackAssets->'%(Filename)%(Extension)')" Profile="Android" />
Expand Down
4 changes: 4 additions & 0 deletions build-tools/create-pkg/create-pkg.targets
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<MSBuildFrameworksDir>$(XAFrameworkDir)\lib\xamarin.android\xbuild-frameworks\MonoAndroid</MSBuildFrameworksDir>
</PropertyGroup>
<RemoveDir Directories="$(PayloadDir)" />
<ItemGroup>
<!-- Remove items with '%(ExcludeFromLegacy)' == 'true' metadata -->
<MSBuildItemsUnix Remove="@(MSBuildItemsUnix)" Condition=" '%(MSBuildItemsUnix.ExcludeFromLegacy)' == 'true' " />
</ItemGroup>
<Copy
SourceFiles="@(FrameworkItemsUnix)"
DestinationFiles="@(FrameworkItemsUnix->'$(MSBuildFrameworksDir)\%(RelativePath)')"
Expand Down
2 changes: 2 additions & 0 deletions build-tools/create-vsix/create-vsix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<ReferenceAssemblies Include="@(FrameworkItemsWin)" >
<VSIXSubPath>Microsoft/Framework/MonoAndroid/$([System.IO.Path]::GetDirectoryName(%(RelativePath)))</VSIXSubPath>
</ReferenceAssemblies>
<!-- Remove items with '%(ExcludeFromLegacy)' == 'true' metadata -->
<MSBuildItemsWin Remove="@(MSBuildItemsWin)" Condition=" '%(MSBuildItemsWin.ExcludeFromLegacy)' == 'true' " />
<MSBuild Include="@(MSBuildItemsWin)" >
<VSIXSubPath>Xamarin/Android/$([System.IO.Path]::GetDirectoryName(%(RelativePath)))</VSIXSubPath>
</MSBuild>
Expand Down
12 changes: 8 additions & 4 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,14 @@
<_MSBuildFiles Include="$(MSBuildSrcDir)\startup-xf.aotprofile" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\r8.jar" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\bundletool.jar" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime.jar" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_fastdev.jar" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime.dex" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_fastdev.dex" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime.jar" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_fastdev.jar" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime.dex" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_fastdev.dex" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_net6.jar" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_fastdev_net6.jar" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_net6.dex" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\java_runtime_fastdev_net6.dex" ExcludeFromLegacy="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\manifestmerger.jar" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\protobuf-net.dll" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\SgmlReaderDll.dll" />
Expand Down
8 changes: 8 additions & 0 deletions build-tools/scripts/Ndk.projitems.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,42 @@
<PropertyGroup>
<AndroidNdkVersion Condition=" '$(AndroidNdkVersion)' == '' ">@NDK_RELEASE@</AndroidNdkVersion>
<AndroidNdkApiLevel_ArmV7a Condition=" '$(AndroidNdkApiLevel_ArmV7a)' == '' ">@NDK_ARMEABI_V7_API@</AndroidNdkApiLevel_ArmV7a>
<AndroidNdkApiLevel_ArmV7a_NET6 Condition=" '$(AndroidNdkApiLevel_ArmV7a_NET6)' == '' ">@NDK_ARMEABI_V7_API_NET6@</AndroidNdkApiLevel_ArmV7a_NET6>
<AndroidNdkApiLevel_ArmV8a Condition=" '$(AndroidNdkApiLevel_ArmV8a)' == '' ">@NDK_ARM64_V8A_API@</AndroidNdkApiLevel_ArmV8a>
<AndroidNdkApiLevel_ArmV8a_NET6 Condition=" '$(AndroidNdkApiLevel_ArmV8a_NET6)' == '' ">@NDK_ARM64_V8A_API_NET6@</AndroidNdkApiLevel_ArmV8a_NET6>
<AndroidNdkApiLevel_X86 Condition=" '$(AndroidNdkApiLevel_X86)' == '' ">@NDK_X86_API@</AndroidNdkApiLevel_X86>
<AndroidNdkApiLevel_X86_NET6 Condition=" '$(AndroidNdkApiLevel_X86_NET6)' == '' ">@NDK_X86_API_NET6@</AndroidNdkApiLevel_X86_NET6>
<AndroidNdkApiLevel_X86_64 Condition=" '$(AndroidNdkApiLevel_X86_64)' == '' ">@NDK_X86_64_API@</AndroidNdkApiLevel_X86_64>
<AndroidNdkApiLevel_X86_64_NET6 Condition=" '$(AndroidNdkApiLevel_X86_64_NET6)' == '' ">@NDK_X86_64_API_NET6@</AndroidNdkApiLevel_X86_64_NET6>
</PropertyGroup>

<ItemGroup>
<AndroidSupportedTargetJitAbi
Include="armeabi-v7a"
Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':armeabi-v7a:')) ">
<ApiLevel>$(AndroidNdkApiLevel_ArmV7a)</ApiLevel>
<ApiLevelNET6>$(AndroidNdkApiLevel_ArmV7a_NET6)</ApiLevelNET6>
</AndroidSupportedTargetJitAbi>

<AndroidSupportedTargetJitAbi
Include="arm64-v8a"
Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':arm64-v8a:')) ">
<ApiLevel>$(AndroidNdkApiLevel_ArmV8a)</ApiLevel>
<ApiLevelNET6>$(AndroidNdkApiLevel_ArmV8a_NET6)</ApiLevelNET6>
</AndroidSupportedTargetJitAbi>

<AndroidSupportedTargetJitAbi
Include="x86"
Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':x86:')) ">
<ApiLevel>$(AndroidNdkApiLevel_X86)</ApiLevel>
<ApiLevelNET6>$(AndroidNdkApiLevel_X86_NET6)</ApiLevelNET6>
</AndroidSupportedTargetJitAbi>

<AndroidSupportedTargetJitAbi
Include="x86_64"
Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':x86_64:')) ">
<ApiLevel>$(AndroidNdkApiLevel_X86_64)</ApiLevel>
<ApiLevelNET6>$(AndroidNdkApiLevel_X86_64_NET6)</ApiLevelNET6>
</AndroidSupportedTargetJitAbi>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions build-tools/scripts/xa_build_configuration.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(NETCORE_APP_RUNTIME_DIR_ARM "@NETCORE_APP_RUNTIME_ANDROID_ARM@")
set(NETCORE_APP_RUNTIME_DIR_ARM64 "@NETCORE_APP_RUNTIME_ANDROID_ARM64@")
set(NETCORE_APP_RUNTIME_DIR_X86 "@NETCORE_APP_RUNTIME_ANDROID_X86@")
set(NETCORE_APP_RUNTIME_DIR_X86_64 "@NETCORE_APP_RUNTIME_ANDROID_X86_64@")
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,20 @@ public override void Generate (Context context)

static readonly Dictionary<string, string> ApiLevelVariableNames = new Dictionary<string, string> (StringComparer.Ordinal) {
{ AbiNames.TargetJit.AndroidArmV7a, "NDK_LEGACY_API_ARMV7A" },
{ BuildAndroidPlatforms.AndroidArmV7a_NET6, "NDK_NET6_API_ARMV7A" },
{ AbiNames.TargetJit.AndroidArmV8a, "NDK_LEGACY_API_ARMV8A" },
{ BuildAndroidPlatforms.AndroidArmV8a_NET6, "NDK_NET6_API_ARMV8A" },
{ AbiNames.TargetJit.AndroidX86, "NDK_LEGACY_API_X86" },
{ BuildAndroidPlatforms.AndroidX86_NET6, "NDK_NET6_API_X86" },
{ AbiNames.TargetJit.AndroidX86_64, "NDK_LEGACY_API_X86_64" },
{ BuildAndroidPlatforms.AndroidX86_64_NET6, "NDK_NET6_API_X86_64" },
};

static readonly Dictionary<string, string> JitAbis = new Dictionary<string, string> (StringComparer.Ordinal) {
{ AbiNames.TargetJit.AndroidArmV7a, String.Empty },
{ AbiNames.TargetJit.AndroidArmV8a, String.Empty },
{ AbiNames.TargetJit.AndroidX86, String.Empty },
{ AbiNames.TargetJit.AndroidX86_64, String.Empty },
{ AbiNames.TargetJit.AndroidArmV7a, BuildAndroidPlatforms.AndroidArmV7a_NET6 },
{ AbiNames.TargetJit.AndroidArmV8a, BuildAndroidPlatforms.AndroidArmV8a_NET6 },
{ AbiNames.TargetJit.AndroidX86, BuildAndroidPlatforms.AndroidX86_NET6 },
{ AbiNames.TargetJit.AndroidX86_64, BuildAndroidPlatforms.AndroidX86_64_NET6 },
};

static readonly Dictionary<string, string> HostAbis = new Dictionary<string, string> (StringComparer.Ordinal) {
Expand Down Expand Up @@ -107,9 +111,13 @@ void GenerateShellConfig (Context context, StreamWriter sw)
sw.WriteLine ();

WriteApiLevelVariable (AbiNames.TargetJit.AndroidArmV7a);
WriteApiLevelVariable (BuildAndroidPlatforms.AndroidArmV7a_NET6);
WriteApiLevelVariable (AbiNames.TargetJit.AndroidArmV8a);
WriteApiLevelVariable (BuildAndroidPlatforms.AndroidArmV8a_NET6);
WriteApiLevelVariable (AbiNames.TargetJit.AndroidX86);
WriteApiLevelVariable (BuildAndroidPlatforms.AndroidX86_NET6);
WriteApiLevelVariable (AbiNames.TargetJit.AndroidX86_64);
WriteApiLevelVariable (BuildAndroidPlatforms.AndroidX86_64_NET6);
sw.WriteLine ();

string indent = "\t";
Expand Down Expand Up @@ -240,8 +248,8 @@ void WriteShellRuntimeCommand (StreamWriter sw, Dictionary<string, string> abis,

foreach (var kvp in abis) {
string abi = kvp.Key;
string apiLevelVarName = kvp.Key;
string outputDirName = abi;
string apiLevelVarName = command.IsNet6 ? kvp.Value : kvp.Key;
string outputDirName = command.IsNet6 ? $"{abi}-net6" : abi;
string isMxe = "no";
string mxeBitness = String.Empty;
bool forMxe = false;
Expand Down Expand Up @@ -353,7 +361,6 @@ void GenerateMonodroidTargets (Context context, StreamWriter sw)
{ "@NATIVE_API_LEVEL@", "" },
{ "@ABI@", "%(AndroidSupportedTargetJitAbi.Identity)" },
{ "@OUTPUT_DIRECTORY@", "" },

};

var hostRuntimeReplacements = new Dictionary<string, string> (StringComparer.Ordinal) {
Expand Down Expand Up @@ -419,12 +426,13 @@ string EnsureRequired (string name, string v)
void WriteMSBuildConfigureAndroidRuntimeCommands (StreamWriter sw, string indent, CmakeBuilds.RuntimeCommand command, Dictionary<string, string> replacements)
{
const string LegacyOutputDirectory = "$(OutputPath)%(AndroidSupportedTargetJitAbi.Identity)";
const string Net6OutputDirectory = LegacyOutputDirectory + "-net6";

WriteMSBuildConfigureRuntimeCommands (
sw,
indent,
$"$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.Identity)-{command.Suffix}",
LegacyOutputDirectory,
command.IsNet6 ? Net6OutputDirectory : LegacyOutputDirectory,
"@(AndroidSupportedTargetJitAbi)",
CmakeBuilds.ConfigureAndroidRuntimeCommandsCommonFlags,
command,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ class BuildAndroidPlatforms
new AndroidPlatform (apiName: "S", apiLevel: 31, platformID: "S", include: "v11.0.99", framework: "v11.0.99", stable: false),
};

// These are here until we can drop "legacy" targets and use only .NET6+
public const string AndroidArmV7a_NET6 = AbiNames.TargetJit.AndroidArmV7a + "_NET6";
public const string AndroidArmV8a_NET6 = AbiNames.TargetJit.AndroidArmV8a + "_NET6";
public const string AndroidX86_NET6 = AbiNames.TargetJit.AndroidX86 + "_NET6";
public const string AndroidX86_64_NET6 = AbiNames.TargetJit.AndroidX86_64 + "_NET6";

public static readonly Dictionary<string, uint> NdkMinimumAPI = new Dictionary<string, uint> {
{ AbiNames.TargetJit.AndroidArmV7a, 16 },
{ AbiNames.TargetJit.AndroidArmV8a, 21 },
{ AbiNames.TargetJit.AndroidX86, 16 },
{ AbiNames.TargetJit.AndroidX86_64, 21 },
{ AbiNames.TargetJit.AndroidArmV7a, 16 }, { AndroidArmV7a_NET6, 21 },
{ AbiNames.TargetJit.AndroidArmV8a, 21 }, { AndroidArmV8a_NET6, 21 },
{ AbiNames.TargetJit.AndroidX86, 16 }, { AndroidX86_NET6, 21 },
{ AbiNames.TargetJit.AndroidX86_64, 21 }, { AndroidX86_64_NET6, 21 },
};
}
}
Loading

0 comments on commit 3ed9431

Please sign in to comment.