@@ -22,39 +22,6 @@ def isNewArchitectureEnabled() {
22
22
return rootProject. hasProperty(" newArchEnabled" ) && rootProject. getProperty(" newArchEnabled" ) == " true"
23
23
}
24
24
25
- def resolveReactNativeDirectory () {
26
- def reactNativeLocation = rootProject. hasProperty(" reactNativeDir" ) ? rootProject. getProperty(" reactNativeDir" ) : null
27
-
28
- if (reactNativeLocation != null ) {
29
- return file(reactNativeLocation)
30
- }
31
-
32
- try {
33
- // Resolve React Native location with Node
34
- // This will make sure that we get installation location correctly in monorepos
35
- def reactNativePackageJsonPathStdout = new ByteArrayOutputStream ()
36
-
37
- exec {
38
- commandLine(" node" , " -p" , " require.resolve('react-native/package.json')" )
39
- ignoreExitValue true
40
- standardOutput = reactNativePackageJsonPathStdout
41
- }
42
-
43
- def reactNativeFromProjectNodeModules = file(reactNativePackageJsonPathStdout. toString(). trim()). getParentFile();
44
-
45
- if (reactNativeFromProjectNodeModules. exists()) {
46
- return reactNativeFromProjectNodeModules
47
- }
48
- } catch (e) {
49
- // Ignore
50
- }
51
-
52
- throw new Exception (
53
- " ${ project.name} : Failed to resolve 'react-native' in the project. " +
54
- " If you have a non-standard project structure, you can specify 'reactNativeDir' with the path to 'react-native' in your 'gradle.properties' file."
55
- )
56
- }
57
-
58
25
apply plugin : " com.android.library"
59
26
< % if (project. kotlin) { -% >
60
27
apply plugin : " kotlin-android"
@@ -72,13 +39,6 @@ def getExtOrIntegerDefault(name) {
72
39
return rootProject. ext. has(name) ? rootProject. ext. get(name) : (project. properties[" <%- project.name -%>_" + name]). toInteger()
73
40
}
74
41
75
- def reactNativeRootDir = resolveReactNativeDirectory()
76
- def reactProperties = new Properties ()
77
- file(" $reactNativeRootDir /ReactAndroid/gradle.properties" ). withInputStream { reactProperties. load(it) }
78
-
79
- def reactNativeVersion = reactProperties. getProperty(" VERSION_NAME" )
80
- def (reactNativeMajorVersion, reactNativeMinorVersion) = reactNativeVersion. split(" \\ ." ). collect { it. isInteger() ? it. toInteger() : it }
81
-
82
42
android {
83
43
< % if (project. cpp) { -% >
84
44
ndkVersion getExtOrDefault(" ndkVersion" )
@@ -151,33 +111,17 @@ android {
151
111
repositories {
152
112
mavenCentral()
153
113
google()
154
-
155
- if (reactNativeMajorVersion == 0 && reactNativeMinorVersion < 71 ) {
156
- def androidSourcesDir = file(" $reactNativeRootDir /android" )
157
- def androidSourcesName = " React Native sources"
158
-
159
- if (androidSourcesDir. exists()) {
160
- maven {
161
- url androidSourcesDir. toString()
162
- name androidSourcesName
163
- }
164
- }
165
- }
166
114
}
167
115
168
116
< % if (project. kotlin) { -% >
169
117
def kotlin_version = getExtOrDefault(" kotlinVersion" )
170
118
< % } -% >
171
119
172
120
dependencies {
173
- if (reactNativeMajorVersion == 0 && reactNativeMinorVersion < 71 ) {
174
- // noinspection GradleDynamicVersion
175
- implementation " com.facebook.react:react-native:+"
176
- // From node_modules
177
- } else {
178
- implementation " com.facebook.react:react-android"
179
- }
180
-
121
+ // For < 0.71, this will be from the local maven repo
122
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
123
+ // noinspection GradleDynamicVersion
124
+ implementation " com.facebook.react:react-native:+"
181
125
< % if (project. kotlin) { -% >
182
126
implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
183
127
< % } -% >
0 commit comments