mod path;
pub use path::{BundlePath, BundlePathError};
mod asset;
pub use asset::ParticipantAssets;
mod reader;
pub use reader::RuntimeBundle;
mod error;
pub use error::BundleError;
mod writer;
pub use writer::BundleWriter;
mod fs;
pub(crate) use fs::{
BundleRoot, copy_executable_source, create_staging_root, ensure_staging_directory,
open_bundle_file, prepare_publish_parent, publish_staging_root, read_manifest_document,
reject_existing_target, write_new_file,
};
pub const MANIFEST_FILE: &str = "manifest.json";
pub const ASSETS_DIR: &str = "assets";
pub const BIN_DIR: &str = "bin";
#[cfg(test)]
mod bundle_boundary_tests;
#[doc(hidden)]
pub mod __compat {
use crate::__compat::surface::{ContractRecord, ContractSurface};
use crate::__compat::wire::DescribeWire;
use crate::model::manifest::{MANIFEST_SCHEMA, ManifestDocument};
#[must_use]
pub fn contract_surface() -> String {
let mut records = Vec::new();
contract_records(&mut records);
ContractSurface::new(records).canonical_json()
}
pub(crate) fn contract_records(out: &mut Vec<ContractRecord>) {
out.push(ContractRecord::document(
"ManifestDocument",
MANIFEST_SCHEMA,
ManifestDocument::wire_schema(),
));
}
#[cfg(test)]
mod tests {
use super::contract_surface;
#[test]
fn the_surface_names_the_manifest_document_and_the_model_it_embeds() {
let rendered = contract_surface();
serde_json::from_str::<serde_json::Value>(&rendered).expect("the surface is JSON");
assert_eq!(contract_surface(), rendered);
for expected in [
r#""tag":"phoxal/manifest/v0""#,
r#""name":"ManifestDocument""#,
r#""name":"services""#,
r#""name":"components""#,
r#""name":"component_types""#,
r#""name":"Robot""#,
r#""name":"Structure""#,
] {
assert!(
rendered.contains(expected),
"{expected} missing: {rendered}"
);
}
}
}
}