Reduce 'android-18' duplication, as originally done by wenderen

Use android.platform (and $ANDROID_PLATFORM) for configuration, apply 'android-18' default
This commit is contained in:
Mitchell Hentges 2016-05-20 22:23:28 +02:00
parent dea610986d
commit 619212abf3
7 changed files with 16 additions and 16 deletions

View file

@ -178,6 +178,7 @@ class CommandBase(object):
self.config["android"].setdefault("sdk", "") self.config["android"].setdefault("sdk", "")
self.config["android"].setdefault("ndk", "") self.config["android"].setdefault("ndk", "")
self.config["android"].setdefault("toolchain", "") self.config["android"].setdefault("toolchain", "")
self.config["android"].setdefault("platform", "android-18")
self.config["android"].setdefault("target", "arm-linux-androideabi") self.config["android"].setdefault("target", "arm-linux-androideabi")
self.config.setdefault("gonk", {}) self.config.setdefault("gonk", {})
@ -318,6 +319,8 @@ class CommandBase(object):
env["ANDROID_NDK"] = self.config["android"]["ndk"] env["ANDROID_NDK"] = self.config["android"]["ndk"]
if self.config["android"]["toolchain"]: if self.config["android"]["toolchain"]:
env["ANDROID_TOOLCHAIN"] = self.config["android"]["toolchain"] env["ANDROID_TOOLCHAIN"] = self.config["android"]["toolchain"]
if self.config["android"]["platform"]:
env["ANDROID_PLATFORM"] = self.config["android"]["platform"]
if gonk: if gonk:
if self.config["gonk"]["b2g"]: if self.config["gonk"]["b2g"]:

View file

@ -41,10 +41,11 @@ debug-mozjs = false
# Android information # Android information
[android] [android]
# Defaults to the value of $ANDROID_SDK, $ANDROID_NDK, $ANDROID_TOOLCHAIN respectively # Defaults to the value of $ANDROID_SDK, $ANDROID_NDK, $ANDROID_TOOLCHAIN, $ANDROID_PLATFORM respectively
#sdk = "/opt/android-sdk" #sdk = "/opt/android-sdk"
#ndk = "/opt/android-ndk" #ndk = "/opt/android-ndk"
#toolchain = "/opt/android-toolchain" #toolchain = "/opt/android-toolchain"
#platform = "android-18"
# Gonk information # Gonk information
# Please fill the ndk/toolchain for Android too # Please fill the ndk/toolchain for Android too

View file

@ -36,17 +36,9 @@
<condition property="sdk.dir" value="${env.ANDROID_HOME}"> <condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" /> <isset property="env.ANDROID_HOME" />
</condition> </condition>
<condition property="target" value="${env.ANDROID_PLATFORM}">
<!-- The project.properties file is created and updated by the 'android' <isset property="env.ANDROID_PLATFORM" />
tool, as well as ADT. </condition>
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir --> <!-- quick check on sdk.dir -->
<fail <fail

View file

@ -1,2 +1,2 @@
APP_ABI := armeabi APP_ABI := armeabi
APP_PLATFORM := android-18 APP_PLATFORM := $(ANDROID_PLATFORM)

View file

@ -1 +0,0 @@
target=android-18

View file

@ -27,6 +27,11 @@ fn main() {
let ndk_path = env::var("NDK_HOME").ok().expect("Please set the NDK_HOME environment variable"); let ndk_path = env::var("NDK_HOME").ok().expect("Please set the NDK_HOME environment variable");
let ndk_path = Path::new(&ndk_path); let ndk_path = Path::new(&ndk_path);
// Get the target android platform from ANDROID_PLATFORM env. Expecting "android-{version}"
let android_platform = env::var("ANDROID_PLATFORM")
.ok()
.expect("Please set the ANDROID_PLATFORM environment variable")
// Get the standalone NDK path from NDK_STANDALONE env. // Get the standalone NDK path from NDK_STANDALONE env.
// let standalone_path = env::var("NDK_STANDALONE").ok().unwrap_or("/opt/ndk_standalone".to_string()); // let standalone_path = env::var("NDK_STANDALONE").ok().unwrap_or("/opt/ndk_standalone".to_string());
// let standalone_path = Path::new(&standalone_path); // let standalone_path = Path::new(&standalone_path);
@ -97,7 +102,7 @@ fn main() {
.arg("--name") .arg("--name")
.arg("Servo") .arg("Servo")
.arg("--target") .arg("--target")
.arg("android-18") .arg(&android_platform)
.arg("--path") .arg("--path")
.arg(".") .arg(".")
.stdout(Stdio::inherit()) .stdout(Stdio::inherit())

View file

@ -36,7 +36,7 @@ _ANDROID_ARCH=arch-arm
# Android 5.0, there will likely be another platform added (android-22?). # Android 5.0, there will likely be another platform added (android-22?).
# This value is always used. # This value is always used.
# _ANDROID_API="android-14" # _ANDROID_API="android-14"
_ANDROID_API="android-18" _ANDROID_API="$ANDROID_PLATFORM"
# _ANDROID_API="android-19" # _ANDROID_API="android-19"
##################################################################### #####################################################################