@@ -23,15 +23,6 @@ def isNewArchitectureEnabled() {
2323 return rootProject. hasProperty(" newArchEnabled" ) && rootProject. getProperty(" newArchEnabled" ) == " true"
2424}
2525
26- apply plugin : " com.android.library"
27- apply plugin : " kotlin-android"
28-
29- apply from : ' ../nitrogen/generated/android/RNNitroSQLite+autolinking.gradle'
30-
31- if (isNewArchitectureEnabled()) {
32- apply plugin : " com.facebook.react"
33- }
34-
3526def getExtOrDefault (name ) {
3627 return rootProject. ext. has(name) ? rootProject. ext. get(name) : project. properties[" RNNitroSQLite_" + name]
3728}
@@ -45,6 +36,12 @@ def safeAppExtGet(prop, fallback) {
4536 appProject?. ext?. has(prop) ? appProject. ext. get(prop) : fallback
4637}
4738
39+ def resolveBuildType () {
40+ Gradle gradle = getGradle()
41+ String tskReqStr = gradle. getStartParameter(). getTaskRequests()[' args' ]. toString()
42+ return tskReqStr. contains(' Release' ) ? ' release' : ' debug'
43+ }
44+
4845def supportsNamespace () {
4946 def parsed = com.android.Version . ANDROID_GRADLE_PLUGIN_VERSION . tokenize(' .' )
5047 def major = parsed[0 ]. toInteger()
@@ -66,19 +63,27 @@ def resolveReactNativeDirectory() {
6663 return reactNativePackage. parentFile
6764 }
6865
69- throw new GradleException (" [react-native-live-markdown ] 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." )
66+ 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." )
7067}
7168
72- def getReactNativeMinorVersion () {
73- def reactNativeRootDir = resolveReactNativeDirectory()
74- def reactNativeProperties = new Properties ()
75- file(" $reactNativeRootDir /ReactAndroid/gradle.properties" ). withInputStream { reactNativeProperties. load(it) }
76- def reactNativeVersion = reactNativeProperties. getProperty(" VERSION_NAME" )
77- return reactNativeVersion. split(" \\ ." )[1 ]. toInteger()
78- }
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()
7975
8076def SQLITE_FLAGS = rootProject. properties[' nitroSqliteFlags' ]
8177
78+ apply plugin : " com.android.library"
79+ apply plugin : " kotlin-android"
80+
81+ if (isNewArchitectureEnabled()) {
82+ apply plugin : " com.facebook.react"
83+ }
84+
85+ apply from : ' ../nitrogen/generated/android/RNNitroSQLite+autolinking.gradle'
86+
8287android {
8388 if (supportsNamespace()) {
8489 namespace " com.margelo.rnnitrosqlite"
@@ -97,14 +102,14 @@ android {
97102 minSdkVersion getExtOrIntegerDefault(" minSdkVersion" )
98103 targetSdkVersion getExtOrIntegerDefault(" targetSdkVersion" )
99104
100- buildConfigField " int" , " REACT_NATIVE_MINOR_VERSION" , getReactNativeMinorVersion() . toString()
105+ buildConfigField " int" , " REACT_NATIVE_MINOR_VERSION" , REACT_NATIVE_MINOR_VERSION . toString()
101106 buildConfigField " boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , isNewArchitectureEnabled(). toString()
102107
103108 externalNativeBuild {
104109 cmake {
105110 arguments " -DANDROID_STL=c++_shared" ,
106111 " -DANDROID_TOOLCHAIN=clang" ,
107- " -DREACT_NATIVE_MINOR_VERSION=${ getReactNativeMinorVersion() } " ,
112+ " -DREACT_NATIVE_MINOR_VERSION=${ REACT_NATIVE_MINOR_VERSION } " ,
108113 " -DSQLITE_FLAGS='${ SQLITE_FLAGS ? SQLITE_FLAGS : ''} '"
109114 abiFilters (* reactNativeArchitectures())
110115 }
@@ -114,6 +119,7 @@ android {
114119 externalNativeBuild {
115120 cmake {
116121 path " CMakeLists.txt"
122+ version = System . getenv(" CMAKE_VERSION" ) ?: " 3.22.1"
117123 }
118124 }
119125
@@ -153,6 +159,7 @@ android {
153159 }
154160
155161 packagingOptions {
162+ doNotStrip resolveBuildType() == ' debug' ? " **/**/*.so" : ' '
156163 excludes = [
157164 " META-INF" ,
158165 " META-INF/**" ,
0 commit comments