Skip to content

Commit a630ead

Browse files
authored
Merge pull request #1147 from mendix/moo/MOO-2075-android-16kb-opsqlite
[MOO-2075]: OPSqlite - Android 16kb pages compatibility
2 parents c8c99a1 + 43b998d commit a630ead

6 files changed

Lines changed: 97 additions & 63 deletions

File tree

.github/workflows/android-build-custom-dev-app.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ jobs:
2929
- name: npm install
3030
run: npm ci
3131

32-
- name: Add NDK 26.1.10909125
33-
run: echo "y" | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;26.1.10909125"
34-
32+
- name: Add NDK 27.3.13750724
33+
run: echo "y" | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;27.3.13750724"
3534
- name: Build with Gradle
3635
run: ./gradlew assembleDevDebug
3736
working-directory: ./android

android/build.gradle

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
androidXCore = "1.6.0"
1313
androidXBrowser = "1.3.0"
1414

15-
ndkVersion = "26.1.10909125"
15+
ndkVersion = "27.3.13750724"
1616
}
1717
repositories {
1818
google()
@@ -84,6 +84,31 @@ allprojects {
8484
maven {
8585
url "$rootDir/../node_modules/@notifee/react-native/android/libs"
8686
}
87+
88+
// Build all modules with Android 16KB pages enabled
89+
plugins.withId('com.android.application') {
90+
android {
91+
defaultConfig {
92+
externalNativeBuild {
93+
cmake {
94+
arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
95+
}
96+
}
97+
}
98+
}
99+
}
100+
101+
plugins.withId('com.android.library') {
102+
android {
103+
defaultConfig {
104+
externalNativeBuild {
105+
cmake {
106+
arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
107+
}
108+
}
109+
}
110+
}
111+
}
87112
}
88113
}
89114

ios/Podfile.lock

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ PODS:
5252
- RNCAsyncStorage
5353
- SSZipArchive
5454
- Yoga
55-
- op-sqlite (15.0.7):
55+
- op-sqlite (15.1.5):
5656
- DoubleConversion
5757
- glog
5858
- hermes-engine
59-
- OpenSSL-Universal
6059
- RCT-Folly (= 2024.11.18.00)
6160
- RCTRequired
6261
- RCTTypeSafety
@@ -74,7 +73,6 @@ PODS:
7473
- ReactCommon/turbomodule/bridging
7574
- ReactCommon/turbomodule/core
7675
- Yoga
77-
- OpenSSL-Universal (3.3.3001)
7876
- RCT-Folly (2024.11.18.00):
7977
- boost
8078
- DoubleConversion
@@ -2237,9 +2235,9 @@ PODS:
22372235
- ReactCommon/turbomodule/bridging
22382236
- ReactCommon/turbomodule/core
22392237
- Yoga
2240-
- SDWebImage (5.21.2):
2241-
- SDWebImage/Core (= 5.21.2)
2242-
- SDWebImage/Core (5.21.2)
2238+
- SDWebImage (5.21.3):
2239+
- SDWebImage/Core (= 5.21.3)
2240+
- SDWebImage/Core (5.21.3)
22432241
- SDWebImageAVIFCoder (0.11.1):
22442242
- libavif/core (>= 0.11.0)
22452243
- SDWebImage (~> 5.10)
@@ -2350,7 +2348,6 @@ SPEC REPOS:
23502348
- libavif
23512349
- libdav1d
23522350
- libwebp
2353-
- OpenSSL-Universal
23542351
- SDWebImage
23552352
- SDWebImageAVIFCoder
23562353
- SDWebImageWebPCoder
@@ -2549,8 +2546,7 @@ SPEC CHECKSUMS:
25492546
libdav1d: 23581a4d8ec811ff171ed5e2e05cd27bad64c39f
25502547
libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8
25512548
MendixNative: 358ef00fc883a39da69680c6c2a09ecf85a0b887
2552-
op-sqlite: 12554de3e1a0cb86cbad3cf1f0c50450f57d3855
2553-
OpenSSL-Universal: 6082b0bf950e5636fe0d78def171184e2b3899c2
2549+
op-sqlite: a8239b295e2fad068d587c16d6c41d1ffd98ede8
25542550
RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82
25552551
RCTDeprecation: be794de7dc6ed8f9f7fbf525f86e7651b8b68746
25562552
RCTRequired: a83787b092ec554c2eb6019ff3f5b8d125472b3b
@@ -2629,7 +2625,7 @@ SPEC CHECKSUMS:
26292625
RNScreens: 0d4cb9afe052607ad0aa71f645a88bb7c7f2e64c
26302626
RNSVG: 8ad5c94593e5e4a6e133e6934e2188e3c688d27a
26312627
RNVectorIcons: bd818296a51dc2bb8c3bd97a3ca399df1afe216d
2632-
SDWebImage: 9f177d83116802728e122410fb25ad88f5c7608a
2628+
SDWebImage: 16309af6d214ba3f77a7c6f6fdda888cb313a50a
26332629
SDWebImageAVIFCoder: afe194a084e851f70228e4be35ef651df0fc5c57
26342630
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
26352631
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748

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
@@ -10,8 +10,8 @@
1010
"dependencies": {
1111
"@d11/react-native-fast-image": "8.11.1",
1212
"@gorhom/bottom-sheet": "5.1.1",
13-
"mendix-native": "https://github.com/mendix/mendix-native/releases/download/v0.3.1/mendix-native-v0.3.1.tgz",
14-
"@op-engineering/op-sqlite": "15.0.7",
13+
"mendix-native": "https://github.com/mendix/mendix-native/releases/download/v0.3.2/mendix-native-v0.3.2.tgz",
14+
"@op-engineering/op-sqlite": "15.1.5",
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": "18.0.1",

patches/@op-engineering+op-sqlite+15.0.7.patch renamed to patches/@op-engineering+op-sqlite+15.1.5.patch

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 d36fd85..7513556 100644
2+
index 7df016d..dc94a38 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 @@
@@ -69,7 +69,7 @@ index d36fd85..7513556 100644
6969
println "[OP-SQLITE] using sqlcipher."
7070
} else if(useLibsql) {
7171
diff --git a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
72-
index 8feaf77..261ec22 100644
72+
index 5912d7b..f2cb85b 100644
7373
--- a/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
7474
+++ b/node_modules/@op-engineering/op-sqlite/android/cpp-adapter.cpp
7575
@@ -19,8 +19,8 @@ struct OPSQLiteBridge : jni::JavaClass<OPSQLiteBridge> {
@@ -79,7 +79,7 @@ index 8feaf77..261ec22 100644
7979
- makeNativeMethod("clearStateNativeJsi",
8080
- OPSQLiteBridge::clearStateNativeJsi)});
8181
+ makeNativeMethod("clearStateNativeJsi", OPSQLiteBridge::clearStateNativeJsi),
82-
+ makeNativeMethod("deleteAllDBsJsi", OPSQLiteBridge::deleteAllDBsJsi)});
82+
+ makeNativeMethod("deleteAllDBsJsi", OPSQLiteBridge::deleteAllDBsJsi)});
8383
}
8484

8585
private:
@@ -89,7 +89,7 @@ index 8feaf77..261ec22 100644
8989
}
9090
+
9191
+ static bool deleteAllDBsJsi(jni::alias_ref<jni::JObject> thiz) {
92-
+ return opsqlite::deleteAllDbs();
92+
+ return opsqlite::deleteAllDbs();
9393
+ }
9494
};
9595

@@ -118,20 +118,20 @@ index 44f86df..9d9f710 100644
118118
val instance = OPSQLiteBridge()
119119
}
120120
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
121-
index 688832f..9ea814b 100644
121+
index 49a01b9..bdfa829 100644
122122
--- a/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
123123
+++ b/node_modules/@op-engineering/op-sqlite/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
124-
@@ -13,7 +13,7 @@ import java.io.OutputStream
124+
@@ -12,7 +12,7 @@ import java.io.InputStream
125+
import java.io.OutputStream
125126
import com.facebook.react.util.RNLog;
126127

127-
//@ReactModule(name = OPSQLiteModule.NAME)
128128
-internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
129129
+class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
130130
override fun getName(): String {
131131
return NAME
132132
}
133-
@@ -56,6 +56,17 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
134-
return true
133+
@@ -54,6 +54,16 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
134+
throw Exception("Do not call getDylibPath on Android")
135135
}
136136

137137
+ @ReactMethod(isBlockingSynchronousMethod = true)
@@ -143,16 +143,15 @@ index 688832f..9ea814b 100644
143143
+ fun deleteAllDBs() {
144144
+ OPSQLiteBridge.instance.deleteAllDBs();
145145
+ }
146-
+
147146
+
148147
@ReactMethod
149148
fun moveAssetsDatabase(args: ReadableMap, promise: Promise) {
150149
val filename = args.getString("filename")!!
151150
diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
152-
index 85710ee..8cf10f2 100644
151+
index eadea09..5701d15 100644
153152
--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
154153
+++ b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.cpp
155-
@@ -889,6 +889,10 @@ void DBHostObject::invalidate() {
154+
@@ -675,6 +675,10 @@ void DBHostObject::invalidate() {
156155
#endif
157156
}
158157

@@ -164,23 +163,23 @@ index 85710ee..8cf10f2 100644
164163

165164
} // namespace opsqlite
166165
diff --git a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h b/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
167-
index cc174b7..ff36f74 100644
166+
index 68a9bc4..142e9d9 100644
168167
--- a/node_modules/@op-engineering/op-sqlite/cpp/DBHostObject.h
169168
+++ b/node_modules/@op-engineering/op-sqlite/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/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp b/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
179-
index 5e1c1de..dc21c65 100644
180-
--- a/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
181-
+++ b/node_modules/@op-engineering/op-sqlite/cpp/bindings.cpp
182-
@@ -36,6 +36,13 @@ void invalidate() {
183-
dbs.clear();
176+
private:
177+
diff --git a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.cpp b/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.cpp
178+
index e33579a..791fa70 100644
179+
--- a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.cpp
180+
+++ b/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.cpp
181+
@@ -42,6 +42,13 @@ void invalidate() {
182+
dbs.clear();
184183
}
185184

186185
+bool deleteAllDbs() {
@@ -191,12 +190,12 @@ index 5e1c1de..dc21c65 100644
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/node_modules/@op-engineering/op-sqlite/cpp/bindings.h b/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
195+
diff --git a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.hpp b/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.hpp
197196
index 91511ab..cc73dfe 100644
198-
--- a/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
199-
+++ b/node_modules/@op-engineering/op-sqlite/cpp/bindings.h
197+
--- a/node_modules/@op-engineering/op-sqlite/cpp/OPSqlite.hpp
198+
+++ b/node_modules/@op-engineering/op-sqlite/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,18 +205,33 @@ index 91511ab..cc73dfe 100644
206205

207206
} // namespace opsqlite
208207
diff --git a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
209-
index 375cc3e..e6fce21 100644
208+
index 32906a2..4a1e452 100644
210209
--- a/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
211210
+++ b/node_modules/@op-engineering/op-sqlite/op-sqlite.podspec
212-
@@ -1,4 +1,3 @@
211+
@@ -1,12 +1,13 @@
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")))
216+
puts "\e[34m#{message}\e[0m"
219217
end
220218

219+
+# NOTE: Disabled as redundant for now, re-enable if needed
220+
# In the sample app the dir is not inside of node_modules
221+
-is_user_app = __dir__.include?("node_modules")
222+
+# is_user_app = __dir__.include?("node_modules")
223+
+is_user_app = false
224+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
225+
app_package = nil
226+
package_json_path = nil
227+
@@ -32,13 +33,13 @@ else
228+
package_json_path = File.join(__dir__, "example", "package.json")
229+
end
230+
231+
-app_package = JSON.parse(File.read(package_json_path))
232+
+# NOTE: Disabled as redundant for now, re-enable if needed
233+
+# app_package = JSON.parse(File.read(package_json_path))
234+
221235
-op_sqlite_config = app_package["op-sqlite"]
222236
-use_sqlcipher = false
223237
+use_sqlcipher = true
@@ -228,7 +242,7 @@ index 375cc3e..e6fce21 100644
228242
phone_version = false
229243
sqlite_flags = ""
230244
fts5 = false
231-
@@ -51,37 +49,6 @@ rtree = false
245+
@@ -46,37 +47,6 @@ rtree = false
232246
use_sqlite_vec = false
233247
tokenizers = []
234248

@@ -247,19 +261,19 @@ index 375cc3e..e6fce21 100644
247261
-
248262
-if phone_version then
249263
- if use_sqlcipher then
250-
- raise "SQLCipher is not supported with phone version"
264+
- raise "SQLCipher is not supported with phone version. It cannot load extensions."
251265
- end
252266
-
253267
- if use_crsqlite then
254-
- raise "CRSQLite is not supported with phone version"
268+
- raise "CRSQLite is not supported with phone version. It cannot load extensions."
255269
- end
256270
-
257271
- if rtree then
258-
- raise "RTree is not supported with phone version"
272+
- raise "RTree is not supported with phone version. It cannot load extensions."
259273
- end
260274
-
261275
- if use_sqlite_vec then
262-
- raise "SQLite Vec is not supported with phone version"
276+
- raise "SQLite Vec is not supported with phone version. It cannot load extensions."
263277
- end
264278
-end
265279
-

0 commit comments

Comments
 (0)