@@ -17,25 +17,19 @@ buildDir = "${rootDir}/${name}/build"
17
17
18
18
def reactNativePath = file(findNodeModulesPath(" react-native" , rootDir))
19
19
20
- if (autodetectReactNativeVersion || enableNewArchitecture) {
21
- apply(plugin : " com.facebook.react" )
22
-
23
- react {
24
- reactNativeDir = reactNativePath
25
- codegenDir = file(
26
- reactNativeVersion >= v(0 , 72 , 0 )
27
- ? findNodeModulesPath(" @react-native/codegen" , reactNativePath)
28
- : findNodeModulesPath(" react-native-codegen" , reactNativePath)
29
- )
30
- }
20
+ apply(plugin : " com.facebook.react" )
31
21
32
- // We don't want the React plugin to bundle.
33
- tasks. whenTaskAdded { task ->
34
- // The task name can be found in `react-native-gradle-plugin`:
35
- // https://github.com/facebook/react-native/blob/0.71-stable/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L54
36
- if (task. name. startsWith(" createBundle" ) && task. name. endsWith(" JsAndAssets" )) {
37
- task. enabled = false
38
- }
22
+ react {
23
+ reactNativeDir = reactNativePath
24
+ codegenDir = file(findNodeModulesPath(" @react-native/codegen" , reactNativePath))
25
+ }
26
+
27
+ // We don't want the React plugin to bundle.
28
+ tasks. whenTaskAdded { task ->
29
+ // The task name can be found in `react-native-gradle-plugin`:
30
+ // https://github.com/facebook/react-native/blob/0.71-stable/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L54
31
+ if (task. name. startsWith(" createBundle" ) && task. name. endsWith(" JsAndAssets" )) {
32
+ task. enabled = false
39
33
}
40
34
}
41
35
@@ -78,10 +72,8 @@ android {
78
72
ndkVersion = project. ext. ndkVersion
79
73
}
80
74
81
- if (usePrefabs) {
82
- buildFeatures {
83
- prefab = true
84
- }
75
+ buildFeatures {
76
+ prefab = true
85
77
}
86
78
87
79
kotlinOptions {
@@ -107,7 +99,7 @@ android {
107
99
108
100
resValue(" string" , " app_name" , project. ext. react. appName)
109
101
110
- def cppStd = reactNativeVersion >= v( 0 , 74 , 0 ) ? " -std=c++20" : " -std=c++17 "
102
+ def cppStd = " -std=c++20"
111
103
if (enableNewArchitecture) {
112
104
externalNativeBuild {
113
105
cmake {
@@ -142,28 +134,6 @@ android {
142
134
}
143
135
}
144
136
145
- if (! enableNewArchitecture && ! usePrefabs) {
146
- def version = getPackageVersion(" react-native" , rootDir)
147
- def allAar = file(" ${ reactNativePath} /android/com/facebook/react/react-native/${ version} /react-native-${ version} .aar" )
148
-
149
- def prepareDebugJSI = tasks. register(" prepareDebugJSI" , Copy ) {
150
- def debugAar = file(" ${ reactNativePath} /android/com/facebook/react/react-native/${ version} /react-native-${ version} -debug.aar" )
151
- from(zipTree(debugAar. exists() ? debugAar : allAar). matching({ it. include " **/libjsi.so" }))
152
- into(" ${ buildDir} /outputs/jniLibs/debug" )
153
- }
154
-
155
- def prepareReleaseJSI = tasks. register(" prepareReleaseJSI" , Copy ) {
156
- def releaseAar = file(" ${ reactNativePath} /android/com/facebook/react/react-native/${ version} /react-native-${ version} -release.aar" )
157
- from(zipTree(releaseAar. exists() ? releaseAar : allAar). matching({ it. include " **/libjsi.so" }))
158
- into(" ${ buildDir} /outputs/jniLibs/release" )
159
- }
160
-
161
- afterEvaluate {
162
- preDebugBuild. dependsOn(prepareDebugJSI)
163
- preReleaseBuild. dependsOn(prepareReleaseJSI)
164
- }
165
- }
166
-
167
137
lintOptions {
168
138
lintConfig = file(" lint.xml" )
169
139
}
@@ -198,46 +168,11 @@ android {
198
168
? " src/old-arch/java"
199
169
: reactNativeVersion >= v(0 , 81 , 0 )
200
170
? " src/new-arch-0.81/java"
201
- : reactNativeVersion >= v(0 , 73 , 0 )
202
- ? " src/new-arch-0.73/java"
203
- : " src/new-arch/java" ,
204
-
205
- // TODO: Remove this block when we drop support for 0.74
206
- // https://github.com/facebook/react-native/commit/3283202248a36dbda553745afc46a3e3e2ab41a6
207
- reactNativeVersion >= v(0 , 75 , 0 )
208
- ? " src/reactactivitydelegate-0.75/java"
209
- // TODO: Remove this block when we drop support for 0.73
210
- : reactNativeVersion >= v(0 , 74 , 0 )
211
- ? " src/reactactivitydelegate-0.74/java"
212
- // TODO: Remove this block when we drop support for 0.71
213
- // https://github.com/facebook/react-native/commit/e5dd9cdc6688e63e75a7e0bebf380be1a9a5fe2b
214
- : reactNativeVersion >= v(0 , 72 , 0 )
215
- ? " src/reactactivitydelegate-0.72/java"
216
- : " src/reactactivitydelegate-pre-0.72/java" ,
217
-
218
- // TODO: Remove this block when we drop support for 0.74
219
- // https://github.com/facebook/react-native/commit/a1e81185416a53c7c7d0cfc67e40079fd0073e7c
220
- reactNativeVersion >= v(0 , 75 , 0 )
221
- ? " src/devserverhelper-0.75/java"
222
- // TODO: Remove this block when we drop support for 0.73
223
- // https://github.com/facebook/react-native/commit/cfa02eec50469059542ccbacbc51643b525ad461
224
- : reactNativeVersion >= v(0 , 74 , 0 )
225
- ? " src/devserverhelper-0.74/java"
226
- // TODO: Remove this block when we drop support for 0.72
227
- // https://github.com/facebook/react-native/commit/da358d0ec7a492edb804b9cdce70e7516ee518ae
228
- : reactNativeVersion >= v(0 , 73 , 0 )
229
- ? " src/devserverhelper-0.73/java"
230
- : " src/devserverhelper-pre-0.73/java" ,
231
-
232
- // TODO: Remove this block when we drop support for 0.75
233
- // https://github.com/react-native-community/template/commit/f738a366b194dd21d4d2bc14c9215b630714dd70
234
- reactNativeVersion >= v(0 , 76 , 0 )
235
- ? " src/reactapplication-0.76/java"
236
- // TODO: Remove this block when we drop support for 0.72
237
- // https://github.com/facebook/react-native/commit/c3f672cef7d4f287d3d729d33650f917ed132a0c
238
- : reactNativeVersion < v(0 , 73 , 0 )
239
- ? " src/reactapplication-pre-0.73/java"
240
- : " src/reactapplication-0.73/java" ,
171
+ : " src/new-arch-0.73/java" ,
172
+
173
+ " src/devserverhelper-0.75/java" ,
174
+ " src/reactactivitydelegate-0.75/java" ,
175
+ " src/reactapplication-0.76/java" ,
241
176
]
242
177
}
243
178
@@ -254,22 +189,8 @@ android {
254
189
dependencies {
255
190
implementation project(" :support" )
256
191
257
- if (project. ext. react. enableHermes) {
258
- if (autodetectReactNativeVersion) {
259
- implementation(" com.facebook.react:hermes-android" )
260
- } else {
261
- implementation(" com.facebook.react:hermes-engine:+" ) {
262
- exclude(group : " com.facebook.fbjni" )
263
- }
264
- }
265
- }
266
-
267
- if (autodetectReactNativeVersion) {
268
- implementation(" com.facebook.react:react-android" )
269
- } else {
270
- def version = getPackageVersion(" react-native" , rootDir)
271
- implementation(" com.facebook.react:react-native:${ version} " )
272
- }
192
+ implementation(" com.facebook.react:hermes-android" )
193
+ implementation(" com.facebook.react:react-android" )
273
194
274
195
implementation(libraries. androidAppCompat)
275
196
implementation(libraries. androidCoreKotlinExtensions)
@@ -282,25 +203,11 @@ dependencies {
282
203
implementation(libraries. mlKitBarcodeScanning)
283
204
}
284
205
285
- if (reactNativeVersion == 0 || reactNativeVersion >= v(0 , 75 , 0 )) {
286
- // https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt#L162
287
- def dependencies = autolinkingInfo(buildDir)
288
- dependencies. each { path , info ->
289
- info. configurations. each { configuration ->
290
- add(configuration, project(path))
291
- }
292
- }
293
- }
294
- }
295
-
296
- if (! enableNewArchitecture && ! usePrefabs) {
297
- configurations. all {
298
- resolutionStrategy {
299
- // Force version here otherwise Gradle will pick up a newer version:
300
- // https://github.com/facebook/react-native/issues/35210
301
- def version = getPackageVersion(" react-native" , rootDir)
302
- force(" com.facebook.react:react-native:${ version} " )
303
- force(" com.facebook.react:hermes-engine:${ version} " )
206
+ // https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt#L162
207
+ def dependencies = autolinkingInfo(buildDir)
208
+ dependencies. each { path , info ->
209
+ info. configurations. each { configuration ->
210
+ add(configuration, project(path))
304
211
}
305
212
}
306
213
}
0 commit comments