-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
36 changed files
with
265 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/NDKInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.