Skip to content

Commit d5fb589

Browse files
[OFF-804] update op sqlite (#1101)
* Update op-sqlite to 15.0.7 * use mendix/native 10.3.1 temporarily to test * fix wrong syntax on op-sqlite patch and update mendix/native * add duplicate check for libjsi.so * add libreactnative.so to prevent duplicate * use published version of @mendix/native * remove resolved file and add npm registry
1 parent 162b63c commit d5fb589

5 files changed

Lines changed: 118 additions & 76 deletions

File tree

android/app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ android {
105105
packagingOptions {
106106
pickFirst "**/libc++_shared.so"
107107
pickFirst "**/libcrypto.so"
108+
pickFirst "**/libjsi.so"
109+
pickFirst "**/libreactnative.so"
108110
}
109111
}
110112

ios/Podfile.lock

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,28 @@ PODS:
2626
- libwebp/sharpyuv (1.5.0)
2727
- libwebp/webp (1.5.0):
2828
- libwebp/sharpyuv
29-
- op-sqlite (12.0.2):
29+
- op-sqlite (15.0.7):
30+
- DoubleConversion
31+
- glog
32+
- hermes-engine
3033
- OpenSSL-Universal
31-
- React
32-
- React-callinvoker
34+
- RCT-Folly (= 2024.11.18.00)
35+
- RCTRequired
36+
- RCTTypeSafety
3337
- React-Core
38+
- React-debug
39+
- React-Fabric
40+
- React-featureflags
41+
- React-graphics
42+
- React-ImageManager
43+
- React-NativeModulesApple
44+
- React-RCTFabric
45+
- React-rendererdebug
46+
- React-utils
47+
- ReactCodegen
48+
- ReactCommon/turbomodule/bridging
49+
- ReactCommon/turbomodule/core
50+
- Yoga
3451
- OpenSSL-Universal (3.3.3001)
3552
- RCT-Folly (2024.11.18.00):
3653
- boost
@@ -2110,17 +2127,17 @@ EXTERNAL SOURCES:
21102127

21112128
SPEC CHECKSUMS:
21122129
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
2113-
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
2130+
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
21142131
fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6
21152132
FBLazyVector: 23d8c5470c648a635893dc0956c6dbaead54b656
21162133
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
2117-
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
2134+
glog: eb93e2f488219332457c3c4eafd2738ddc7e80b8
21182135
hermes-engine: b2187dbe13edb0db8fcb2a93a69c1987a30d98a4
21192136
IQKeyboardManager: c8665b3396bd0b79402b4c573eac345a31c7d485
21202137
libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7
21212138
libdav1d: 23581a4d8ec811ff171ed5e2e05cd27bad64c39f
21222139
libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8
2123-
op-sqlite: 7c3a6a7f84f0969b96266dbd143a3793bc2bc9cf
2140+
op-sqlite: bd4cc931ab939b14434fb7a1981a3fd82f5b4bb6
21242141
OpenSSL-Universal: 6082b0bf950e5636fe0d78def171184e2b3899c2
21252142
RCT-Folly: 36fe2295e44b10d831836cc0d1daec5f8abcf809
21262143
RCTDeprecation: 6ee92578d332db1d4e03267d3ae98bcf8b780863
@@ -2205,7 +2222,7 @@ SPEC CHECKSUMS:
22052222
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
22062223
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
22072224
SSZipArchive: 8a6ee5677c8e304bebc109e39cf0da91ccef22ea
2208-
Yoga: 7d51419602153919f32aec72812e324d495ee49d
2225+
Yoga: 92f3bb322c40a86b7233b815854730442e01b8c4
22092226

22102227
PODFILE CHECKSUM: db7be98fae80b54b4f99987282d8e88ba12b8124
22112228

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"dependencies": {
1010
"@d11/react-native-fast-image": "8.11.1",
1111
"@gorhom/bottom-sheet": "^5.1.1",
12-
"@mendix/native": "10.3.0",
12+
"@mendix/native": "10.3.1",
1313
"@notifee/react-native": "9.1.8",
14-
"@op-engineering/op-sqlite": "12.0.2",
14+
"@op-engineering/op-sqlite": "15.0.7",
1515
"@react-native-async-storage/async-storage": "2.0.0",
1616
"@react-native-camera-roll/camera-roll": "7.4.0",
1717
"@react-native-community/cli": "16.0.2",
Lines changed: 82 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
diff --git a/node_modules/@op-engineering/op-sqlite/android/build.gradle b/node_modules/@op-engineering/op-sqlite/android/build.gradle
2-
index 70ebca0..5da8659 100644
2+
index d36fd85..7513556 100644
33
--- a/node_modules/@op-engineering/op-sqlite/android/build.gradle
44
+++ b/node_modules/@op-engineering/op-sqlite/android/build.gradle
55
@@ -1,5 +1,4 @@
66
import java.nio.file.Paths
77
-import groovy.json.JsonSlurper
88

99
buildscript {
10-
repositories {
11-
@@ -27,10 +26,10 @@ def isNewArchitectureEnabled() {
12-
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
10+
ext.getExtOrDefault = {name ->
11+
@@ -27,57 +26,16 @@ def getExtOrIntegerDefault(name) {
12+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OPSQLite_" + name]).toInteger()
1313
}
1414

1515
-def useSQLCipher = false
@@ -21,22 +21,39 @@ index 70ebca0..5da8659 100644
2121
def sqliteFlags = ""
2222
def enableFTS5 = false
2323
def useSqliteVec = false
24-
@@ -38,28 +37,6 @@ def enableRtree = false
24+
def enableRtree = false
2525
def tokenizers = []
2626

27-
def isInsideNodeModules = rootDir.absolutePath.contains("node_modules")
28-
-def packageJson
27+
-// On the example app, the package.json is located at the root of the project
28+
-// On the user app, the package.json is located at the root of the node_modules directory
29+
-def isUserApp = rootDir.absolutePath.contains("node_modules")
30+
-def packageJsonFile
2931
-
30-
-if ( isInsideNodeModules ) {
31-
- def packageJsonFile = new File("$rootDir/../../../package.json")
32-
- packageJson = new JsonSlurper().parseText(packageJsonFile.text)
32+
-if (isUserApp) {
33+
- // Start from the root + 1 level up (to avoid detecting the op-sqlite/package.json) and traverse upwards to find the first package.json
34+
- File currentDir = new File("$rootDir/../")
35+
- packageJsonFile = null
36+
-
37+
- // Try to find package.json by traversing upwards
38+
- while (currentDir != null) {
39+
- File potential = new File(currentDir, "package.json")
40+
- if (potential.exists()) {
41+
- packageJsonFile = potential
42+
- break
43+
- }
44+
- currentDir = currentDir.parentFile
45+
- }
3346
-} else {
34-
- def packageJsonFile = new File("$rootDir/../package.json")
35-
- packageJson = new JsonSlurper().parseText(packageJsonFile.text)
47+
- packageJsonFile = new File("$rootDir/../package.json")
3648
-}
3749
-
50+
-
51+
-def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
52+
-
3853
-def opsqliteConfig = packageJson["op-sqlite"]
54+
-
3955
-if(opsqliteConfig) {
56+
- println "[OP-SQLITE] Detected op-sqlite config from package.json at: " + packageJsonFile.absolutePath
4057
- useSQLCipher = opsqliteConfig["sqlcipher"]
4158
- useCRSQLite = opsqliteConfig["crsqlite"]
4259
- useSqliteVec = opsqliteConfig["sqliteVec"]
@@ -47,11 +64,12 @@ index 70ebca0..5da8659 100644
4764
- enableRtree = opsqliteConfig["rtree"]
4865
- tokenizers = opsqliteConfig["tokenizers"] ? opsqliteConfig["tokenizers"] : []
4966
-}
50-
67+
-
5168
if(useSQLCipher) {
52-
println "[OP-SQLITE] using SQLCipher 🔒"
69+
println "[OP-SQLITE] using sqlcipher."
70+
} else if(useLibsql) {
5371
diff --git a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
54-
index 8feaf77..be0ade9 100644
72+
index 8feaf77..261ec22 100644
5573
--- a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
5674
+++ b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
5775
@@ -19,8 +19,8 @@ struct OPSQLiteBridge : jni::JavaClass<OPSQLiteBridge> {
@@ -61,7 +79,7 @@ index 8feaf77..be0ade9 100644
6179
- makeNativeMethod("clearStateNativeJsi",
6280
- OPSQLiteBridge::clearStateNativeJsi)});
6381
+ makeNativeMethod("clearStateNativeJsi", OPSQLiteBridge::clearStateNativeJsi),
64-
+ makeNativeMethod("deleteAllDBsJsi", OPSQLiteBridge::deleteAllDBsJsi)});
82+
+ makeNativeMethod("deleteAllDBsJsi", OPSQLiteBridge::deleteAllDBsJsi)});
6583
}
6684

6785
private:
@@ -71,25 +89,24 @@ index 8feaf77..be0ade9 100644
7189
}
7290
+
7391
+ static bool deleteAllDBsJsi(jni::alias_ref<jni::JObject> thiz) {
74-
+ return opsqlite::deleteAllDbs();
92+
+ return opsqlite::deleteAllDbs();
7593
+ }
7694
};
7795

7896
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *) {
7997
diff --git a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
80-
index 44f86df..0cb1287 100644
98+
index 44f86df..9d9f710 100644
8199
--- a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
82100
+++ b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
83-
@@ -13,6 +13,8 @@ class OPSQLiteBridge {
101+
@@ -12,6 +12,7 @@ class OPSQLiteBridge {
102+
docPath: String
84103
)
85104
private external fun clearStateNativeJsi()
86-
87105
+ private external fun deleteAllDBsJsi(): Boolean
88-
+
106+
89107
fun install(context: ReactContext) {
90108
val jsContextPointer = context.javaScriptContextHolder!!.get()
91-
val jsCallInvokerHolder =
92-
@@ -31,6 +33,10 @@ class OPSQLiteBridge {
109+
@@ -31,6 +32,10 @@ class OPSQLiteBridge {
93110
clearStateNativeJsi()
94111
}
95112

@@ -101,29 +118,20 @@ index 44f86df..0cb1287 100644
101118
val instance = OPSQLiteBridge()
102119
}
103120
diff --git a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
104-
index fea0aa7..e169fea 100644
121+
index 688832f..9ea814b 100644
105122
--- a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
106123
+++ b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
107-
@@ -6,14 +6,15 @@ import com.facebook.react.bridge.ReactApplicationContext
108-
import com.facebook.react.bridge.ReactMethod
109-
import com.facebook.react.bridge.ReactContextBaseJavaModule
110-
import com.facebook.react.bridge.ReadableMap
111-
+import com.facebook.react.module.annotations.ReactModule
112-
import java.io.File
113-
import java.io.FileOutputStream
114-
import java.io.InputStream
115-
import java.io.OutputStream
124+
@@ -13,7 +13,7 @@ import java.io.OutputStream
116125
import com.facebook.react.util.RNLog;
117126

118-
-//@ReactModule(name = OPSQLiteModule.NAME)
127+
//@ReactModule(name = OPSQLiteModule.NAME)
119128
-internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
120-
+@ReactModule(name = OPSQLiteModule.NAME)
121129
+class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
122130
override fun getName(): String {
123131
return NAME
124132
}
125-
@@ -55,6 +56,16 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
126-
throw Exception("Do not call getDylibPath on Android")
133+
@@ -56,6 +56,17 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
134+
return true
127135
}
128136

129137
+ @ReactMethod(isBlockingSynchronousMethod = true)
@@ -135,15 +143,16 @@ index fea0aa7..e169fea 100644
135143
+ fun deleteAllDBs() {
136144
+ OPSQLiteBridge.instance.deleteAllDBs();
137145
+ }
146+
+
138147
+
139148
@ReactMethod
140149
fun moveAssetsDatabase(args: ReadableMap, promise: Promise) {
141150
val filename = args.getString("filename")!!
142151
diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
143-
index 33e8e25..5843a46 100644
152+
index 85710ee..8cf10f2 100644
144153
--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
145154
+++ b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
146-
@@ -847,6 +847,10 @@ void DBHostObject::invalidate() {
155+
@@ -889,6 +889,10 @@ void DBHostObject::invalidate() {
147156
#endif
148157
}
149158

@@ -155,10 +164,10 @@ index 33e8e25..5843a46 100644
155164

156165
} // namespace opsqlite
157166
diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
158-
index b665ddd..26a561d 100644
167+
index cc174b7..ff36f74 100644
159168
--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
160169
+++ b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
161-
@@ -67,6 +67,7 @@ class JSI_EXPORT DBHostObject : public jsi::HostObject {
170+
@@ -73,6 +73,7 @@ class JSI_EXPORT DBHostObject : public jsi::HostObject {
162171
void on_commit();
163172
void on_rollback();
164173
void invalidate();
@@ -167,7 +176,7 @@ index b665ddd..26a561d 100644
167176

168177
private:
169178
diff --git a/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp b/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
170-
index 3af52b2..90e8ded 100644
179+
index 5e1c1de..dc21c65 100644
171180
--- a/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
172181
+++ b/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
173182
@@ -36,6 +36,13 @@ void invalidate() {
@@ -197,21 +206,17 @@ index 91511ab..cc73dfe 100644
197206

198207
} // namespace opsqlite
199208
diff --git a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
200-
index b8568b9..f547bc0 100644
209+
index 375cc3e..e6fce21 100644
201210
--- a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
202211
+++ b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
203-
@@ -11,20 +11,11 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
204-
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
205-
206-
parent_folder_name = File.basename(__dir__)
207-
-app_package = nil
208-
-# When installed on user node_modules lives inside node_modules/@op-engineering/op-sqlite
209-
-if is_user_app
210-
- app_package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
211-
-# When running on the example app
212-
-else
213-
- app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json")))
214-
-end
212+
@@ -1,4 +1,3 @@
213+
-require "json"
214+
require_relative "./generate_tokenizers_header_file"
215+
216+
log_message = lambda do |message|
217+
@@ -39,11 +38,10 @@ else
218+
app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json")))
219+
end
215220

216221
-op_sqlite_config = app_package["op-sqlite"]
217222
-use_sqlcipher = false
@@ -223,7 +228,7 @@ index b8568b9..f547bc0 100644
223228
phone_version = false
224229
sqlite_flags = ""
225230
fts5 = false
226-
@@ -32,19 +23,6 @@ rtree = false
231+
@@ -51,37 +49,6 @@ rtree = false
227232
use_sqlite_vec = false
228233
tokenizers = []
229234

@@ -240,6 +245,24 @@ index b8568b9..f547bc0 100644
240245
- tokenizers = op_sqlite_config["tokenizers"] || []
241246
-end
242247
-
243-
if phone_version then
244-
if use_sqlcipher then
245-
raise "SQLCipher is not supported with phone version"
248+
-if phone_version then
249+
- if use_sqlcipher then
250+
- raise "SQLCipher is not supported with phone version"
251+
- end
252+
-
253+
- if use_crsqlite then
254+
- raise "CRSQLite is not supported with phone version"
255+
- end
256+
-
257+
- if rtree then
258+
- raise "RTree is not supported with phone version"
259+
- end
260+
-
261+
- if use_sqlite_vec then
262+
- raise "SQLite Vec is not supported with phone version"
263+
- end
264+
-end
265+
-
266+
Pod::Spec.new do |s|
267+
s.name = "op-sqlite"
268+
s.version = package["version"]

0 commit comments

Comments
 (0)