|
1 | 1 | apply plugin: "com.android.library" |
2 | 2 |
|
3 | | -def DEFAULT_COMPILE_SDK_VERSION = 26 |
4 | | -def DEFAULT_BUILD_TOOLS_VERSION = "26.0.3" |
5 | | -def DEFAULT_TARGET_SDK_VERSION = 26 |
6 | | -def DEFAULT_MIN_SDK_VERSION = 16 |
| 3 | +def getExtOrDefault(name) { |
| 4 | + return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["CodePush_" + name] |
| 5 | +} |
| 6 | + |
| 7 | +def getExtOrIntegerDefault(name) { |
| 8 | + return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CodePush_" + name]).toInteger() |
| 9 | +} |
| 10 | + |
| 11 | +def supportsNamespace() { |
| 12 | + def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') |
| 13 | + def major = parsed[0].toInteger() |
| 14 | + def minor = parsed[1].toInteger() |
| 15 | + |
| 16 | + // Namespace support was added in 7.3.0 |
| 17 | + return (major == 7 && minor >= 3) || major >= 8 |
| 18 | +} |
7 | 19 |
|
8 | 20 | android { |
| 21 | + if (supportsNamespace()) { |
9 | 22 | namespace "com.appzung.codepush.react" |
10 | 23 |
|
11 | | - compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION |
12 | | - buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION |
13 | | - |
14 | | - defaultConfig { |
15 | | - minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION |
16 | | - targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION |
17 | | - versionCode 1 |
18 | | - versionName "1.0" |
| 24 | + sourceSets { |
| 25 | + main { |
| 26 | + manifest.srcFile "src/main/AndroidManifestNew.xml" |
| 27 | + } |
19 | 28 | } |
| 29 | + } |
20 | 30 |
|
21 | | - lintOptions { |
22 | | - abortOnError false |
23 | | - } |
| 31 | + compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") |
24 | 32 |
|
25 | | - defaultConfig { |
26 | | - consumerProguardFiles 'proguard-rules.pro' |
| 33 | + defaultConfig { |
| 34 | + minSdkVersion getExtOrIntegerDefault("minSdkVersion") |
| 35 | + targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") |
| 36 | + |
| 37 | + consumerProguardFiles 'proguard-rules.pro' |
| 38 | + } |
| 39 | + |
| 40 | + buildFeatures { |
| 41 | + buildConfig true |
| 42 | + } |
| 43 | + |
| 44 | + buildTypes { |
| 45 | + release { |
| 46 | + minifyEnabled false |
27 | 47 | } |
| 48 | + } |
| 49 | + |
| 50 | + lintOptions { |
| 51 | + disable "GradleCompatible" |
| 52 | + } |
| 53 | + |
| 54 | + compileOptions { |
| 55 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 56 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | +repositories { |
| 61 | + mavenCentral() |
| 62 | + google() |
28 | 63 | } |
29 | 64 |
|
30 | 65 | dependencies { |
31 | | - implementation "com.facebook.react:react-native:+" |
32 | | - implementation 'com.nimbusds:nimbus-jose-jwt:9.37.3' |
| 66 | + // For < 0.71, this will be from the local maven repo |
| 67 | + // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin |
| 68 | + //noinspection GradleDynamicVersion |
| 69 | + implementation "com.facebook.react:react-native:+" |
| 70 | + implementation "com.nimbusds:nimbus-jose-jwt:9.37.3" |
33 | 71 | } |
0 commit comments