spacedrive/core/build.rs
Jamie Pine 487cc53e63 feat: Implement JSON Schema generation for client types
- Added `schemars` dependency to facilitate JSON Schema generation.
- Introduced a new `generate_schemas` binary for extracting and writing unified JSON schemas.
- Enhanced existing modules to support schema generation, including updates to `build.rs` for change detection.
- Updated various data structures with `JsonSchema` derives to enable schema extraction.
- Created comprehensive documentation for the client generation system design, detailing architecture and usage.
- Added TypeScript and Swift client generation scripts, ensuring type-safe access to the Spacedrive daemon API.
2025-09-21 10:40:13 -07:00

31 lines
864 B
Rust

use vergen::EmitBuilder;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Emit the instructions
EmitBuilder::builder()
.git_sha(true)
.git_commit_timestamp()
.git_branch()
.cargo_opt_level()
.cargo_target_triple()
.emit()?;
// Emit build timestamp manually
println!(
"cargo:rustc-env=BUILD_TIMESTAMP={}",
chrono::Utc::now().to_rfc3339()
);
// Watch for changes in ops and event modules to trigger client regeneration
println!("cargo:rerun-if-changed=src/ops");
println!("cargo:rerun-if-changed=src/infra/event");
println!("cargo:rerun-if-changed=src/domain");
// Note: Schema generation is a manual step to avoid circular dependencies
// To regenerate client types:
// 1. cargo run --bin generate-schemas
// 2. cd packages/swift-client && ./generate_client.sh
// 3. cd packages/ts-client && ./generate_client.sh
Ok(())
}