diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5894cc2..59309f29 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ on: push: tags: - v[0-9]+.[0-9]+.[0-9]+ + jobs: draft_release: name: Create Draft GitHub Release @@ -33,8 +34,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build Linux uses: ./.github/actions/linux @@ -43,8 +42,6 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build macOS uses: ./.github/actions/macos @@ -53,8 +50,6 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build Windows uses: ./.github/actions/windows @@ -63,8 +58,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build Android uses: ./.github/actions/android with: @@ -76,8 +69,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build wasm uses: ./.github/actions/wasm @@ -87,8 +78,6 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build XCFramework uses: ./.github/actions/xcframework @@ -119,8 +108,6 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Download libs uses: actions/download-artifact@v5 @@ -176,8 +163,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Download Linux libraries uses: actions/download-artifact@v5 @@ -220,8 +205,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Download wasm bundle uses: actions/download-artifact@v5 @@ -249,6 +232,26 @@ jobs: file-name: libpowersync-wasm.a tag: ${{ needs.draft_release.outputs.tag }} + publish_crates_io: + runs-on: ubuntu-latest + permissions: + id-token: write # Required for OIDC token exchange + steps: + - uses: actions/checkout@v5 + - uses: rust-lang/crates-io-auth-action@v1 + id: auth + + - name: Publish powersync_sqlite_nostd + run: cargo publish + working-directory: crates/core + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + - name: Publish powersync_core + run: cargo publish + working-directory: crates/core + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + create_sdk_issue: name: "Create issue for SDK updates" permissions: @@ -260,6 +263,7 @@ jobs: - publish_ios_pod_and_spm_package - publish_desktop - publish_wasm + - publish_crates_io steps: - name: Create issue run: | @@ -277,6 +281,7 @@ jobs: Core build (this repo): * [x] GitHub Release + * [x] New version released on crates.io * [ ] Android aar released on Maven Central * [ ] Cocoapod released @@ -290,3 +295,4 @@ jobs: * [ ] powersync-js: * [ ] kotlin: * [ ] swift: + * [ ] native: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5158b2db..6fe7ed48 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,8 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build Linux libraries uses: ./.github/actions/linux @@ -21,8 +19,6 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build macOS uses: ./.github/actions/macos @@ -32,8 +28,7 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 - with: - submodules: true + - name: Build Windows uses: ./.github/actions/windows @@ -43,8 +38,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build Android uses: ./.github/actions/android with: @@ -56,8 +49,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build wasm uses: ./.github/actions/wasm @@ -68,8 +59,6 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Build XCFramework uses: ./.github/actions/xcframework @@ -83,8 +72,6 @@ jobs: os: [ubuntu-24.04, macos-latest] steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Ubuntu setup if: matrix.os == 'ubuntu-24.04' @@ -131,8 +118,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - submodules: true - uses: dart-lang/setup-dart@v1 @@ -190,8 +175,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - uses: dart-lang/setup-dart@v1 - name: Install Rust Stable @@ -230,8 +213,6 @@ jobs: - os: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Install Rust Nightly uses: dtolnay/rust-toolchain@stable with: diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index cb2e7e4d..7af1c31a 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -7,6 +7,8 @@ repository.workspace = true license.workspace = true authors.workspace = true keywords.workspace = true +description = "The PowerSync SQLite extension" +readme = "README.md" [lib] name = "powersync_core" diff --git a/crates/core/README.md b/crates/core/README.md index 27e8063f..443b9e95 100644 --- a/crates/core/README.md +++ b/crates/core/README.md @@ -1,8 +1,24 @@ +

+ +

+ +_[PowerSync](https://www.powersync.com) is a sync engine for building local-first apps with instantly-responsive UI/UX and simplified state transfer. Syncs between SQLite on the client-side and Postgres, MongoDB or MySQL on the server-side._ + # powersync_core -This is the core SQLite extension, containing all the logic. +This is the core SQLite extension, containing all the logic. This is used internally by PowerSync SDKs, +and would typically not be used by users directly. + +The role of the extension is to create user-defined functions that higher-level SDKs would use to implement +schema management and a PowerSync client. +Not all of this is documented, but [this directory](https://github.com/powersync-ja/powersync-sqlite-core/tree/main/docs) +provides some hints on how a custom PowerSync SDK could be implemented. -Since the different build configurations (loadable extension, bundled SQLite shell) -use different cargo config, we can't completely separate them just using features. -Instead, we use different crates depending on this core lib. +For this reason, the crate doesn't have much of a public API. In the default build mode, it doesn't expect +SQLite to be linked and exposes a single function: `sqlite3_powersync_init`, +a [loadable extension](https://sqlite.org/loadext.html) entrypoint. +For applications linking SQLite, the `static` feature of this crate can be enabled. +With that feature, `powersync_init_static()` can be called to load the +extension for all new connections. +The application is responsible for linking SQLite in that case. diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 84dd3d2a..31fdd30a 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -35,6 +35,10 @@ mod view_admin; mod views; mod vtab_util; +/// The entrypoint for the PowerSync SQLite core extension. +/// +/// When compiling this Rust crate into a dynamic library, it can be used by embedders to load it +/// through [SQLite's opening mechanism](https://sqlite.org/loadext.html#loading_an_extension). #[unsafe(no_mangle)] pub extern "C" fn sqlite3_powersync_init( db: *mut sqlite::sqlite3, @@ -85,7 +89,7 @@ fn init_extension(db: *mut sqlite::sqlite3) -> Result<(), PowerSyncError> { unsafe extern "C" { #[cfg(feature = "static")] #[allow(non_snake_case)] - pub fn sqlite3_auto_extension( + fn sqlite3_auto_extension( xEntryPoint: Option< extern "C" fn( *mut sqlite::sqlite3, @@ -96,6 +100,10 @@ unsafe extern "C" { ) -> ::core::ffi::c_int; } +/// Calls `sqlite3_auto_extension` with [sqlite3_powersync_init] to automatically load +/// the PowerSync core extension into new connections. +/// +/// For details, see https://sqlite.org/loadext.html#statically_linking_a_run_time_loadable_extension #[cfg(feature = "static")] #[unsafe(no_mangle)] pub extern "C" fn powersync_init_static() -> c_int { diff --git a/crates/sqlite_nostd/Cargo.toml b/crates/sqlite_nostd/Cargo.toml index 50b7ce88..1683b9df 100644 --- a/crates/sqlite_nostd/Cargo.toml +++ b/crates/sqlite_nostd/Cargo.toml @@ -7,6 +7,8 @@ repository.workspace = true license.workspace = true authors.workspace = true keywords.workspace = true +description = "Lightweight, semi-unsafe, nostd bindings to sqlite3" +readme = "README.md" [lib] name = "powersync_sqlite_nostd"