diff --git a/Cargo.lock b/Cargo.lock index e3c42eb..b690794 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,6 +150,7 @@ dependencies = [ "busbar-contract", "busbar-plugin-loader", "busbar-store-sqlite", + "busbar-store-sqlite-plugin", "reqwest", "rusqlite", "serde_json", diff --git a/store-sqlite-plugin/Cargo.toml b/store-sqlite-plugin/Cargo.toml index 8894521..76d63c2 100644 --- a/store-sqlite-plugin/Cargo.toml +++ b/store-sqlite-plugin/Cargo.toml @@ -13,12 +13,23 @@ license = "Apache-2.0" # rlib: REQUIRED for `cargo test` to emit the cdylib artifact the conformance and e2e tests load. crate-type = ["cdylib", "rlib"] +[features] +# THE DROPPED-IN DOOR: `export_door!` emits the one C symbol `busbar_plugin_door`, and ONLY the +# dropped-in cdylib may export it (compiled in = dropped in, one table: a busbar build that links +# this crate as a row, alone or beside others, must carry no door symbol, or two doors in one +# binary multiply define it under `lto = "fat"`). OFF by default; the dropped-in artifact is built +# `cargo build --release -p busbar-store-sqlite-plugin --features dropped-in`, and `cargo test` names this crate +# below with it on so the cdylib the conformance test opens carries the door. +dropped-in = [] + [dependencies] # THE LOGIC, same repo: its `door::door` is the door this image exports. busbar-store-sqlite = { path = "../store-sqlite" } busbar-contract = { git = "https://github.com/GetBusbar/busbar", rev = "e1d3d8b097201859751d77208e66249d98b50a4b" } [dev-dependencies] +# The conformance test opens this crate's own cdylib WITH its dropped-in door on (see `[features]`). +busbar-store-sqlite-plugin = { path = ".", features = ["dropped-in"] } # The conformance and e2e tests load the built cdylib and the linked door over the REAL loader (the # one dispatcher, the store v3 table) — dev-only, never in the shipped artifact. Same pinned rev as # the logic crate's busbar-contract, so one busbar source resolves. diff --git a/store-sqlite-plugin/src/lib.rs b/store-sqlite-plugin/src/lib.rs index 631bbc3..c022620 100644 --- a/store-sqlite-plugin/src/lib.rs +++ b/store-sqlite-plugin/src/lib.rs @@ -8,7 +8,7 @@ //! All the store lives in the `busbar-store-sqlite` crate, including its one door //! (`busbar_store_sqlite::door::door`, the store v3 table). This crate re-exports the logic crate, //! so the library it builds carries exactly the code a busbar build links, and exports that door as -//! the image's ONE symbol, `busbar_plugin_door` (`export_door!`, unconditionally) — one source, +//! the image's ONE symbol, `busbar_plugin_door` (`export_door!`, behind the `dropped-in` feature) — one source, //! both doors (DECISIONS #2 rule (1)). //! //! This crate is `deny`, not `forbid`: the export macro's `#[unsafe(no_mangle)]` is the one reviewed @@ -18,7 +18,9 @@ pub use busbar_store_sqlite::*; -/// The exported door: the macro's `#[no_mangle]` symbol is the one exemption. +/// The exported door, behind `dropped-in` (the cdylib build only): the macro's `#[no_mangle]` symbol is +/// the one exemption. +#[cfg(feature = "dropped-in")] #[allow(unsafe_code)] mod exported { busbar_contract::export_door!(busbar_store_sqlite::door::door);