Skip to content

Commit

Permalink
Merge pull request #204 from OP-Engineering/oscar/per-db-thread
Browse files Browse the repository at this point in the history
Concurrency model change
  • Loading branch information
ospfranco authored Dec 20, 2024
2 parents 6142f70 + 12bab2f commit 48483f0
Show file tree
Hide file tree
Showing 38 changed files with 6,691 additions and 4,088 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ android/gradle/
!.yarn/sdks
!.yarn/versions

android/c_sources
android/c_sources
# Android does not generate the sources on its own, leave this in for CI
# c_sources/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20
21 changes: 5 additions & 16 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ project(OPSQLite)
cmake_minimum_required(VERSION 3.9.0)

set (PACKAGE_NAME "op-sqlite")
set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 20)
set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)

include_directories(
../cpp
../cpp/sqlcipher
../cpp/libsql
# ../example/c_sources
)
include_directories(
../cpp
../cpp/sqlcipher
../cpp/libsql
)

add_definitions(
${SQLITE_FLAGS}
Expand Down Expand Up @@ -62,13 +58,6 @@ if (USE_SQLITE_VEC)
)
endif()

set_target_properties(
${PACKAGE_NAME} PROPERTIES
CXX_STANDARD 20
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
)

find_package(ReactAndroid REQUIRED CONFIG)
find_package(fbjni REQUIRED CONFIG)
find_library(LOG_LIB log)
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ android {
tokenizersHeaderPath = "../c_sources/tokenizers.h"
}

cppFlags "-O2", "-fexceptions", "-DONANDROID"
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
arguments "-DANDROID_STL=c++_shared",
"-DSQLITE_FLAGS='$sqliteFlags'",
Expand Down
2 changes: 1 addition & 1 deletion android/cpp-adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct OPSQLiteBridge : jni::JavaClass<OPSQLiteBridge> {
}

static void clearStateNativeJsi(jni::alias_ref<jni::JObject> thiz) {
opsqlite::clearState();
opsqlite::invalidate();
}
};

Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class OPSQLiteBridge {
)
}

fun clearState() {
fun invalidate() {
clearStateNativeJsi()
}

Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB

override fun invalidate() {
super.invalidate()
OPSQLiteBridge.instance.clearState()
OPSQLiteBridge.instance.invalidate()
}

companion object {
Expand Down
Loading

0 comments on commit 48483f0

Please sign in to comment.