Skip to content

Commit

Permalink
[build] Add support for NDK r23. (#6073)
Browse files Browse the repository at this point in the history
Context: https://github.com/android/ndk/wiki/Changelog-r23#changelog

The most important changes for Xamarin.Android:

NDK r23 removes GNU Binutils and so we need to switch to using our
bundled copy of them.

Upstream NDK r23changes:

  * Includes Android 12/API-31 APIs.

  * Updated LLVM to clang-r416183b, based on LLVM 12 development.
    * [Issue 1047]: Fixes crash when using ASan with the CFI unwinder.
    * [Issue 1096]: Includes support for [Polly].
      Enable by adding `-mllvm -polly` to your cflags.
    * [Issue 1230]: LLVM's `libunwind` is now used instead of `libgcc`
      for all architectures rather than just 32-bit ARM.
    * [Issue 1231]: LLVM's `libclang_rt.builtins` is now used instead
      of `libgcc`.
    * [Issue 1406]: Fixes crash with Neon intrinsic.

  * Vulkan validation layer source and binaries are no longer shipped
    in the NDK.  The latest are now posted directly to
    [KhronosGroup/Vulkan-ValidationLayers].

  * Vulkan tools source is also removed, specifically `vulkan_wrapper`.
    It should be downloaded upstream from [KhronosGroup/Vulkan-Tools].

  * Refactored the toolchain file `android.toolchain.cmake`, basing
    it on CMake's integrated Android support.  This new toolchain file
    will be enabled by default for CMake 3.21 and newer.
    No user side change is expected.  But if anything goes wrong,
    please file a bug and set `ANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON`
    to restore the legacy behavior.
      * When using the new behavior (when using CMake 3.21+ and not
        explicitly selecting the legacy toolchain),
        **default build flags may change**.  One of the primary goals
        was to reduce the behavior differences between our toolchain
        and CMake, and CMake's default flags do not always match the
        legacy toolchain file.  Most notably, if using
        `CMAKE_BUILD_TYPE=Release`, your optimization type will likely
        be `-O3` instead of `-O2` or `-Oz`.
        See [Issue 1536] for more information.

  * [Issue 929]: `find_library` now prefers shared libraries from the
    sysroot over static libraries.

  * [Issue 1390]: `ndk-build` now warns when building a static
    executable with the wrong API level.

  * [Issue 1452]: `NDK_ANALYZE=1` now sets `APP_CLANG_TIDY=true` rather
    than using `scan-build`.  `clang-tidy` performs all the same checks
    by default, and `scan-build` was no longer working.
    See [Issue 1452] for more details; no user-side changes should
    be needed.

[Issue 929]: android/ndk#929
[Issue 1047]: android/ndk#1047
[Issue 1096]: android/ndk#1096
[Issue 1230]: android/ndk#1230
[Issue 1231]: android/ndk#1231
[Issue 1390]: android/ndk#1390
[Issue 1406]: android/ndk#1406
[Issue 1452]: android/ndk#1452
[Issue 1536]: android/ndk#1536
[Polly]: https://polly.llvm.org/
[KhronosGroup/Vulkan-ValidationLayers]: https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases
[KhronosGroup/Vulkan-Tools]: https://github.com/KhronosGroup/Vulkan-Tools
  • Loading branch information
grendello committed Aug 31, 2021
1 parent a5d2eed commit f361d99
Show file tree
Hide file tree
Showing 23 changed files with 3,640 additions and 3,583 deletions.
8 changes: 4 additions & 4 deletions Documentation/guides/building-apps/build-properties.md
Expand Up @@ -129,14 +129,14 @@ Added in Xamarin.Android 6.1.

A path to a directory containing
the Android [binutils][binutils] such as `ld`, the native linker,
and `as`, the native assembler. These tools are part of the Android
NDK and are also included in the Xamarin.Android installation.
and `as`, the native assembler. These tools are included in the
Xamarin.Android installation.

The default value is `$(MonoAndroidBinDirectory)\ndk\`.
The default value is `$(MonoAndroidBinDirectory)\binutils\`.

Added in Xamarin.Android 10.0.

[binutils]: https://android.googlesource.com/toolchain/binutils/
[binutils]: https://github.com/xamarin/xamarin-android-binutils/

## AndroidBoundExceptionType

Expand Down
48 changes: 24 additions & 24 deletions build-tools/installers/create-installers.targets
Expand Up @@ -310,18 +310,18 @@
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\lib64\libZipSharpNative.pdb" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\proguard\bin\proguard.bat" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\aapt2.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\aarch64-linux-android-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\aarch64-linux-android-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\aarch64-linux-android-strip.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\arm-linux-androideabi-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\arm-linux-androideabi-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\arm-linux-androideabi-strip.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\i686-linux-android-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\i686-linux-android-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\i686-linux-android-strip.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\x86_64-linux-android-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\x86_64-linux-android-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\ndk\x86_64-linux-android-strip.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\aarch64-linux-android-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\aarch64-linux-android-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\aarch64-linux-android-strip.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\arm-linux-androideabi-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\arm-linux-androideabi-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\arm-linux-androideabi-strip.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\i686-linux-android-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\i686-linux-android-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\i686-linux-android-strip.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\x86_64-linux-android-as.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\x86_64-linux-android-ld.exe" />
<_MSBuildFilesWin Include="$(MSBuildSrcDir)\binutils\x86_64-linux-android-strip.exe" />
<_MSBuildLibHostFilesWin Include="$(MSBuildSrcDir)\lib\host-mxe-Win64\libmono-android.debug.dll" Condition=" '$(HostOS)' != 'Windows' " />
<_MSBuildLibHostFilesWin Include="$(MSBuildSrcDir)\lib\host-mxe-Win64\libmono-android.release.dll" Condition=" '$(HostOS)' != 'Windows' " />
<_MSBuildLibHostFilesWin Include="$(MSBuildSrcDir)\lib\host-mxe-Win64\libMonoPosixHelper.dll" />
Expand All @@ -341,18 +341,18 @@
</_MSBuildFilesUnixSignAndHarden>
</ItemDefinitionGroup>
<ItemGroup>
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\aarch64-linux-android-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\aarch64-linux-android-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\aarch64-linux-android-strip" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\arm-linux-androideabi-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\arm-linux-androideabi-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\arm-linux-androideabi-strip" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\i686-linux-android-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\i686-linux-android-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\i686-linux-android-strip" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\x86_64-linux-android-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\x86_64-linux-android-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\ndk\x86_64-linux-android-strip" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\aarch64-linux-android-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\aarch64-linux-android-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\aarch64-linux-android-strip" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\arm-linux-androideabi-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\arm-linux-androideabi-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\arm-linux-androideabi-strip" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\i686-linux-android-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\i686-linux-android-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\i686-linux-android-strip" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\x86_64-linux-android-as" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\x86_64-linux-android-ld" />
<_MSBuildFilesUnixSignAndHarden Include="$(MSBuildSrcDir)\$(HostOS)\binutils\x86_64-linux-android-strip" />
<_MSBuildFilesUnix Include="$(MSBuildSrcDir)\$(HostOS)\illinkanalyzer" Permission="755" />
<_MSBuildFilesUnix Include="$(MSBuildSrcDir)\$(HostOS)\jit-times" Permission="755" />
<_MSBuildFilesUnix Include="$(MSBuildSrcDir)\$(HostOS)\aprofutil" ExcludeFromAndroidNETSdk="true" />
Expand Down
5 changes: 3 additions & 2 deletions build-tools/xaprepare/xaprepare/Application/BuildInfo.cs
Expand Up @@ -18,6 +18,7 @@ partial class BuildInfo : AppObject
public string NDKVersionMajor { get; private set; } = String.Empty;
public string NDKVersionMinor { get; private set; } = String.Empty;
public string NDKVersionMicro { get; private set; } = String.Empty;
public string NDKVersionTag { get; private set; } = String.Empty;
public string NDKMinimumApiAvailable { get; private set; } = String.Empty;

public string VersionHash { get; private set; } = String.Empty;
Expand Down Expand Up @@ -59,15 +60,15 @@ public bool GatherNDKInfo (Context context)
string rev = parts [1].Trim ();
NDKRevision = rev;

Version ver;
if (!Version.TryParse (rev, out ver)) {
if (!Utilities.ParseAndroidPkgRevision (rev, out Version? ver, out string tag)) {
Log.ErrorLine ($"Unable to parse NDK revision '{rev}' as a valid version string");
return false;
}

NDKVersionMajor = ver.Major.ToString ();
NDKVersionMinor = ver.Minor.ToString ();
NDKVersionMicro = ver.Build.ToString ();
NDKVersionTag = tag;
break;
}

Expand Down
Expand Up @@ -24,7 +24,7 @@ public override void Init (Context context)
OutputMonoBtlsFilename = Configurables.Defaults.MonoRuntimeOutputMonoBtlsFilename;
OutputMonoPosixHelperFilename = Configurables.Defaults.MonoRuntimeOutputMonoPosixHelperFilename;
OutputProfilerFilename = Configurables.Defaults.MonoRuntimeOutputProfilerFilename;
Strip = Path.Combine (Configurables.Paths.AndroidToolchainBinDirectory, $"{Configurables.Defaults.AndroidToolchainPrefixes [Name]}-strip");
Strip = Path.Combine (Configurables.Paths.AndroidToolchainBinDirectory, "llvm-strip");
}
}
}
23 changes: 23 additions & 0 deletions build-tools/xaprepare/xaprepare/Application/Utilities.cs
Expand Up @@ -29,6 +29,29 @@ static partial class Utilities

public static readonly Encoding UTF8NoBOM = new UTF8Encoding (false);

public static bool ParseAndroidPkgRevision (string? v, out Version? version, out string? tag)
{
string? ver = v?.Trim ();
version = null;
tag = null;
if (String.IsNullOrEmpty (ver))
return false;

if (ver!.IndexOf ('.') < 0)
ver = $"{ver}.0";

int tagIdx = ver.IndexOf ('-');
if (tagIdx >= 0) {
tag = ver.Substring (tagIdx + 1);
ver = ver.Substring (0, tagIdx - 1);
}

if (Version.TryParse (ver, out version))
return true;

return false;
}

public static bool AbiChoiceChanged (Context context)
{
string cacheFile = Configurables.Paths.MonoRuntimesEnabledAbisCachePath;
Expand Down
Expand Up @@ -5,8 +5,8 @@ namespace Xamarin.Android.Prepare
{
class BuildAndroidPlatforms
{
public const string AndroidNdkVersion = "22b";
public const string AndroidNdkPkgRevision = "22.1.7171670";
public const string AndroidNdkVersion = "23";
public const string AndroidNdkPkgRevision = "23.0.7599858";

public static readonly List<AndroidPlatform> AllPlatforms = new List<AndroidPlatform> {
new AndroidPlatform (apiName: "", apiLevel: 1, platformID: "1"),
Expand Down
Expand Up @@ -398,8 +398,8 @@ public static partial class Paths
public static string AndroidToolchainRootDirectory => GetCachedPath (ref androidToolchainRootDirectory, () => Path.Combine (AndroidNdkDirectory, "toolchains", "llvm", "prebuilt", NdkToolchainOSTag));
public static string AndroidToolchainBinDirectory => GetCachedPath (ref androidToolchainBinDirectory, () => Path.Combine (AndroidToolchainRootDirectory, "bin"));
public static string AndroidToolchainSysrootLibDirectory => GetCachedPath (ref androidToolchainSysrootLibDirectory, () => Path.Combine (AndroidToolchainRootDirectory, "sysroot", "usr", "lib"));
public static string WindowsBinutilsInstallDir => GetCachedPath (ref windowsBinutilsInstallDir, () => Path.Combine (InstallMSBuildDir, "ndk"));
public static string HostBinutilsInstallDir => GetCachedPath (ref hostBinutilsInstallDir, () => Path.Combine (InstallMSBuildDir, ctx.Properties.GetRequiredValue (KnownProperties.HostOS), "ndk"));
public static string WindowsBinutilsInstallDir => GetCachedPath (ref windowsBinutilsInstallDir, () => Path.Combine (InstallMSBuildDir, "binutils"));
public static string HostBinutilsInstallDir => GetCachedPath (ref hostBinutilsInstallDir, () => Path.Combine (InstallMSBuildDir, ctx.Properties.GetRequiredValue (KnownProperties.HostOS), "binutils"));
public static string BinutilsCacheDir => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory);
public static string AndroidBuildToolsCacheDir => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory);

Expand Down
Expand Up @@ -69,7 +69,7 @@ public AndroidToolchain ()
new AndroidToolchainComponent ("docs-24_r01", destDir: "docs", pkgRevision: "1", dependencyType: AndroidToolchainComponentType.BuildDependency),
new AndroidToolchainComponent ("android_m2repository_r47", destDir: Path.Combine ("extras", "android", "m2repository"), pkgRevision: "47.0.0", dependencyType: AndroidToolchainComponentType.BuildDependency),
new AndroidToolchainComponent ($"x86_64-29_r07-{osTag}", destDir: Path.Combine ("system-images", "android-29", "default", "x86_64"), relativeUrl: new Uri ("sys-img/android/", UriKind.Relative), pkgRevision: "7", dependencyType: AndroidToolchainComponentType.EmulatorDependency),
new AndroidToolchainComponent ($"android-ndk-r{AndroidNdkVersion}-{osTag}-x86_64", destDir: AndroidNdkDirectory, pkgRevision: AndroidPkgRevision),
new AndroidToolchainComponent ($"android-ndk-r{AndroidNdkVersion}-{osTag}", destDir: AndroidNdkDirectory, pkgRevision: AndroidPkgRevision),
new AndroidToolchainComponent ($"{XABuildToolsPackagePrefix}build-tools_r{XABuildToolsVersion}-{altOsTag}", destDir: Path.Combine ("build-tools", XABuildToolsFolder), isMultiVersion: true),
new AndroidToolchainComponent ($"commandlinetools-{cltOsTag}-{CommandLineToolsVersion}",
destDir: Path.Combine ("cmdline-tools", CommandLineToolsFolder), isMultiVersion: true),
Expand Down
24 changes: 4 additions & 20 deletions build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs
Expand Up @@ -307,37 +307,21 @@ bool IsInstalled (AndroidToolchainComponent component, string path, out bool mis
return false;
}

if (!ParseVersion (pkgRevision, out Version? pkgVer) || pkgVer == null) {
if (!Utilities.ParseAndroidPkgRevision (pkgRevision, out Version? pkgVer, out string pkgTag) || pkgVer == null) {
Log.DebugLine ($"Failed to parse a valid version from Pkg.Revision ({pkgRevision}) for component '{component.Name}'. Component will be reinstalled.");
return false;
}

if (!ParseVersion (component.PkgRevision, out Version? expectedPkgVer) || expectedPkgVer == null)
if (!Utilities.ParseAndroidPkgRevision (component.PkgRevision, out Version? expectedPkgVer, out string expectedTag) || expectedPkgVer == null)
throw new InvalidOperationException ($"Invalid expected package version for component '{component.Name}': {component.PkgRevision}");

bool equal = pkgVer == expectedPkgVer;
bool equal = (pkgVer == expectedPkgVer) && (pkgTag == expectedTag);
if (!equal)
Log.DebugLine ($"Installed version of '{component.Name}' ({pkgVer}) is different than the required one ({expectedPkgVer})");
Log.DebugLine ($"Installed version of '{component.Name}' ({pkgRevision}) is different than the required one ({component.PkgRevision})");

return equal;
}

bool ParseVersion (string? v, out Version? version)
{
string? ver = v?.Trim ();
version = null;
if (String.IsNullOrEmpty (ver))
return false;

if (ver!.IndexOf ('.') < 0)
ver = $"{ver}.0";

if (Version.TryParse (ver, out version))
return true;

return false;
}

bool IsNdk (AndroidToolchainComponent component)
{
return component.Name.StartsWith ("android-ndk", StringComparison.OrdinalIgnoreCase);
Expand Down
18 changes: 13 additions & 5 deletions src/Xamarin.Android.Build.Tasks/Tasks/GetAotArguments.cs
Expand Up @@ -312,14 +312,20 @@ string GetLdFlags(NdkTools ndk, AndroidTargetArch arch, int level, string toolPr
}

string toolchainLibDir;
if (ndk.UsesClang)
toolchainLibDir = GetNdkToolchainLibraryDir (ndk, toolchainPath, arch);
else
if (ndk.UsesClang) {
if (ndk.NoBinutils) {
toolchainLibDir = String.Empty;
} else {
toolchainLibDir = GetNdkToolchainLibraryDir (ndk, toolchainPath, arch);
}
} else
toolchainLibDir = GetNdkToolchainLibraryDir (ndk, toolchainPath);

var libs = new List<string> ();
if (ndk.UsesClang) {
libs.Add ($"-L{toolchainLibDir.TrimEnd ('\\')}");
if (!String.IsNullOrEmpty (toolchainLibDir)) {
libs.Add ($"-L{toolchainLibDir.TrimEnd ('\\')}");
}
libs.Add ($"-L{androidLibPath.TrimEnd ('\\')}");

if (arch == AndroidTargetArch.Arm) {
Expand All @@ -329,7 +335,9 @@ string GetLdFlags(NdkTools ndk, AndroidTargetArch arch, int level, string toolPr
}
}

libs.Add (Path.Combine (toolchainLibDir, "libgcc.a"));
if (!String.IsNullOrEmpty (toolchainLibDir)) {
libs.Add (Path.Combine (toolchainLibDir, "libgcc.a"));
}
libs.Add (Path.Combine (androidLibPath, "libc.so"));
libs.Add (Path.Combine (androidLibPath, "libm.so"));

Expand Down
15 changes: 7 additions & 8 deletions src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs
@@ -1,23 +1,23 @@
//
//
// ResolveSdksTask.cs
//
//
// Author:
// Michael Hutchinson <mhutchinson@novell.com>
// Jonathan Pryor <jonp@xamarin.com>
//
//
// Copyright (c) 2010 Novell, Inc.
// Copyright (c) 2013 Xamarin Inc.
//
//
// 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
Expand Down Expand Up @@ -85,7 +85,7 @@ public override bool RunTask ()
}
MonoAndroidBinPath = MonoAndroidHelper.GetOSBinPath () + Path.DirectorySeparatorChar;
MonoAndroidLibPath = MonoAndroidHelper.GetOSLibPath () + Path.DirectorySeparatorChar;
AndroidBinUtilsPath = MonoAndroidBinPath + "ndk" + Path.DirectorySeparatorChar;
AndroidBinUtilsPath = MonoAndroidBinPath + "binutils" + Path.DirectorySeparatorChar;

var minVersion = Version.Parse (MinimumSupportedJavaVersion);
var maxVersion = Version.Parse (LatestSupportedJavaVersion);
Expand Down Expand Up @@ -139,4 +139,3 @@ public override bool RunTask ()
}
}
}

Expand Up @@ -34,6 +34,7 @@ public void TestNdkUtil ()
var ndkDir = AndroidNdkPath;
var sdkDir = AndroidSdkPath;
NdkTools ndk = NdkTools.Create (ndkDir, log);
ndk.OSBinPath = SetUp.OSBinDirectory;
MonoAndroidHelper.AndroidSdk = new AndroidSdkInfo ((arg1, arg2) => { }, sdkDir, ndkDir, AndroidSdkResolver.GetJavaSdkPath ());
var platforms = ndk.GetSupportedPlatforms ();
Assert.AreNotEqual (0, platforms.Count (), "No platforms found");
Expand Down
Expand Up @@ -42,6 +42,11 @@ public class SetUp {
private set;
}

public static string OSBinDirectory {
get;
private set;
}

static SetUp ()
{
#if NETCOREAPP
Expand All @@ -54,6 +59,16 @@ static SetUp ()
CommercialBuildAvailable = File.Exists (Path.Combine (builder.AndroidMSBuildDirectory, "Xamarin.Android.Common.Debugging.targets"));
AndroidMSBuildDirectory = builder.AndroidMSBuildDirectory;
}

string osSubdirName;
if (TestEnvironment.IsLinux) {
osSubdirName = "Linux";
} else if (TestEnvironment.IsMacOS) {
osSubdirName = "Darwin";
} else {
osSubdirName = String.Empty;
}
OSBinDirectory = Path.Combine (AndroidMSBuildDirectory, osSubdirName);
}

[OneTimeSetUp]
Expand Down
Expand Up @@ -2,25 +2,25 @@
"Comment": null,
"Entries": {
"AndroidManifest.xml": {
"Size": 2584
"Size": 2604
},
"assemblies/Java.Interop.dll": {
"Size": 67759
},
"assemblies/Mono.Android.dll": {
"Size": 251450
"Size": 251399
},
"assemblies/mscorlib.dll": {
"Size": 769324
},
"assemblies/System.Core.dll": {
"Size": 28186
"Size": 28187
},
"assemblies/System.dll": {
"Size": 9171
},
"assemblies/UnnamedProject.dll": {
"Size": 2867
"Size": 2866
},
"classes.dex": {
"Size": 345208
Expand All @@ -32,13 +32,13 @@
"Size": 707024
},
"lib/arm64-v8a/libmonodroid.so": {
"Size": 282936
"Size": 286736
},
"lib/arm64-v8a/libmonosgen-2.0.so": {
"Size": 4037584
},
"lib/arm64-v8a/libxa-internal-api.so": {
"Size": 65496
"Size": 65624
},
"lib/arm64-v8a/libxamarin-app.so": {
"Size": 20032
Expand Down Expand Up @@ -74,5 +74,5 @@
"Size": 1724
}
},
"PackageSize": 3978964
"PackageSize": 3983060
}

0 comments on commit f361d99

Please sign in to comment.