Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #27248 from RandomShaper/upgrade-android-2.1
Browse files Browse the repository at this point in the history
Upgrade & fix Android build scripts
  • Loading branch information
akien-mga committed Mar 27, 2019
2 parents e898b0a + 5f795e6 commit ba709aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
25 changes: 14 additions & 11 deletions platform/android/build.gradle.template
@@ -1,24 +1,25 @@
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.3.2'
$$GRADLE_CLASSPATH$$
}
}

apply plugin: 'com.android.application'

allprojects {
repositories {
jcenter()
mavenCentral()
google()
$$GRADLE_REPOSITORY_URLS$$
}
repositories {
jcenter()
mavenCentral()
google()
$$GRADLE_REPOSITORY_URLS$$
}
}

dependencies {
$$GRADLE_DEPENDENCIES$$
}
Expand All @@ -31,7 +32,7 @@ android {
}

compileSdkVersion 27
buildToolsVersion "27.0.3"
buildToolsVersion "28.0.3"
useLibrary 'org.apache.http.legacy'

packagingOptions {
Expand Down Expand Up @@ -74,9 +75,11 @@ android {
$$GRADLE_JNI_DIRS$$
]
}
// Undocumented; may break in a future Gradle version
applicationVariants.all { variant ->
// ApplicationVariant is undocumented, but this method is widely used; may break with another version of the Android Gradle plugin
variant.outputs.get(0).setOutputFile(new File("${projectDir}/../../../bin", "android_${variant.name}.apk"))
variant.outputs.all {
outputFileName = "../../../../../../../bin/android_${variant.name}.apk"
}
}
}

Expand Down
12 changes: 5 additions & 7 deletions platform/android/detect.py
Expand Up @@ -91,8 +91,6 @@ def mySpawn(sh, escape, cmd, args, env):

env['SPAWN'] = mySpawn

ndk_platform = env['ndk_platform']

if env['android_arch'] not in ['armv7', 'armv6', 'arm64v8', 'x86', 'x86_64']:
env['android_arch'] = 'armv7'

Expand All @@ -115,9 +113,9 @@ def mySpawn(sh, escape, cmd, args, env):
arch_subpath = "x86"
env["x86_libtheora_opt_gcc"] = True
elif env['android_arch'] == 'x86_64':
if get_platform(env["ndk_platform"]) < 21:
if get_platform(env['ndk_platform']) < 21:
print("WARNING: android_arch=x86_64 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21")
env["ndk_platform"] = "android-21"
env['ndk_platform'] = "android-21"
env['ARCH'] = 'arch-x86_64'
env.extra_suffix = ".x86_64" + env.extra_suffix
target_subpath = "x86_64-4.9"
Expand All @@ -140,9 +138,9 @@ def mySpawn(sh, escape, cmd, args, env):
else:
env.extra_suffix = ".armv7" + env.extra_suffix
elif env["android_arch"] == "arm64v8":
if get_platform(ndk_platform) < 21:
if get_platform(env['ndk_platform']) < 21:
print("WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21")
ndk_platform = "android-21"
env['ndk_platform'] = "android-21"
env['ARCH'] = 'arch-arm64'
target_subpath = "aarch64-linux-android-4.9"
abi_subpath = "aarch64-linux-android"
Expand Down Expand Up @@ -203,7 +201,7 @@ def mySpawn(sh, escape, cmd, args, env):
env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/android/support/include"])
# For unified headers this define has to be set manually
env.Append(CPPFLAGS=["-D__ANDROID_API__=" + str(get_platform(ndk_platform))])
env.Append(CPPFLAGS=["-D__ANDROID_API__=" + str(get_platform(env['ndk_platform']))])
else:
print("Using NDK deprecated headers")
env.Append(CPPFLAGS=["-isystem", lib_sysroot + "/usr/include"])
Expand Down
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

0 comments on commit ba709aa

Please sign in to comment.