Skip to content

Commit 142008f

Browse files
committed
Use loadable build for static libraries
1 parent 9329d5f commit 142008f

File tree

7 files changed

+13
-20
lines changed

7 files changed

+13
-20
lines changed

.github/actions/android/action.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,18 @@ runs:
6161
path: android/build/distributions/powersync_android.zip
6262
if-no-files-found: error
6363

64-
- name: Copy static libraries
64+
- name: Copy individual libraries
6565
shell: bash
6666
run: |
67-
cp target/aarch64-linux-android/release/libpowersync.a libpowersync_aarch64.android.a
6867
cp target/aarch64-linux-android/release/libpowersync.so libpowersync_aarch64.android.so
69-
70-
cp target/armv7-linux-androideabi/release/libpowersync.a libpowersync_armv7.android.a
7168
cp target/armv7-linux-androideabi/release/libpowersync.so libpowersync_armv7.android.so
72-
73-
cp target/i686-linux-android/release/libpowersync.a libpowersync_x86.android.a
7469
cp target/i686-linux-android/release/libpowersync.so libpowersync_x86.android.so
75-
76-
cp target/x86_64-linux-android/release/libpowersync.a libpowersync_x64.android.a
7770
cp target/x86_64-linux-android/release/libpowersync.so libpowersync_x64.android.so
7871
79-
- name: Upload static libraries
72+
- name: Upload individual libraries
8073
uses: actions/upload-artifact@v4
8174
with:
8275
name: android-static
8376
retention-days: 14
8477
path: |
85-
*.a
8678
*.so

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ jobs:
185185
with:
186186
name: android-static
187187

188+
- name: Create archive of static libs for Kotlin
189+
run: zip static_libs.zip *.lib *.a
190+
188191
- name: List libraries
189192
run: ls -al
190193

@@ -194,10 +197,9 @@ jobs:
194197
GH_REPO: ${{ github.repository }}
195198
run: |
196199
gh release upload "${{ needs.draft_release.outputs.tag }}" *.dll
197-
gh release upload "${{ needs.draft_release.outputs.tag }}" *.lib
198200
gh release upload "${{ needs.draft_release.outputs.tag }}" *.dylib
199201
gh release upload "${{ needs.draft_release.outputs.tag }}" *.so
200-
gh release upload "${{ needs.draft_release.outputs.tag }}" *.a
202+
gh release upload "${{ needs.draft_release.outputs.tag }}" static_libs.zip
201203
202204
publish_wasm:
203205
name: Publish WASM builds

android/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ val buildRust = tasks.register<Exec>("buildRust") {
9595
rustCompilation("powersync_loadable", "./android/build/intermediates/jniLibs")
9696
}
9797

98-
val buildRustStatic = tasks.register<Exec>("buildRustStatic") {
99-
rustCompilation("powersync_static")
100-
}
101-
10298
val prefabAar = tasks.register<Zip>("prefabAar") {
10399
dependsOn(buildRust)
104100

@@ -218,5 +214,5 @@ val zipPublication by tasks.registering(Zip::class) {
218214
}
219215

220216
tasks.named("build") {
221-
dependsOn(prefabAar, buildRustStatic)
217+
dependsOn(prefabAar)
222218
}

crates/static/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
Builds the core extension as a static library, exposing the `powersync_init_static` function to load it.
2+
3+
We only use this crate to compile for watchOS, since the regular `loadable` build compiling to a dylib
4+
doesn't support that platform.
5+
6+
Most users should probably compile the `loadable` crate instead, which also emits a static library. If
7+
SQLite is linked statically, compiling `loadable` with the `static` feature enabled works.

tool/build_linux.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function compile() {
66
local suffix=$2
77

88
cargo build -p powersync_loadable -Z build-std=panic_abort,core,alloc --features nightly --release --target $triple
9-
cargo build -p powersync_static -Z build-std=panic_abort,core,alloc --features nightly --release --target $triple
109

1110
mv "target/$triple/release/libpowersync.so" "libpowersync_$suffix.linux.so"
1211
mv "target/$triple/release/libpowersync.a" "libpowersync_$suffix.linux.a"

tool/build_macos.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function compile() {
77
local os=$3
88

99
cargo build -p powersync_loadable -Z build-std=panic_abort,core,alloc --features nightly --release --target $triple
10-
cargo build -p powersync_static -Z build-std=panic_abort,core,alloc --features nightly --release --target $triple
1110

1211
mv "target/$triple/release/libpowersync.dylib" "libpowersync_$suffix.$os.dylib"
1312
mv "target/$triple/release/libpowersync.a" "libpowersync_$suffix.$os.a"

tool/build_windows.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function compile() {
66
local suffix=$2
77

88
cargo build -p powersync_loadable -Z build-std=panic_abort,core,alloc --features=nightly --release --target $triple
9-
cargo build -p powersync_static -Z build-std=panic_abort,core,alloc --features=nightly --release --target $triple
109

1110
mv "target/$triple/release/powersync.dll" "powersync_$suffix.dll"
1211
mv "target/$triple/release/powersync.lib" "powersync_$suffix.lib"

0 commit comments

Comments
 (0)