-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
104 lines (86 loc) · 4.02 KB
/
Copy pathbuild.gradle
File metadata and controls
104 lines (86 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// No versions specified: both plugins are expected to already be resolved on the root project's
// buildscript classpath, which every RN app template declares (AGP for the app itself, Kotlin
// because RN ships Kotlin internally).
// Matches how other RN libraries (e.g. reanimated) apply these plugins.
plugins {
id "com.android.library"
id "org.jetbrains.kotlin.android" apply false
}
// AGP 9 provides Kotlin support built in; applying the classic kotlin-android plugin on top of it
// leads to a configuration-time failure. Below AGP 9, and on AGP 9+ when `android.builtInKotlin=false`
// opts back out of built-in Kotlin, the classic plugin is still required.
// See React Native RFC about ecosystem migration details: https://github.com/react-native-community/discussions-and-proposals/pull/1006
def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
def builtInKotlinEnabled = agpMajor >= 9 && (!project.hasProperty("android.builtInKotlin") || Boolean.parseBoolean(project.property("android.builtInKotlin").toString()))
if (!builtInKotlinEnabled) {
apply plugin: "org.jetbrains.kotlin.android"
}
def isNewArchitectureEnabled() {
// To opt-in for the New Architecture, you can either:
// - Set `newArchEnabled` to true inside the `gradle.properties` file
// - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}
def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
// These are fallbacks only. Keep them aligned with RN's current app template
// so a consumer relying on the fallback still gets a build that actually works
// with a current RN version.
def DEFAULT_COMPILE_SDK_VERSION = 35
def DEFAULT_BUILD_TOOLS_VERSION = "36.0.0"
def DEFAULT_TARGET_SDK_VERSION = 35
def DEFAULT_MIN_SDK_VERSION = 24
android {
namespace "com.microsoft.codepush.react"
compileSdk rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION
targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", IS_NEW_ARCHITECTURE_ENABLED.toString()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.22.1"
}
}
lintOptions {
abortOnError false
}
defaultConfig {
consumerProguardFiles 'proguard-rules.pro'
}
buildFeatures {
buildConfig true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
// Only set when we applied the classic kotlin-android plugin ourselves above: AGP 9's built-in
// Kotlin integration doesn't expose this extension at all, per Android's own built-in
// Kotlin migration guide: https://developer.android.com/build/migrate-to-built-in-kotlin
if (!builtInKotlinEnabled) {
android.kotlinOptions {
jvmTarget = "17"
}
}
dependencies {
implementation 'com.facebook.react:react-android:0.82.1'
implementation 'com.nimbusds:nimbus-jose-jwt:9.37.3'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.json:json:20231013'
androidTestImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test:runner:1.6.2'
}