Skip to content

Commit

Permalink
Build with Android NDK r19
Browse files Browse the repository at this point in the history
  * Update gradle to version 5.1 (the latest version)
  * Update gradle android addin to 3.2.1 (required for r18+ as it removes
    dependency on the MIPS toolchain which no longer exists in r18+)
  * Bump all the instances of `android:minSdkVersion` to `16` since this is the
    lowest NDK API found in NDK r19 and, thus, the lowest API our runtimes can
    run on.
  * Fix AOT build tests by targetting API 16 at the minimum.
  * Introduce the `Xamarin.Android.Tools.XABuildConfig` class, generated at the
    XA build time, which includes all the necessary information about the NDK
    the native runtime was built with.
  * Put NDK and per-architecture mimum API level in
    `Xamarin.Android.Common.props` based on the contents of
    `build-tools/scripts/Ndk.targets`
  * Update SDK build-tools to 28.0.3, the minimum required by the updated
    Android gradle plugin
  * Update SDK emulator to the latest version, because we should always try to
    use the latest version of it (assuming blindly that it gets faster and
    faster and faster and... etc)

Future bumps of NDK versions and per-architecture API levels will require
changing just a single file - `build-tools/scripts/Ndk.targets` - in order to
make the change visible and used by all the other parties.
  • Loading branch information
grendello committed Jan 22, 2019
1 parent 7c9dea8 commit 74ebb89
Show file tree
Hide file tree
Showing 36 changed files with 265 additions and 61 deletions.
11 changes: 5 additions & 6 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<AndroidFrameworkVersion Condition=" '$(AndroidFrameworkVersion)' == '' And '$(_IsRunningNuGetRestore)' != 'True' ">$(AndroidLatestStableFrameworkVersion)</AndroidFrameworkVersion>
<AndroidUseLatestPlatformSdk Condition=" '$(AndroidFrameworkVersion)' == '' And '$(_IsRunningNuGetRestore)' == 'True' ">True</AndroidUseLatestPlatformSdk>
<DebugType Condition=" '$(DebugType)' == '' ">portable</DebugType>
<AndroidNdkApiLevel Condition=" '$(AndroidNdkApiLevel)' == '' ">14</AndroidNdkApiLevel>
</PropertyGroup>
<PropertyGroup>
<AutoProvision Condition=" '$(AutoProvision)' == '' ">False</AutoProvision>
Expand Down Expand Up @@ -87,8 +86,8 @@
<AllSupported32BitTargetAndroidAbis>armeabi-v7a;x86</AllSupported32BitTargetAndroidAbis>
<AllSupported64BitTargetAndroidAbis>arm64-v8a;x86_64</AllSupported64BitTargetAndroidAbis>
<AllSupportedTargetAndroidAbis>$(AllSupported32BitTargetAndroidAbis);$(AllSupported64BitTargetAndroidAbis)</AllSupportedTargetAndroidAbis>
<XABuildToolsVersion>28</XABuildToolsVersion>
<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">28.0.0</XABuildToolsFolder>
<XABuildToolsVersion>28.0.3</XABuildToolsVersion>
<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">28.0.3</XABuildToolsFolder>
<XAPlatformToolsVersion>28.0.0</XAPlatformToolsVersion>
<XAIntegratedTests Condition="'$(XAIntegratedTests)' == ''">False</XAIntegratedTests>
<XAIncludeProprietaryBits Condition="'$(XAIncludeProprietaryBits)' == ''">False</XAIncludeProprietaryBits>
Expand Down Expand Up @@ -123,6 +122,7 @@
<AndroidToolPath Condition=" '$(AndroidToolPath)' == '' ">$(AndroidSdkFullPath)\tools</AndroidToolPath>
<AndroidToolsBinPath Condition=" '$(AndroidToolsBinPath)' == '' ">$(AndroidToolPath)\bin</AndroidToolsBinPath>
<AndroidToolExe Condition=" '$(AndroidToolExe)' == '' ">android</AndroidToolExe>
<EmulatorVersion Condition=" '$(EmulatorVersion)' == '' ">5194135</EmulatorVersion>
<EmulatorToolPath Condition=" '$(EmulatorToolPath)' == '' ">$(AndroidSdkFullPath)\emulator</EmulatorToolPath>
<EmulatorToolExe Condition=" '$(EmulatorToolExe)' == '' ">emulator</EmulatorToolExe>
<NdkBuildPath Condition=" '$(NdkBuildPath)' == '' And '$(HostOS)' != 'Windows' ">$(AndroidNdkDirectory)\ndk-build</NdkBuildPath>
Expand Down Expand Up @@ -151,9 +151,6 @@
<AndroidSupportedTargetJitAbisForConditionalChecks Condition=" !$(AndroidSupportedTargetJitAbisForConditionalChecks.StartsWith (':')) " >:$(AndroidSupportedTargetJitAbisForConditionalChecks)</AndroidSupportedTargetJitAbisForConditionalChecks>
<AndroidSupportedTargetJitAbisSplit>$(AndroidSupportedTargetJitAbis.Split(':'))</AndroidSupportedTargetJitAbisSplit>
</PropertyGroup>
<ItemGroup>
<AndroidSupportedTargetJitAbi Include="$(AndroidSupportedTargetJitAbisSplit)" />
</ItemGroup>

<PropertyGroup>
<AndroidSupportedTargetAotAbisForConditionalChecks>$(AndroidSupportedTargetAotAbis)</AndroidSupportedTargetAotAbisForConditionalChecks>
Expand All @@ -164,4 +161,6 @@
<PropertyGroup>
<RemapAssemblyRefTool>$(ManagedRuntime) &quot;$(MSBuildThisFileDirectory)bin\Build$(Configuration)\remap-assembly-ref.exe&quot;</RemapAssemblyRefTool>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)build-tools\scripts\Ndk.targets" />
</Project>
19 changes: 9 additions & 10 deletions build-tools/android-toolchain/android-toolchain.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
<PropertyGroup>
<AndroidUri Condition=" '$(AndroidUri)' == '' ">https://dl.google.com/android/repository</AndroidUri>
<AntUri Condition=" '$(AntUri)' == '' ">https://archive.apache.org/dist/ant/binaries</AntUri>
<AndroidNdkVersion>r14b</AndroidNdkVersion>
</PropertyGroup>
<ItemGroup>
<AndroidNdkItem Include="android-ndk-$(AndroidNdkVersion)-darwin-x86_64">
<AndroidNdkItem Include="android-ndk-r$(AndroidNdkVersion)-darwin-x86_64">
<HostOS>Darwin</HostOS>
</AndroidNdkItem>
<AndroidNdkItem Include="android-ndk-$(AndroidNdkVersion)-linux-x86_64">
<AndroidNdkItem Include="android-ndk-r$(AndroidNdkVersion)-linux-x86_64">
<HostOS>Linux</HostOS>
</AndroidNdkItem>
<AndroidNdkItem Include="android-ndk-$(AndroidNdkVersion)-windows-x86_64">
<AndroidNdkItem Include="android-ndk-r$(AndroidNdkVersion)-windows-x86_64">
<HostOS>Windows</HostOS>
</AndroidNdkItem>
<!--
Expand All @@ -22,47 +21,47 @@
<HostOS>Linux</HostOS>
<DestDir>build-tools\$(XABuildToolsFolder)</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="platform-tools_r28.0.0-linux">
<AndroidSdkItem Include="platform-tools_r$(XAPlatformToolsVersion)-linux">
<HostOS>Linux</HostOS>
<DestDir>platform-tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="sdk-tools-linux-4333796">
<HostOS>Linux</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-linux-4969155">
<AndroidSdkItem Include="emulator-linux-$(EmulatorVersion)">
<HostOS>Linux</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="build-tools_r$(XABuildToolsVersion)-macosx">
<HostOS>Darwin</HostOS>
<DestDir>build-tools\$(XABuildToolsFolder)</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="platform-tools_r28.0.0-darwin">
<AndroidSdkItem Include="platform-tools_r$(XAPlatformToolsVersion)-darwin">
<HostOS>Darwin</HostOS>
<DestDir>platform-tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="sdk-tools-darwin-4333796">
<HostOS>Darwin</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-darwin-4969155">
<AndroidSdkItem Include="emulator-darwin-$(EmulatorVersion)">
<HostOS>Darwin</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="build-tools_r$(XABuildToolsVersion)-windows">
<HostOS>Windows</HostOS>
<DestDir>build-tools\$(XABuildToolsFolder)</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="platform-tools_r28.0.0-windows">
<AndroidSdkItem Include="platform-tools_r$(XAPlatformToolsVersion)-windows">
<HostOS>Windows</HostOS>
<DestDir>platform-tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="sdk-tools-windows-4333796">
<HostOS>Windows</HostOS>
<DestDir>tools</DestDir>
</AndroidSdkItem>
<AndroidSdkItem Include="emulator-windows-4969155">
<AndroidSdkItem Include="emulator-windows-$(EmulatorVersion)">
<HostOS>Windows</HostOS>
<DestDir>emulator</DestDir>
</AndroidSdkItem>
Expand Down
13 changes: 13 additions & 0 deletions build-tools/android-toolchain/android-toolchain.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.AcceptAndroidSdkLicenses" />
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.GitCommitHash" />
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.SetEnvironmentVariable" />
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.ReplaceFileContents" />
<PropertyGroup>
<BuildDependsOn>
ResolveReferences;
Expand All @@ -12,6 +13,8 @@
</BuildDependsOn>
</PropertyGroup>
<UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" TaskName="Xamarin.Android.Tools.BootstrapTasks.UnzipDirectoryChildren" />
<Import Project="..\scripts\NDKVersionInfo.targets" />

<Target Name="_DetermineItems">
<CreateItem
Include="@(AndroidSdkItem)"
Expand Down Expand Up @@ -117,4 +120,14 @@
WorkingDirectory="$(MonoSourceFullPath)\sdks\builds"
/>
</Target>

<Target Name="_CreateBuildConfig"
DependsOnTargets="GetNDKVersionInfo"
AfterTargets="Build">
<ReplaceFileContents
SourceFile="..\scripts\XABuildConfig.cs.in"
DestinationFile="..\..\bin\Build$(Configuration)\XABuildConfig.cs"
Replacements="@NDK_MINIMUM_API_AVAILABLE@=$(_NDKMinimumApiAvailable);@NDK_RELEASE@=$(AndroidNdkVersion);@NDK_REVISION@=$(_NDKRevision);@NDK_VERSION_MAJOR@=$(_NDKVersionMajor);@NDK_VERSION_MINOR@=$(_NDKVersionMinor);@NDK_VERSION_MICRO@=$(_NDKVersionMicro);@NDK_ARMEABI_V7_API@=$(AndroidNdkApiLevel_ArmV7a);@NDK_ARM64_V8A_API@=$(AndroidNdkApiLevel_ArmV8a);@NDK_X86_API@=$(AndroidNdkApiLevel_X86);@NDK_X86_64_API@=$(AndroidNdkApiLevel_X86_64)">
</ReplaceFileContents>
</Target>
</Project>
1 change: 1 addition & 0 deletions build-tools/create-bundle/bundle-path.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<VersionFile Include="..\..\src\mono-runtimes\mono-runtimes.*" />
<VersionFile Include="..\..\src\mono-runtimes\ProfileAssemblies.projitems" />
<VersionFile Include="..\scripts\BuildEverything.mk" />
<VersionFile Include="..\scripts\Ndk.targets" />
</ItemGroup>
<HashFileContents
Files="@(VersionFile)">
Expand Down
Binary file modified build-tools/gradle/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions build-tools/gradle/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Tue Dec 11 14:50:37 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
2 changes: 1 addition & 1 deletion build-tools/gradle/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
2 changes: 1 addition & 1 deletion build-tools/gradle/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
15 changes: 15 additions & 0 deletions build-tools/scripts/NDKVersionInfo.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.NDKInfo" />

<Target Name="GetNDKVersionInfo">
<NDKInfo
NDKDirectory="$(AndroidNdkDirectory)">
<Output TaskParameter="NDKRevision" PropertyName="_NDKRevision" />
<Output TaskParameter="NDKMinimumApiAvailable" PropertyName="_NDKMinimumApiAvailable" />
<Output TaskParameter="NDKVersionMajor" PropertyName="_NDKVersionMajor" />
<Output TaskParameter="NDKVersionMinor" PropertyName="_NDKVersionMinor" />
<Output TaskParameter="NDKVersionMicro" PropertyName="_NDKVersionMicro" />
</NDKInfo>
</Target>
</Project>
38 changes: 38 additions & 0 deletions build-tools/scripts/Ndk.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AndroidNdkVersion Condition=" '$(AndroidNdkVersion)' == '' ">19</AndroidNdkVersion>
<AndroidNdkApiLevel_ArmV7a Condition=" '$(AndroidNdkApiLevel_ArmV7a)' == '' ">16</AndroidNdkApiLevel_ArmV7a>
<AndroidNdkApiLevel_ArmV8a Condition=" '$(AndroidNdkApiLevel_ArmV8a)' == '' ">21</AndroidNdkApiLevel_ArmV8a>
<AndroidNdkApiLevel_X86 Condition=" '$(AndroidNdkApiLevel_X86)' == '' ">16</AndroidNdkApiLevel_X86>
<AndroidNdkApiLevel_X86_64 Condition=" '$(AndroidNdkApiLevel_X86_64)' == '' ">21</AndroidNdkApiLevel_X86_64>
</PropertyGroup>

<ItemGroup>
<!-- It appears we cannot use batching outside a <Target> so we cannot use a set of items specifying the necessary API level to generate the
AndroidSupportedTargetJitAbi items with appropriate metadata. Thus we need to do it manually as below -->
<AndroidSupportedTargetJitAbi
Include="armeabi-v7a"
Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':armeabi-v7a:')) ">
<ApiLevel>$(AndroidNdkApiLevel_ArmV7a)</ApiLevel>
</AndroidSupportedTargetJitAbi>

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

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

<AndroidSupportedTargetJitAbi
Include="x86_64"
Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':x86_64:')) ">
<ApiLevel>$(AndroidNdkApiLevel_X86_64)</ApiLevel>
</AndroidSupportedTargetJitAbi>
</ItemGroup>
</Project>
20 changes: 20 additions & 0 deletions build-tools/scripts/XABuildConfig.cs.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;

namespace Xamarin.Android.Tools
{
static class XABuildConfig
{
public const string NDKRevision = "@NDK_REVISION@";
public const string NDKRelease = "@NDK_RELEASE@";
public const int NDKMinimumApiAvailable = @NDK_MINIMUM_API_AVAILABLE@;
public static readonly Version NDKVersion = new Version (@NDK_VERSION_MAJOR@, @NDK_VERSION_MINOR@, @NDK_VERSION_MICRO@);

public static readonly Dictionary <string, int> ArchAPILevels = new Dictionary <string, int> (StringComparer.Ordinal) {
{"armeabi-v7a", @NDK_ARMEABI_V7_API@},
{ "arm64-v8a", @NDK_ARM64_V8A_API@},
{ "x86", @NDK_X86_API@},
{ "x86_64", @NDK_X86_64_API@},
};
}
}
2 changes: 1 addition & 1 deletion build-tools/scripts/cmake-common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_CmakeCommonFlags>-GNinja -DCMAKE_MAKE_PROGRAM=$(NinjaPath)</_CmakeCommonFlags>
<_CmakeAndroidFlags>$(_CmakeCommonFlags) -DANDROID_STL="system" -DANDROID_CPP_FEATURES="" -DANDROID_TOOLCHAIN=clang -DANDROID_NATIVE_API_LEVEL=$(AndroidNdkApiLevel) -DANDROID_PLATFORM=android-$(AndroidNdkApiLevel) -DCMAKE_TOOLCHAIN_FILE=$(AndroidNdkDirectory)\build\cmake\android.toolchain.cmake -DANDROID_NDK=$(AndroidNdkDirectory)</_CmakeAndroidFlags>
<_CmakeAndroidFlags>$(_CmakeCommonFlags) -DANDROID_STL="system" -DANDROID_CPP_FEATURES="" -DANDROID_TOOLCHAIN=clang -DCMAKE_TOOLCHAIN_FILE=$(AndroidNdkDirectory)\build\cmake\android.toolchain.cmake -DANDROID_NDK=$(AndroidNdkDirectory)</_CmakeAndroidFlags>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.IO;
using System.Text;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace Xamarin.Android.BuildTools.PrepTasks
{
public class NDKInfo : Task
{
[Required]
public string NDKDirectory { get; set; }

[Output]
public string NDKRevision { get; set; }

[Output]
public string NDKVersionMajor { get; set; }

[Output]
public string NDKVersionMinor { get; set; }

[Output]
public string NDKVersionMicro { get; set; }

[Output]
public string NDKMinimumApiAvailable { get; set; }

public override bool Execute ()
{
string props = Path.Combine (NDKDirectory, "source.properties");

if (!File.Exists (props))
Log.LogError ($"NDK version file not found at {props}");
else
GatherInfo (props);

return !Log.HasLoggedErrors;
}

void GatherInfo (string props)
{
string[] lines = File.ReadAllLines (props);

foreach (string l in lines) {
string line = l.Trim ();
string[] parts = line.Split (new char[] {'='}, 2);
if (parts.Length != 2)
continue;

if (String.Compare ("Pkg.Revision", parts [0].Trim (), StringComparison.Ordinal) != 0)
continue;

string rev = parts [1].Trim ();
NDKRevision = rev;

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

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

int minimumApi = Int32.MaxValue;
string platforms = Path.Combine (NDKDirectory, "platforms");
foreach (string p in Directory.EnumerateDirectories (platforms, "android-*", SearchOption.TopDirectoryOnly)) {
string pdir = Path.GetFileName (p);
string[] parts = pdir.Split (new char[] { '-' }, 2);
if (parts.Length != 2)
continue;

int api;
if (!Int32.TryParse (parts [1].Trim (), out api))
continue;

if (api >= minimumApi)
continue;

minimumApi = api;
}

NDKMinimumApiAvailable = minimumApi.ToString ();
}
}
}
1 change: 1 addition & 0 deletions build-tools/xa-prep-tasks/xa-prep-tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\ProcessPlotInput.cs" />
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\ProcessLogcatTiming.cs" />
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\CreateFilePaths.cs" />
<Compile Include="Xamarin.Android.BuildTools.PrepTasks\NDKInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\external\xamarin-android-tools\src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj">
Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Android/Test/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="Mono.Android_Tests">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
<application android:label="Xamarin.Android.RuntimeTests" android:name="android.apptests.App">
<activity
android:name="android.apptests.RenamedActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public void BuildAotApplication (string supportedAbis, bool enableLLVM, bool exp
// Set //uses-sdk/@android:minSdkVersion so that LLVM uses the right libc.so
proj.AndroidManifest = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<manifest xmlns:android=""http://schemas.android.com/apk/res/android"" android:versionCode=""1"" android:versionName=""1.0"" package=""{proj.PackageName}"">
<uses-sdk android:minSdkVersion=""10"" />
<uses-sdk android:minSdkVersion=""{Xamarin.Android.Tools.XABuildConfig.NDKMinimumApiAvailable}"" />
<application android:label=""{proj.ProjectName}"">
</application>
</manifest>";
Expand All @@ -672,8 +672,8 @@ public void BuildAotApplication (string supportedAbis, bool enableLLVM, bool exp
if (checkMinLlvmPath && !IsWindows) {
// LLVM passes a direct path to libc.so, and we need to use the libc.so
// which corresponds to the *minimum* SDK version specified in AndroidManifest.xml
// Since we overrode minSdkVersion=10, that means we should use libc.so from android-9.
var rightLibc = new Regex (@"^\s*\[AOT\].*cross-.*--llvm.*,ld-flags=.*android-9.arch-.*.usr.lib.libc\.so", RegexOptions.Multiline);
// Since we overrode minSdkVersion=16, that means we should use libc.so from android-16.
var rightLibc = new Regex (@"^\s*\[AOT\].*cross-.*--llvm.*,ld-flags=.*android-16.arch-.*.usr.lib.libc\.so", RegexOptions.Multiline);
var m = rightLibc.Match (string.Join ("\n",b.LastBuildOutput));
Assert.IsTrue (m.Success, "AOT+LLVM should use libc.so from minSdkVersion!");
}
Expand Down
Loading

0 comments on commit 74ebb89

Please sign in to comment.