Skip to content

Commit 9ac2786

Browse files
committed
simplify
1 parent 0738839 commit 9ac2786

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

package/android/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,12 @@ def resolveReactNativeDirectory() {
6666
throw new GradleException("[react-native-quick-sqlite] Unable to resolve react-native location in node_modules. Your app should define `REACT_NATIVE_NODE_MODULES_DIR` extension property in `app/build.gradle` with a path to react-native in node_modules.")
6767
}
6868

69-
def getReactNativeMinorVersion() {
70-
def reactNativeRootDir = resolveReactNativeDirectory()
71-
def reactNativeProperties = new Properties()
72-
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactNativeProperties.load(it) }
73-
def reactNativeVersion = reactNativeProperties.getProperty("VERSION_NAME")
74-
return reactNativeVersion.split("\\.")[1].toInteger()
75-
}
69+
def reactNativeRootDir = resolveReactNativeDirectory()
70+
def reactProperties = new Properties()
71+
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
72+
73+
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
74+
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
7675

7776
def SQLITE_FLAGS = rootProject.properties['quickSqliteFlags']
7877

@@ -101,7 +100,7 @@ android {
101100
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
102101
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
103102

104-
buildConfigField "int", "REACT_NATIVE_MINOR_VERSION", getReactNativeMinorVersion().toString()
103+
buildConfigField "int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString()
105104
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
106105

107106
externalNativeBuild {

0 commit comments

Comments
 (0)