@@ -70,6 +70,19 @@ ext.applyTestAppModule = { Project project ->
7070 if (reactNativeVersion >= 0 && reactNativeVersion < v(0 , 75 , 0 )) {
7171 importLegacyAutolinkingModule(reactNativeDir)
7272 applyNativeModulesAppBuildGradle(project)
73+ } else if (reactNativeVersion >= v(0 , 82 , 0 )) {
74+ // Ensure community modules can continue using `isNewArchEnabled()` to
75+ // determine whether New Architecture is enabled when it is enabled by
76+ // default in React Native 0.82 and later.
77+ def newArchProps = [" react.newArchEnabled" , " newArchEnabled" ]
78+ project. gradle. beforeProject { subproject ->
79+ newArchProps. each { prop ->
80+ if (subproject. hasProperty(prop)) {
81+ subproject. setProperty(prop, " true" )
82+ }
83+ subproject. ext. set(prop, " true" )
84+ }
85+ }
7386 }
7487
7588 def isRntaProject =
@@ -210,4 +223,21 @@ ext.applyTestAppModule = { Project project ->
210223 }
211224 }
212225 }
226+
227+ // Make `:app:preBuild` depend on all subproject `preBuild` tasks to ensure
228+ // all code has been generated before the CMake configuration step.
229+ project. gradle. projectsEvaluated {
230+ def app = project. rootProject. subprojects. find { it. path == " :app" }
231+ def preBuild = app?. tasks?. findByName(" preBuild" )
232+ if (preBuild != null ) {
233+ project. rootProject. subprojects { subproject ->
234+ if (subproject. path != " :app" && subproject. path != " :support" ) {
235+ def subPreBuild = subproject. tasks. findByName(" preBuild" )
236+ if (subPreBuild != null ) {
237+ preBuild. dependsOn(subPreBuild)
238+ }
239+ }
240+ }
241+ }
242+ }
213243}
0 commit comments