Skip to content

Commit 86fcae6

Browse files
committed
fix: Make sqlite-sync feature optional for crates.io publishing
sqlite-watcher is a local path dependency not published to crates.io. Make it optional via sqlite-sync feature (enabled by default for binaries) so cargo publish succeeds. - Add sqlite-sync feature gating sqlite-watcher dependency - Gate SyncSqlite command and module behind feature - Update release workflow to publish with --no-default-features
1 parent f0c4ba5 commit 86fcae6

5 files changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,6 @@ jobs:
184184
env:
185185
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
186186
run: |
187-
cargo publish --no-verify --allow-dirty
187+
# Publish without sqlite-sync feature since sqlite-watcher is not on crates.io
188+
# Users get full functionality via GitHub releases; crates.io gets core features
189+
cargo publish --no-verify --allow-dirty --no-default-features

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ libc = "0.2"
5454
rust_decimal = { version = "1.39", features = ["db-tokio-postgres"] }
5555
tonic = { version = "0.11", features = ["transport"] }
5656
tower = "0.4"
57-
sqlite-watcher = { path = "sqlite-watcher" }
57+
sqlite-watcher = { path = "sqlite-watcher", optional = true }
58+
59+
[features]
60+
default = ["sqlite-sync"]
61+
sqlite-sync = ["sqlite-watcher"]
5862

5963
[patch.crates-io]
6064
fxhash = { path = "third-party/fxhash" }

src/commands/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
pub mod init;
55
pub mod status;
66
pub mod sync;
7+
#[cfg(feature = "sqlite-sync")]
78
pub mod sync_sqlite;
89
pub mod target;
910
pub mod validate;

src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use anyhow::Context;
55
use clap::{Args, Parser, Subcommand};
66
use database_replicator::commands;
7+
#[cfg(feature = "sqlite-sync")]
78
use std::path::PathBuf;
89

910
#[derive(Parser)]
@@ -178,6 +179,7 @@ enum Commands {
178179
daemon_status: bool,
179180
},
180181
/// Consume sqlite-watcher change batches and apply them to SerenDB JSONB tables
182+
#[cfg(feature = "sqlite-sync")]
181183
SyncSqlite {
182184
/// Target PostgreSQL/Seren connection string
183185
#[arg(long)]
@@ -767,6 +769,7 @@ async fn main() -> anyhow::Result<()> {
767769
)?;
768770
commands::verify(&source, &target, Some(filter)).await
769771
}
772+
#[cfg(feature = "sqlite-sync")]
770773
Commands::SyncSqlite {
771774
target,
772775
watcher_endpoint,

0 commit comments

Comments
 (0)