Skip to content

Commit

Permalink
Merge pull request #20 from powersync-ja/hotfix-036
Browse files Browse the repository at this point in the history
powersync-sqlite-core 0.3.6
  • Loading branch information
rkistner authored Nov 11, 2024
2 parents 59c792f + f23bd69 commit 66de069
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 100 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-mirrors-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@journeyapps/wa-sqlite": patch
---

Use powersync-sqlite-core 0.3.6 to fix dangling rows
40 changes: 19 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ OBJ_FILES_DIST = $(patsubst %.c,tmp/obj/dist/%.o,$(CFILES))

RS_LIB = powersync
RS_LIB_DIR = ./powersync-sqlite-core
RS_WASM_TGT = wasm32-unknown-emscripten
RS_WASM_TGT_DIR = ${RS_LIB_DIR}/target/$(RS_WASM_TGT)
RS_RELEASE_BC = $(RS_WASM_TGT_DIR)/wasm/deps/$(RS_LIB).bc
RS_DEBUG_BC = $(RS_WASM_TGT_DIR)/debug/deps/$(RS_LIB).bc
RS_RELEASE_LIB = $(RS_LIB_DIR)/target/wasm32-wasi/wasm/libpowersync.a

# build options
EMCC ?= emcc
Expand Down Expand Up @@ -166,15 +163,16 @@ tmp/obj/dist/%.o: %.c
mkdir -p tmp/obj/dist
$(EMCC) $(CFLAGS_DIST) $(WASQLITE_DEFINES) $^ -c -o $@

$(RS_DEBUG_BC): FORCE
$(RS_RELEASE_LIB): FORCE
mkdir -p tmp/bc/dist
cd $(RS_LIB_DIR); \
RUSTFLAGS="--emit=llvm-bc -C linker=/bin/true" cargo build -p powersync_loadable --profile wasm --no-default-features --features "powersync_core/static powersync_core/omit_load_extension sqlite_nostd/static sqlite_nostd/omit_load_extension" -Z build-std=panic_abort,core,alloc --target $(RS_WASM_TGT)

$(RS_RELEASE_BC): FORCE
mkdir -p tmp/bc/dist
cd $(RS_LIB_DIR); \
RUSTFLAGS="--emit=llvm-bc -C linker=/bin/true" cargo build -p powersync_loadable --profile wasm --no-default-features --features "powersync_core/static powersync_core/omit_load_extension sqlite_nostd/static sqlite_nostd/omit_load_extension" -Z build-std=panic_abort,core,alloc --target $(RS_WASM_TGT)
cargo build \
-p powersync_loadable \
--profile wasm \
--no-default-features \
--features "powersync_core/static powersync_core/omit_load_extension sqlite_nostd/omit_load_extension" \
-Z build-std=panic_abort,core,alloc \
--target wasm32-wasi


## debug
Expand All @@ -185,22 +183,22 @@ clean-debug:
.PHONY: debug
debug: debug/wa-sqlite.mjs debug/wa-sqlite-async.mjs

debug/wa-sqlite.mjs: $(OBJ_FILES_DEBUG) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
debug/wa-sqlite.mjs: $(OBJ_FILES_DEBUG) $(RS_RELEASE_LIB) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
mkdir -p debug
$(EMCC) $(EMFLAGS_DEBUG) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(RS_WASM_TGT_DIR)/debug/deps/*.bc \
$(OBJ_FILES_DEBUG) *.o -o $@
$(RS_RELEASE_LIB) \
$(OBJ_FILES_DEBUG) -o $@

debug/wa-sqlite-async.mjs: $(OBJ_FILES_DEBUG) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
debug/wa-sqlite-async.mjs: $(OBJ_FILES_DEBUG) $(RS_RELEASE_LIB) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
mkdir -p debug
$(EMCC) $(EMFLAGS_DEBUG) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(EMFLAGS_ASYNCIFY_DEBUG) \
$(RS_WASM_TGT_DIR)/debug/deps/*.bc \
$(OBJ_FILES_DEBUG) *.o -o $@
$(RS_RELEASE_LIB) \
$(OBJ_FILES_DEBUG) -o $@

## Debug FTS builds
# .PHONY: debug
Expand Down Expand Up @@ -231,22 +229,22 @@ clean-dist:
.PHONY: dist
dist: dist/wa-sqlite.mjs dist/wa-sqlite-async.mjs

dist/wa-sqlite.mjs: $(OBJ_FILES_DIST) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
dist/wa-sqlite.mjs: $(OBJ_FILES_DIST) $(RS_RELEASE_LIB) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
mkdir -p dist
$(EMCC) $(EMFLAGS_DIST) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(RS_WASM_TGT_DIR)/wasm/deps/*.bc \
$(RS_RELEASE_LIB) \
$(OBJ_FILES_DIST) -o $@

dist/wa-sqlite-async.mjs: $(OBJ_FILES_DIST) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
dist/wa-sqlite-async.mjs: $(OBJ_FILES_DIST) $(RS_RELEASE_LIB) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
mkdir -p dist
$(EMCC) $(EMFLAGS_DIST) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(EMFLAGS_ASYNCIFY_DIST) \
$(CFLAGS_DIST) \
$(RS_WASM_TGT_DIR)/wasm/deps/*.bc \
$(RS_RELEASE_LIB) \
$(OBJ_FILES_DIST) -o $@

FORCE: ;
Expand Down
Loading

0 comments on commit 66de069

Please sign in to comment.