204c171e60
M5 iteration 1 (specae905de, plan22f02aa). Stands up the workspace-excluded `ail-embed` crate: - zero-dependency embedding core (`ail-embed/src/lib.rs`): extern "C" to the M3-frozen ABI + frozen-layout State/Tick box helpers + a Kernel price fold; the Rust port of the audited crates/ail/tests/embed/tick_roundtrip.c. Raw pointers never escape the type. - build.rs (no in-repo precedent): AIL_BIN env override else nested `cargo build -p ail` against the parent workspace (separate target dir → no cargo-lock deadlock), `ail build --emit=staticlib`, link directives. - hermetic data-server smoke (ail-embed/tests/smoke.rs): synthetic Pepperstone-format ZIP fixture via data-server's own public RawTickRecord type → real DataServer → Kernel, bit-exact vs a same-order host reference fold; runs with no /mnt. - `ail-embed` is its own cargo workspace root (empty [workspace] table); data-server is a dev-dependency only. Root Cargo.toml gains only a 4-line non-membership comment. Invariant 1 Boss-verified independently: full+no-deps cargo metadata on the AILang workspace shows data-server count 0; git status path filter empty (zero diff to crates/ailang-*, crates/ail/, runtime/, examples/*.ail); src/lib.rs zero code-level data_server; AILang cargo build --workspace still clean. ail-embed suite 2/2 green (kernel_run_sums_prices unit RED-first + hermetic_smoke integration), verified by me, not just the agent report. Two toolchain-forced corrections to the plan's verbatim ail-embed/Cargo.toml (added empty [workspace] table; sibling dev-dep path ../libs -> ../../libs, manifest-relative) — confined to the plan-created manifest, no acceptance gate altered, 0 review re-loops. Journal Concerns records the planner-recon implication for the next workspace-excluded-nested-crate plan. Adapter API + thread-swarm deferred to M5 iter 2+ per spec/plan. Includes the per-iter journal, stats, and the INDEX.md line.
56 lines
2.1 KiB
Rust
56 lines
2.1 KiB
Rust
//! Emits the M3-frozen kernel staticlib and links it.
|
|
//!
|
|
//! Resolution of the `ail` binary has no in-repo precedent (the
|
|
//! in-test mechanism `env!("CARGO_BIN_EXE_ail")` is unavailable to a
|
|
//! workspace-excluded crate's build script): use `$AIL_BIN` if set,
|
|
//! else `cargo build --manifest-path <repo>/Cargo.toml -p ail` and
|
|
//! use `<repo>/target/debug/ail`. The AILang workspace target dir
|
|
//! (`<repo>/target`) is distinct from this crate's
|
|
//! (`ail-embed/target`), so the nested `cargo build` cannot deadlock
|
|
//! on the outer build's lock.
|
|
use std::env;
|
|
use std::path::PathBuf;
|
|
use std::process::Command;
|
|
|
|
fn main() {
|
|
let manifest = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
let repo = manifest.parent().unwrap().to_path_buf(); // /home/brummel/dev/ailang
|
|
let kernel = repo.join("examples/embed_backtest_step_tick.ail");
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
|
|
println!("cargo:rerun-if-changed={}", kernel.display());
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
println!("cargo:rerun-if-env-changed=AIL_BIN");
|
|
|
|
let ail_bin: PathBuf = match env::var("AIL_BIN") {
|
|
Ok(p) => PathBuf::from(p),
|
|
Err(_) => {
|
|
let status = Command::new("cargo")
|
|
.args(["build", "--manifest-path"])
|
|
.arg(repo.join("Cargo.toml"))
|
|
.args(["-p", "ail"])
|
|
.status()
|
|
.expect("spawn `cargo build -p ail`");
|
|
assert!(status.success(), "building the `ail` CLI failed");
|
|
repo.join("target/debug/ail")
|
|
}
|
|
};
|
|
|
|
let build = Command::new(&ail_bin)
|
|
.arg("build")
|
|
.arg(&kernel)
|
|
.args(["--emit=staticlib", "-o"])
|
|
.arg(&out_dir)
|
|
.output()
|
|
.expect("spawn `ail build --emit=staticlib`");
|
|
assert!(
|
|
build.status.success(),
|
|
"ail build --emit=staticlib failed:\n{}",
|
|
String::from_utf8_lossy(&build.stderr)
|
|
);
|
|
|
|
println!("cargo:rustc-link-search=native={}", out_dir.display());
|
|
println!("cargo:rustc-link-lib=static=embed_backtest_step_tick");
|
|
println!("cargo:rustc-link-lib=static=ailang_rt");
|
|
}
|