* Rust backend: initial setup and space primitives implementation + tests * Rust: initial basic server setup * Rust server: auth layer * Rust: added specific auth layers * Rust: shell and proxy endpoints * Rust: SSR and Prometheus metrics * Rust: runtime API * Rust: basic working silverbullet binary server * Rust: fix client file caching * Rust: in dev mode, update version number dynamically * Rust: build-rs Makefile target * Rust: auth and start of 'sb' CLI * Rust: headless Chrome runtime runner * Rust: basic e2e tests for Rust build * Rust: docker builds * Rust: forgot to commit silverbullet-bin code * Rust: cross compile and chrome driver fixes * Rust: waiting for ready status fixes * Rust: sb-CLI port * Rust: use native build toolchain * Rust: fix build chain * Rust: edge release builds * Rust: FreeBSD and armv7 builds * Rust: edge-upgrade from edge-rust release * Rust: fix FreeBSD build * Rust: fix FreeBSD build * Rust: get rid of Go code * refactor: rename library crates to server- prefix convention * Rust: refactoring, moving crypto around * Rust: more refactoring * Runtime: internal renaming * Fix: cursor placement after paste on Webkit browsers * Tweak how version numbers are generated and consumed * Cleanup CI situation * Fix CI * Fix e2e * ci: website image uses :edge channel (was :v2) post-merge * Rust: restore manifest.json endpoint * Rust: ready to merge
35 lines
1.4 KiB
Rust
35 lines
1.4 KiB
Rust
use std::path::Path;
|
|
|
|
fn main() {
|
|
// The client bundle is a build artifact (gitignored); `rust-embed` embeds it
|
|
// at compile time, so fail early with a clear message if it's missing.
|
|
let manifest = env!("CARGO_MANIFEST_DIR");
|
|
let bundle = Path::new(manifest).join("../../client_bundle/client");
|
|
if !bundle.join(".client/index.html").exists() {
|
|
panic!(
|
|
"client bundle not found at {} — run `make` in the silverbullet/ submodule first \
|
|
(it builds client_bundle/{{client,base_fs}})",
|
|
bundle.display()
|
|
);
|
|
}
|
|
println!("cargo:rerun-if-changed=../../client_bundle/client");
|
|
println!("cargo:rerun-if-changed=../../client_bundle/base_fs");
|
|
|
|
// Inject the version from the generated `version.json` (a language-neutral
|
|
// file shared with the TypeScript client).
|
|
let version_json = Path::new(manifest).join("../../version.json");
|
|
println!("cargo:rerun-if-changed=../../version.json");
|
|
let version = std::fs::read_to_string(&version_json)
|
|
.ok()
|
|
.and_then(|s| parse_version(&s))
|
|
.unwrap_or_else(|| "0.0.0".to_string());
|
|
println!("cargo:rustc-env=SB_VERSION={version}");
|
|
}
|
|
|
|
/// Extract `version` from `version.json` (`{ "version": "…" }`).
|
|
fn parse_version(src: &str) -> Option<String> {
|
|
let value: serde_json::Value = serde_json::from_str(src).ok()?;
|
|
let v = value.get("version")?.as_str()?.trim();
|
|
(!v.is_empty()).then(|| v.to_string())
|
|
}
|