Skip to content

Commit deaddae

Browse files
committed
chore: fix op-sqlite patch file
1 parent d86305d commit deaddae

3 files changed

Lines changed: 73 additions & 52 deletions

File tree

.yarn/patches/@op-engineering-op-sqlite-npm-15.0.7-39fbf4933a.patch renamed to .yarn/patches/@op-engineering-op-sqlite-npm-15.2.5-936f5cf3a5.patch

Lines changed: 62 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/android/build.gradle b/android/build.gradle
2-
index d36fd855813e87b17da43156be64782b325b2733..751355645c0b6e28e2df01e9bdc32f545d8dc83c 100644
2+
index 08631df..9ef3a95 100644
33
--- a/android/build.gradle
44
+++ b/android/build.gradle
55
@@ -1,5 +1,4 @@
@@ -8,7 +8,7 @@ index d36fd855813e87b17da43156be64782b325b2733..751355645c0b6e28e2df01e9bdc32f54
88

99
buildscript {
1010
ext.getExtOrDefault = {name ->
11-
@@ -27,57 +26,16 @@ def getExtOrIntegerDefault(name) {
11+
@@ -27,56 +26,16 @@ def getExtOrIntegerDefault(name) {
1212
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OPSQLite_" + name]).toInteger()
1313
}
1414

@@ -33,7 +33,7 @@ index d36fd855813e87b17da43156be64782b325b2733..751355645c0b6e28e2df01e9bdc32f54
3333
- // Start from the root + 1 level up (to avoid detecting the op-sqlite/package.json) and traverse upwards to find the first package.json
3434
- File currentDir = new File("$rootDir/../")
3535
- packageJsonFile = null
36-
-
36+
-
3737
- // Try to find package.json by traversing upwards
3838
- while (currentDir != null) {
3939
- File potential = new File(currentDir, "package.json")
@@ -54,22 +54,21 @@ index d36fd855813e87b17da43156be64782b325b2733..751355645c0b6e28e2df01e9bdc32f54
5454
-
5555
-if(opsqliteConfig) {
5656
- println "[OP-SQLITE] Detected op-sqlite config from package.json at: " + packageJsonFile.absolutePath
57-
- useSQLCipher = opsqliteConfig["sqlcipher"]
58-
- useCRSQLite = opsqliteConfig["crsqlite"]
59-
- useSqliteVec = opsqliteConfig["sqliteVec"]
57+
- useSQLCipher = !!opsqliteConfig["sqlcipher"]
58+
- useCRSQLite = !!opsqliteConfig["crsqlite"]
59+
- useSqliteVec = !!opsqliteConfig["sqliteVec"]
6060
- performanceMode = opsqliteConfig["performanceMode"]
6161
- sqliteFlags = opsqliteConfig["sqliteFlags"] ? opsqliteConfig["sqliteFlags"] : ""
62-
- enableFTS5 = opsqliteConfig["fts5"]
63-
- useLibsql = opsqliteConfig["libsql"]
64-
- enableRtree = opsqliteConfig["rtree"]
62+
- enableFTS5 = !!opsqliteConfig["fts5"]
63+
- useLibsql = !!opsqliteConfig["libsql"]
64+
- enableRtree = !!opsqliteConfig["rtree"]
6565
- tokenizers = opsqliteConfig["tokenizers"] ? opsqliteConfig["tokenizers"] : []
6666
-}
67-
-
67+
6868
if(useSQLCipher) {
6969
println "[OP-SQLITE] using sqlcipher."
70-
} else if(useLibsql) {
7170
diff --git a/android/cpp-adapter.cpp b/android/cpp-adapter.cpp
72-
index 8feaf7719661ef248113f11b1643deedb4b510af..2393963bf982f80ccff2ed396f1538be7ee18fcb 100644
71+
index 5912d7b..495880e 100644
7372
--- a/android/cpp-adapter.cpp
7473
+++ b/android/cpp-adapter.cpp
7574
@@ -19,8 +19,8 @@ struct OPSQLiteBridge : jni::JavaClass<OPSQLiteBridge> {
@@ -95,7 +94,7 @@ index 8feaf7719661ef248113f11b1643deedb4b510af..2393963bf982f80ccff2ed396f1538be
9594

9695
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *) {
9796
diff --git a/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt b/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
98-
index 44f86df6a21a6f7272b2c79b196586ef8fec886b..9d9f7100fd34361701b2addf09a4f36e33b35d56 100644
97+
index 44f86df..9d9f710 100644
9998
--- a/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
10099
+++ b/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
101100
@@ -12,6 +12,7 @@ class OPSQLiteBridge {
@@ -118,20 +117,20 @@ index 44f86df6a21a6f7272b2c79b196586ef8fec886b..9d9f7100fd34361701b2addf09a4f36e
118117
val instance = OPSQLiteBridge()
119118
}
120119
diff --git a/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt b/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
121-
index 688832fa2f9a7f91d16cd50495caa8c9f8873864..9ea814bfa63f27356e804b82e941b7121152db3a 100644
120+
index 8d341b7..3ce6179 100644
122121
--- a/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
123122
+++ b/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
124-
@@ -13,7 +13,7 @@ import java.io.OutputStream
123+
@@ -12,7 +12,7 @@ import java.io.InputStream
124+
import java.io.OutputStream
125125
import com.facebook.react.util.RNLog;
126126

127-
//@ReactModule(name = OPSQLiteModule.NAME)
128127
-internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
129128
+class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
130129
override fun getName(): String {
131130
return NAME
132131
}
133-
@@ -56,6 +56,17 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
134-
return true
132+
@@ -54,6 +54,17 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
133+
throw Exception("Do not call getDylibPath on Android")
135134
}
136135

137136
+ @ReactMethod(isBlockingSynchronousMethod = true)
@@ -149,10 +148,10 @@ index 688832fa2f9a7f91d16cd50495caa8c9f8873864..9ea814bfa63f27356e804b82e941b712
149148
fun moveAssetsDatabase(args: ReadableMap, promise: Promise) {
150149
val filename = args.getString("filename")!!
151150
diff --git a/cpp/DBHostObject.cpp b/cpp/DBHostObject.cpp
152-
index 85710eea286d45685aa526ed3851e8f1e1411039..8cf10f21ba467dea430aab106d43dd4e2adeacd6 100644
151+
index 9682941..c0b9c21 100644
153152
--- a/cpp/DBHostObject.cpp
154153
+++ b/cpp/DBHostObject.cpp
155-
@@ -889,6 +889,10 @@ void DBHostObject::invalidate() {
154+
@@ -682,6 +682,10 @@ void DBHostObject::invalidate() {
156155
#endif
157156
}
158157

@@ -164,23 +163,23 @@ index 85710eea286d45685aa526ed3851e8f1e1411039..8cf10f21ba467dea430aab106d43dd4e
164163

165164
} // namespace opsqlite
166165
diff --git a/cpp/DBHostObject.h b/cpp/DBHostObject.h
167-
index cc174b7c8c5ce500a6ffe5dc6fe092d282d2554c..ff36f742a22b8a84f37d6dd28441dbe9d0c6c873 100644
166+
index 002b8c9..f3a2e1f 100644
168167
--- a/cpp/DBHostObject.h
169168
+++ b/cpp/DBHostObject.h
170-
@@ -73,6 +73,7 @@ class JSI_EXPORT DBHostObject : public jsi::HostObject {
171-
void on_commit();
172-
void on_rollback();
173-
void invalidate();
174-
+ void drop();
175-
~DBHostObject() override;
169+
@@ -68,6 +68,7 @@ public:
170+
void on_commit();
171+
void on_rollback();
172+
void invalidate();
173+
+ void drop();
174+
~DBHostObject() override;
176175

177-
private:
178-
diff --git a/cpp/bindings.cpp b/cpp/bindings.cpp
179-
index 5e1c1de234e7bdb131769728fc862d389f9995a5..dc21c6503ffe18f3ae1cf99f327e8aa1fc587b71 100644
180-
--- a/cpp/bindings.cpp
181-
+++ b/cpp/bindings.cpp
182-
@@ -36,6 +36,13 @@ void invalidate() {
183-
dbs.clear();
176+
private:
177+
diff --git a/cpp/OPSqlite.cpp b/cpp/OPSqlite.cpp
178+
index e33579a..791fa70 100644
179+
--- a/cpp/OPSqlite.cpp
180+
+++ b/cpp/OPSqlite.cpp
181+
@@ -42,6 +42,13 @@ void invalidate() {
182+
dbs.clear();
184183
}
185184

186185
+bool deleteAllDbs() {
@@ -191,12 +190,12 @@ index 5e1c1de234e7bdb131769728fc862d389f9995a5..dc21c6503ffe18f3ae1cf99f327e8aa1
191190
+}
192191
+
193192
void install(jsi::Runtime &rt,
194-
const std::shared_ptr<react::CallInvoker> &invoker,
193+
const std::shared_ptr<react::CallInvoker> &_invoker,
195194
const char *base_path, const char *crsqlite_path,
196-
diff --git a/cpp/bindings.h b/cpp/bindings.h
197-
index 91511ab8dff0cbd34c6b8b844c1783c39d4317cb..cc73dfe4405d568cbfbbfa5a9c879a1d88f260bf 100644
198-
--- a/cpp/bindings.h
199-
+++ b/cpp/bindings.h
195+
diff --git a/cpp/OPSqlite.hpp b/cpp/OPSqlite.hpp
196+
index 91511ab..cc73dfe 100644
197+
--- a/cpp/OPSqlite.hpp
198+
+++ b/cpp/OPSqlite.hpp
200199
@@ -14,6 +14,7 @@ void install(jsi::Runtime &rt,
201200
const char *base_path, const char *crsqlite_path,
202201
const char *sqlite_vec_path);
@@ -206,17 +205,17 @@ index 91511ab8dff0cbd34c6b8b844c1783c39d4317cb..cc73dfe4405d568cbfbbfa5a9c879a1d
206205

207206
} // namespace opsqlite
208207
diff --git a/op-sqlite.podspec b/op-sqlite.podspec
209-
index 375cc3ef0838a3cffb87ec970f636880a8676bb3..e6fce21630ed00aa863f2baae7b3d04de783dcb0 100644
208+
index e717811..147f516 100644
210209
--- a/op-sqlite.podspec
211210
+++ b/op-sqlite.podspec
212211
@@ -1,4 +1,3 @@
213212
-require "json"
214213
require_relative "./generate_tokenizers_header_file"
215214

216215
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
216+
@@ -38,11 +37,10 @@ end
217+
218+
app_package = JSON.parse(File.read(package_json_path))
220219

221220
-op_sqlite_config = app_package["op-sqlite"]
222221
-use_sqlcipher = false
@@ -228,7 +227,7 @@ index 375cc3ef0838a3cffb87ec970f636880a8676bb3..e6fce21630ed00aa863f2baae7b3d04d
228227
phone_version = false
229228
sqlite_flags = ""
230229
fts5 = false
231-
@@ -51,37 +49,6 @@ rtree = false
230+
@@ -50,36 +48,7 @@ rtree = false
232231
use_sqlite_vec = false
233232
tokenizers = []
234233

@@ -247,22 +246,34 @@ index 375cc3ef0838a3cffb87ec970f636880a8676bb3..e6fce21630ed00aa863f2baae7b3d04d
247246
-
248247
-if phone_version then
249248
- if use_sqlcipher then
250-
- raise "SQLCipher is not supported with phone version"
249+
- raise "SQLCipher is not supported with phone version. It cannot load extensions."
251250
- end
252251
-
253252
- if use_crsqlite then
254-
- raise "CRSQLite is not supported with phone version"
253+
- raise "CRSQLite is not supported with phone version. It cannot load extensions."
255254
- end
256-
-
255+
257256
- if rtree then
258-
- raise "RTree is not supported with phone version"
257+
- raise "RTree is not supported with phone version. It cannot load extensions."
259258
- end
260259
-
261260
- if use_sqlite_vec then
262-
- raise "SQLite Vec is not supported with phone version"
261+
- raise "SQLite Vec is not supported with phone version. It cannot load extensions."
263262
- end
264263
-end
265-
-
264+
266265
Pod::Spec.new do |s|
267266
s.name = "op-sqlite"
268-
s.version = package["version"]
267+
@@ -158,12 +127,6 @@ Pod::Spec.new do |s|
268+
xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " SQLITE_ENABLE_RTREE=1"
269+
end
270+
271+
- if phone_version then
272+
- log_message.call("[OP-SQLITE] using iOS embedded SQLite 📱")
273+
- xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_PHONE_VERSION=1"
274+
- exclude_files += ["cpp/sqlite3.c", "cpp/sqlite3.h"]
275+
- s.library = "sqlite3"
276+
- end
277+
278+
if performance_mode then
279+
log_message.call("[OP-SQLITE] Performance mode enabled")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,6 @@
176176
"version": "0.55.1"
177177
},
178178
"resolutions": {
179-
"@op-engineering/op-sqlite@15.0.7": "patch:@op-engineering/op-sqlite@npm%3A15.0.7#./.yarn/patches/@op-engineering-op-sqlite-npm-15.0.7-39fbf4933a.patch"
179+
"@op-engineering/op-sqlite@15.2.5": "patch:@op-engineering/op-sqlite@npm%3A15.2.5#./.yarn/patches/@op-engineering-op-sqlite-npm-15.2.5-936f5cf3a5.patch"
180180
}
181181
}

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2909,6 +2909,16 @@ __metadata:
29092909
languageName: node
29102910
linkType: hard
29112911

2912+
"@op-engineering/op-sqlite@patch:@op-engineering/op-sqlite@npm%3A15.2.5#./.yarn/patches/@op-engineering-op-sqlite-npm-15.2.5-936f5cf3a5.patch::locator=mendix-native%40workspace%3A.":
2913+
version: 15.2.5
2914+
resolution: "@op-engineering/op-sqlite@patch:@op-engineering/op-sqlite@npm%3A15.2.5#./.yarn/patches/@op-engineering-op-sqlite-npm-15.2.5-936f5cf3a5.patch::version=15.2.5&hash=3aa266&locator=mendix-native%40workspace%3A."
2915+
peerDependencies:
2916+
react: "*"
2917+
react-native: "*"
2918+
checksum: 10/eda7022712e2aa6debd39e067e85901fabc2ea700d1a9fdb5f8d8558a381f10c2d37487ecb6dd460b69a3376df5aef04df836a8315d5e114d86255da013cd93e
2919+
languageName: node
2920+
linkType: hard
2921+
29122922
"@phun-ky/typeof@npm:2.0.3":
29132923
version: 2.0.3
29142924
resolution: "@phun-ky/typeof@npm:2.0.3"

0 commit comments

Comments
 (0)