|
1 | | -// Top-level build file where you can add configuration options common to all sub-projects/modules. |
| 1 | +def isNewArchitectureEnabled() { |
| 2 | + return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" |
| 3 | +} |
| 4 | + |
| 5 | +apply plugin: "com.android.library" |
| 6 | + |
| 7 | +if (isNewArchitectureEnabled()) { |
| 8 | + apply plugin: "com.facebook.react" |
| 9 | +} |
| 10 | + |
| 11 | +def getExtOrDefault(name) { |
| 12 | + return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["CodePush_" + name] |
| 13 | +} |
| 14 | + |
| 15 | +def getExtOrIntegerDefault(name) { |
| 16 | + return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CodePush_" + name]).toInteger() |
| 17 | +} |
| 18 | + |
| 19 | +def supportsNamespace() { |
| 20 | + def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') |
| 21 | + def major = parsed[0].toInteger() |
| 22 | + def minor = parsed[1].toInteger() |
| 23 | + |
| 24 | + // Namespace support was added in 7.3.0 |
| 25 | + return (major == 7 && minor >= 3) || major >= 8 |
| 26 | +} |
| 27 | + |
| 28 | +android { |
| 29 | + if (supportsNamespace()) { |
| 30 | + namespace "com.appzung.codepush.react" |
2 | 31 |
|
3 | | -buildscript { |
4 | | - repositories { |
5 | | - google() |
6 | | - mavenCentral() |
| 32 | + sourceSets { |
| 33 | + main { |
| 34 | + manifest.srcFile "src/main/AndroidManifestNew.xml" |
| 35 | + } |
7 | 36 | } |
8 | | - dependencies { |
9 | | - classpath "com.android.tools.build:gradle:7.2.1" |
| 37 | + } |
10 | 38 |
|
11 | | - // NOTE: Do not place your application dependencies here; they belong |
12 | | - // in the individual module build.gradle files |
| 39 | + compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") |
| 40 | + |
| 41 | + defaultConfig { |
| 42 | + minSdkVersion getExtOrIntegerDefault("minSdkVersion") |
| 43 | + targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") |
| 44 | + buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() |
| 45 | + |
| 46 | + consumerProguardFiles 'proguard-rules.pro' |
| 47 | + } |
| 48 | + |
| 49 | + buildFeatures { |
| 50 | + buildConfig true |
| 51 | + } |
| 52 | + |
| 53 | + buildTypes { |
| 54 | + release { |
| 55 | + minifyEnabled false |
13 | 56 | } |
| 57 | + } |
| 58 | + |
| 59 | + lintOptions { |
| 60 | + disable "GradleCompatible" |
| 61 | + } |
| 62 | + |
| 63 | + compileOptions { |
| 64 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 65 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +repositories { |
| 70 | + mavenCentral() |
| 71 | + google() |
| 72 | +} |
| 73 | + |
| 74 | +def isInDevelopment = project.hasProperty('CodePush_development') && project.property('CodePush_development') == "true" |
| 75 | + |
| 76 | +dependencies { |
| 77 | + if (isInDevelopment) { |
| 78 | + implementation("com.facebook.react:react-android:0.71.+") |
| 79 | + } else { |
| 80 | + // For < 0.71, this will be from the local maven repo |
| 81 | + // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin |
| 82 | + //noinspection GradleDynamicVersion |
| 83 | + implementation "com.facebook.react:react-native:+" |
| 84 | + } |
| 85 | + implementation "com.nimbusds:nimbus-jose-jwt:9.37.3" |
14 | 86 | } |
0 commit comments