@@ -18,22 +18,24 @@ def safeExtGet(prop, fallback) {
1818}
1919
2020def safeExtGetFallbackLowerBound (prop , fallback ) {
21- Math . max(safeExtGet(prop,fallback),fallback)
21+ Math . max(safeExtGet(prop, fallback), fallback)
2222}
2323
24- def DEFAULT_COMPILE_SDK_VERSION = 33
25- def DEFAULT_MIN_SDK_VERSION = 21
26- def DEFAULT_TARGET_SDK_VERSION = 33
24+ def DEFAULT_COMPILE_SDK_VERSION = 35
25+ def DEFAULT_MIN_SDK_VERSION = 24
26+ def DEFAULT_TARGET_SDK_VERSION = 35
2727def DEFAULT_KOTLIN_VERSION = " 1.5.31"
2828def DEFAULT_KOTLIN_STDLIB = ' kotlin-stdlib-jdk8'
29+ def DEFAULT_BUILD_TOOLS_VERSION = " 35.0.0"
2930def kotlinVersion = safeExtGet(" RNNKotlinVersion" , DEFAULT_KOTLIN_VERSION )
30- def kotlinStdlib = safeExtGet(' RNNKotlinStdlib' ,DEFAULT_KOTLIN_STDLIB )
31+ def kotlinStdlib = safeExtGet(' RNNKotlinStdlib' , DEFAULT_KOTLIN_STDLIB )
3132def kotlinCoroutinesCore = safeExtGet(' RNNKotlinCoroutinesCore' , ' 1.5.2' )
33+ def _buildToolsVersion = safeExtGet(' buildToolsVersion' , DEFAULT_BUILD_TOOLS_VERSION )
3234
3335android {
3436 namespace ' com.reactnativenavigation'
3537 compileSdkVersion safeExtGetFallbackLowerBound(' compileSdkVersion' , DEFAULT_COMPILE_SDK_VERSION )
36- buildToolsVersion = " 34.0.0 "
38+ buildToolsVersion = _buildToolsVersion
3739 defaultConfig {
3840 minSdkVersion safeExtGetFallbackLowerBound(' minSdkVersion' , DEFAULT_MIN_SDK_VERSION )
3941 targetSdkVersion safeExtGetFallbackLowerBound(' targetSdkVersion' , DEFAULT_TARGET_SDK_VERSION )
@@ -73,126 +75,12 @@ android {
7375 }
7476 }
7577 compileOptions {
76- if (reactNativeMinorVersion() >= 73 ) {
77- sourceCompatibility JavaVersion . VERSION_17
78- targetCompatibility JavaVersion . VERSION_17
79- } else {
80- sourceCompatibility JavaVersion . VERSION_1_8
81- targetCompatibility JavaVersion . VERSION_1_8
82- }
78+ sourceCompatibility JavaVersion . VERSION_17
79+ targetCompatibility JavaVersion . VERSION_17
8380 }
8481 kotlinOptions {
85- if (reactNativeMinorVersion() >= 73 ) {
86- jvmTarget = JavaVersion . VERSION_17
87- } else {
88- jvmTarget = JavaVersion . VERSION_11
89- }
82+ jvmTarget = JavaVersion . VERSION_17
9083 }
91-
92- flavorDimensions " RNN.reactNativeVersion"
93- productFlavors {
94- reactNative51 {
95- dimension " RNN.reactNativeVersion"
96- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 51" )
97- }
98- reactNative55 {
99- dimension " RNN.reactNativeVersion"
100- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 55" )
101- }
102- reactNative56 {
103- dimension " RNN.reactNativeVersion"
104- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 56" )
105- }
106- reactNative57 {
107- dimension " RNN.reactNativeVersion"
108- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 57" )
109- }
110- reactNative57_5 {
111- dimension " RNN.reactNativeVersion"
112- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 57" )
113- }
114- reactNative60 {
115- dimension " RNN.reactNativeVersion"
116- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 60" )
117- }
118- reactNative62 {
119- dimension " RNN.reactNativeVersion"
120- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 62" )
121- }
122- reactNative63 {
123- dimension " RNN.reactNativeVersion"
124- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 63" )
125- }
126- reactNative68 {
127- dimension " RNN.reactNativeVersion"
128- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 68" )
129- }
130- reactNative71 {
131- dimension " RNN.reactNativeVersion"
132- buildConfigField(" int" , " REACT_NATVE_VERSION_MINOR" , " 71" )
133- }
134- }
135-
136- def flavor = resolveFlavor()
137- variantFilter { variant ->
138- def names = variant. flavors* . name
139- if (! names. contains(flavor)) {
140- setIgnore(true )
141- }
142- }
143- }
144-
145- int reactNativeMinorVersion () {
146- List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
147- reactNativeVersionComponents[1 ]. toInteger()
148- }
149-
150- String resolveFlavor () {
151- List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
152- Integer reactNativeMinorComponent = reactNativeVersionComponents[1 ]. toInteger()
153- Integer reactNativePatchComponent = reactNativeVersionComponents[2 ]. toInteger()
154-
155- if (reactNativeMinorComponent >= 71 ) {
156- return " reactNative71"
157- } else if (reactNativeMinorComponent >= 68 ) {
158- return " reactNative68"
159- } else if (reactNativeMinorComponent >= 63 ) {
160- return " reactNative63"
161- } else if (reactNativeMinorComponent >= 62 ) {
162- return " reactNative62"
163- } else if (reactNativeMinorComponent >= 60 ) {
164- return " reactNative60"
165- } else if (reactNativeMinorComponent >= 57 && reactNativePatchComponent >= 5 ) {
166- return " reactNative57_5"
167- } else if (reactNativeMinorComponent >= 57 ) {
168- return " reactNative57"
169- } else if (reactNativeMinorComponent >= 56 ) {
170- return " reactNative56"
171- } else if (reactNativeMinorComponent >= 55 ) {
172- return " reactNative55"
173- } else if (reactNativeMinorComponent >= 51 ) {
174- return " reactNative51"
175- }
176- }
177-
178-
179- Object findReactNativePackageJson () {
180- def searchPath = ' node_modules/react-native/package.json'
181- def projectDir = project. projectDir. toString() + ' /'
182- def rnPackageJsonFile = new File (projectDir + searchPath)
183- while (! rnPackageJsonFile. exists()) {
184- searchPath = ' ../' + searchPath
185- rnPackageJsonFile = new File (projectDir + searchPath)
186- }
187- return rnPackageJsonFile
188- }
189-
190- List reactNativeVersionComponents (rnPackageJsonFile ) {
191- def packageSlurper = new JsonSlurper ()
192- def reactNativePackageJson = packageSlurper. parseText(rnPackageJsonFile. text)
193- def reactNativeVersion = reactNativePackageJson. version
194-
195- return reactNativeVersion. tokenize(' -' )[0 ]. tokenize(' .' )
19684}
19785
19886dependencies {
@@ -214,7 +102,7 @@ dependencies {
214102 // noinspection GradleDynamicVersion
215103 implementation ' com.facebook.react:react-native:+'
216104
217- if (" Playground" . toLowerCase() == rootProject. name. toLowerCase()){
105+ if (" Playground" . toLowerCase() == rootProject. name. toLowerCase()) {
218106 // tests only for our playground
219107 testImplementation ' junit:junit:4.13.2'
220108 testImplementation " org.robolectric:robolectric:4.7.2"
0 commit comments