Skip to content

Commit cd0e587

Browse files
committed
chore(android): address Gradle 9.0 deprecation warnings
1 parent 888cac2 commit cd0e587

File tree

4 files changed

+45
-45
lines changed

4 files changed

+45
-45
lines changed

android/app/build.gradle

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ project.ext.react = [
7070
project.ext.signingConfigs = getSigningConfigs()
7171

7272
android {
73-
namespace "com.microsoft.reacttestapp"
73+
namespace = "com.microsoft.reacttestapp"
7474

75-
compileSdkVersion project.ext.compileSdkVersion
75+
compileSdkVersion = project.ext.compileSdkVersion
7676

7777
if (project.hasProperty("ndkVersion")) {
78-
ndkVersion project.ext.ndkVersion
78+
ndkVersion = project.ext.ndkVersion
7979
}
8080

8181
if (usePrefabs) {
8282
buildFeatures {
83-
prefab true
83+
prefab = true
8484
}
8585
}
8686

@@ -89,34 +89,34 @@ android {
8989
}
9090

9191
defaultConfig {
92-
applicationId project.ext.react.applicationId
93-
minSdkVersion project.ext.minSdkVersion
94-
targetSdkVersion project.ext.targetSdkVersion
95-
versionCode project.ext.getVersionCode()
96-
versionName project.ext.getVersionName()
92+
applicationId = project.ext.react.applicationId
93+
minSdkVersion = project.ext.minSdkVersion
94+
targetSdkVersion = project.ext.targetSdkVersion
95+
versionCode = project.ext.getVersionCode()
96+
versionName = project.ext.getVersionName()
9797

9898
def singleApp = getSingleAppMode()
99-
buildConfigField "String", "REACTAPP_SINGLE_APP", singleApp ? "\"${singleApp}\"" : "null"
99+
buildConfigField("String", "REACTAPP_SINGLE_APP", singleApp ? "\"${singleApp}\"" : "null")
100100

101-
buildConfigField "boolean", "REACTAPP_USE_FABRIC", enableNewArchitecture.toString()
102-
buildConfigField "boolean", "REACTAPP_USE_BRIDGELESS", enableBridgeless.toString()
101+
buildConfigField("boolean", "REACTAPP_USE_FABRIC", enableNewArchitecture.toString())
102+
buildConfigField("boolean", "REACTAPP_USE_BRIDGELESS", enableBridgeless.toString())
103103

104104
manifestPlaceholders = [
105105
rntaEnableCamera: project.ext.react.enableCamera ? "1000000" : "1"
106106
]
107107

108-
resValue "string", "app_name", project.ext.react.appName
108+
resValue("string", "app_name", project.ext.react.appName)
109109

110110
def cppStd = reactNativeVersion >= v(0, 74, 0) ? "-std=c++20" : "-std=c++17"
111111
if (enableNewArchitecture) {
112112
externalNativeBuild {
113113
cmake {
114-
arguments "-DANDROID_STL=c++_shared",
114+
arguments("-DANDROID_STL=c++_shared",
115115
"-DNODE_MODULES_DIR=${reactNativePath}/..",
116116
"-DPROJECT_BUILD_DIR=${buildDir}",
117117
"-DREACT_ANDROID_BUILD_DIR=${reactNativePath}/ReactAndroid/build",
118-
"-DREACT_ANDROID_DIR=${reactNativePath}/ReactAndroid"
119-
cppFlags cppStd, "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1"
118+
"-DREACT_ANDROID_DIR=${reactNativePath}/ReactAndroid")
119+
cppFlags(cppStd, "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1")
120120
}
121121
}
122122
if (!project.ext.react.abiSplit) {
@@ -127,18 +127,18 @@ android {
127127
} else {
128128
externalNativeBuild {
129129
cmake {
130-
arguments "-DANDROID_STL=c++_shared",
130+
arguments("-DANDROID_STL=c++_shared",
131131
"-DREACT_COMMON_DIR=${reactNativePath}/ReactCommon",
132-
"-DREACT_JNILIBS_DIR=${buildDir}/outputs/jniLibs"
133-
cppFlags cppStd, "-Wall", "-Werror", "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1"
132+
"-DREACT_JNILIBS_DIR=${buildDir}/outputs/jniLibs")
133+
cppFlags(cppStd, "-Wall", "-Werror", "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1")
134134
}
135135
}
136136
}
137137
}
138138

139139
externalNativeBuild {
140140
cmake {
141-
path "${projectDir}/src/main/jni/CMakeLists.txt"
141+
path = "${projectDir}/src/main/jni/CMakeLists.txt"
142142
}
143143
}
144144

@@ -165,14 +165,14 @@ android {
165165
}
166166

167167
lintOptions {
168-
lintConfig file("lint.xml")
168+
lintConfig = file("lint.xml")
169169
}
170170

171171
packagingOptions {
172-
pickFirst "lib/armeabi-v7a/libc++_shared.so"
173-
pickFirst "lib/arm64-v8a/libc++_shared.so"
174-
pickFirst "lib/x86_64/libc++_shared.so"
175-
pickFirst "lib/x86/libc++_shared.so"
172+
pickFirst("lib/armeabi-v7a/libc++_shared.so")
173+
pickFirst("lib/arm64-v8a/libc++_shared.so")
174+
pickFirst("lib/x86_64/libc++_shared.so")
175+
pickFirst("lib/x86/libc++_shared.so")
176176
}
177177

178178
project.ext.signingConfigs.each { name, config ->
@@ -244,8 +244,8 @@ android {
244244
splits {
245245
abi {
246246
reset()
247-
enable(project.ext.react.abiSplit)
248-
universalApk(false)
247+
enable = project.ext.react.abiSplit
248+
universalApk = false
249249
include(*project.ext.react.architectures)
250250
}
251251
}
@@ -271,15 +271,15 @@ dependencies {
271271
implementation("com.facebook.react:react-native:${version}")
272272
}
273273

274-
implementation libraries.androidAppCompat
275-
implementation libraries.androidCoreKotlinExtensions
276-
implementation libraries.androidRecyclerView
277-
implementation libraries.materialComponents
274+
implementation(libraries.androidAppCompat)
275+
implementation(libraries.androidCoreKotlinExtensions)
276+
implementation(libraries.androidRecyclerView)
277+
implementation(libraries.materialComponents)
278278

279279
if (project.ext.react.enableCamera) {
280-
implementation libraries.androidCamera
281-
implementation libraries.androidCameraMlKitVision
282-
implementation libraries.mlKitBarcodeScanning
280+
implementation(libraries.androidCamera)
281+
implementation(libraries.androidCameraMlKitVision)
282+
implementation(libraries.mlKitBarcodeScanning)
283283
}
284284

285285
if (reactNativeVersion == 0 || reactNativeVersion >= v(0, 75, 0)) {

android/support/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ repositories {
88
}
99

1010
android {
11-
namespace "com.microsoft.reacttestapp.support"
11+
namespace = "com.microsoft.reacttestapp.support"
1212

1313
def androidDir = "${buildscript.sourceFile.getParent()}/../"
1414
apply(from: "${androidDir}/dependencies.gradle")
1515

16-
compileSdkVersion project.ext.compileSdkVersion
16+
compileSdkVersion = project.ext.compileSdkVersion
1717

1818
defaultConfig {
19-
minSdkVersion project.ext.minSdkVersion
20-
targetSdkVersion project.ext.targetSdkVersion
21-
versionCode getVersionCode()
22-
versionName getVersionName()
19+
minSdkVersion = project.ext.minSdkVersion
20+
targetSdkVersion = project.ext.targetSdkVersion
21+
versionCode = getVersionCode()
22+
versionName = getVersionName()
2323
}
2424

2525
compileOptions {
26-
sourceCompatibility JavaVersion.VERSION_1_8
27-
targetCompatibility JavaVersion.VERSION_1_8
26+
sourceCompatibility = JavaVersion.VERSION_1_8
27+
targetCompatibility = JavaVersion.VERSION_1_8
2828
}
2929
}

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ allprojects {
3030
def p = searchDir.resolve("node_modules/react-native/android")
3131
if (p.toFile().exists()) {
3232
maven {
33-
url(p.toRealPath().toString())
33+
url = p.toRealPath().toString()
3434
}
3535
break
3636
}

test/configure/gatherConfig.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe("gatherConfig()", () => {
8585
' def p = searchDir.resolve("node_modules/react-native/android")',
8686
" if (p.toFile().exists()) {",
8787
" maven {",
88-
" url(p.toRealPath().toString())",
88+
" url = p.toRealPath().toString()",
8989
" }",
9090
" break",
9191
" }",
@@ -485,7 +485,7 @@ describe("gatherConfig()", () => {
485485
' def p = searchDir.resolve("node_modules/react-native/android")',
486486
" if (p.toFile().exists()) {",
487487
" maven {",
488-
" url(p.toRealPath().toString())",
488+
" url = p.toRealPath().toString()",
489489
" }",
490490
" break",
491491
" }",

0 commit comments

Comments
 (0)