Skip to content

Commit

Permalink
android: use react-native project-wide properties
Browse files Browse the repository at this point in the history
When present, uses the root project's properties for the android
sdk and tools versions. Uses the properties when creating the NDK's
standalone toolchain for building native modules.
  • Loading branch information
jaimecbernardo committed Jul 27, 2018
1 parent fc1e271 commit 5e35c75
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ buildscript {

apply plugin: 'com.android.library'

def _nodeTargetSdkVersion = ((rootProject?.ext?.properties?.targetSdkVersion) ?: 22)

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion ((rootProject?.ext?.properties?.compileSdkVersion) ?: 23)
buildToolsVersion ((rootProject?.ext?.properties?.buildToolsVersion) ?: "23.0.1")

defaultConfig {
minSdkVersion 16
targetSdkVersion 22
minSdkVersion ((rootProject?.ext?.properties?.minSdkVersion) ?: 16)
targetSdkVersion _nodeTargetSdkVersion
versionCode 1
versionName "1.0"
externalNativeBuild {
Expand Down Expand Up @@ -297,7 +299,7 @@ if ("1".equals(shouldRebuildNativeModules)) {
task "MakeToolchain${abi_name}" (type:Exec) {
description = "Building a native toolchain to compile nodejs-mobile native modules for ${abi_name}."
executable = "${ndk_bundle_path}/build/tools/make-standalone-toolchain.sh"
args "--toolchain=${temp_toolchain_name}-${temp_cc_ver}", "--arch=${temp_arch}", "--install-dir=${standalone_toolchain}", "--stl=libc++", "--force", "--platform=android-22"
args "--toolchain=${temp_toolchain_name}-${temp_cc_ver}", "--arch=${temp_arch}", "--install-dir=${standalone_toolchain}", "--stl=libc++", "--force", "--platform=android-${_nodeTargetSdkVersion}"
outputs.file "${standalone_toolchain}"
}

Expand Down

0 comments on commit 5e35c75

Please sign in to comment.