chore(m0): initialize cargo workspace, crate skeletons and ci gate
This commit is contained in:
Generated
+140
@@ -0,0 +1,140 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "balance"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"content",
|
||||
"serde_json",
|
||||
"sim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "content"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ffi"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"content",
|
||||
"sim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.154"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "server"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"content",
|
||||
"sim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sim"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "3.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"crates/sim",
|
||||
"crates/content",
|
||||
"crates/ffi",
|
||||
"crates/server",
|
||||
"tools/balance",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.85"
|
||||
authors = ["Hadrian Burkhardt <softwareapp.hb@gmail.com>"]
|
||||
repository = "https://example.invalid/iron-arc"
|
||||
|
||||
[workspace.dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
sim = { path = "crates/sim" }
|
||||
content = { path = "crates/content" }
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 2
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "content"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Data-driven content models (tanks, weapons, maps) with validation"
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
@@ -0,0 +1,9 @@
|
||||
//! Content models and validation for tanks, weapons and map presets.
|
||||
//!
|
||||
//! Content is versioned as a whole: `content_hash` pins a ruleset so that
|
||||
//! replays stay verifiable (see docs/protocol.md).
|
||||
|
||||
/// Placeholder until M2 fills in the models.
|
||||
pub fn content_hash_placeholder() -> &'static str {
|
||||
"b3:uninitialized"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "ffi"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "CDylib bridge between Flutter and the deterministic simulation"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "staticlib"]
|
||||
|
||||
[dependencies]
|
||||
sim.workspace = true
|
||||
content.workspace = true
|
||||
@@ -0,0 +1,16 @@
|
||||
//! Flutter <-> Rust bridge (flutter_rust_bridge API lives here from M3 on).
|
||||
|
||||
/// Smoke entry point so the Android build proves the CDylib pipeline works.
|
||||
pub fn sim_version() -> String {
|
||||
sim::SIM_VERSION.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn exposes_sim_version() {
|
||||
assert_eq!(sim_version(), "0.1.0");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "server"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Replay validation service (referee)"
|
||||
|
||||
[dependencies]
|
||||
sim.workspace = true
|
||||
content.workspace = true
|
||||
@@ -0,0 +1,14 @@
|
||||
//! Replay validation service. Filled in at M4 (axum, sqlx, HMAC tokens).
|
||||
|
||||
/// Reports which simulation version this server validates against.
|
||||
pub fn validated_sim_version() -> &'static str {
|
||||
sim::SIM_VERSION
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn reports_sim_version() {
|
||||
assert_eq!(super::validated_sim_version(), sim::SIM_VERSION);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "sim"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Deterministic artillery simulation core (fixed-point, no_std)"
|
||||
|
||||
[lib]
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
serde = ["dep:serde", "dep:serde_json"]
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true, optional = true }
|
||||
serde_json = { workspace = true, optional = true }
|
||||
@@ -0,0 +1,19 @@
|
||||
//! Deterministic artillery simulation core.
|
||||
//!
|
||||
//! Rules (see docs/ADR/0002-determinismus-fixed-point.md):
|
||||
//! - no floating point arithmetic
|
||||
//! - no `HashMap`/`HashSet` iteration
|
||||
//! - no `std::time`, no threads, no `unsafe`
|
||||
//! - fixed 60 Hz tick
|
||||
#![cfg_attr(not(test), no_std)]
|
||||
#![forbid(unsafe_code)]
|
||||
#![deny(clippy::float_arithmetic)]
|
||||
|
||||
#[cfg(not(test))]
|
||||
extern crate alloc;
|
||||
|
||||
/// Version of the simulation. Bumped on any formula/balance change.
|
||||
pub const SIM_VERSION: &str = "0.1.0";
|
||||
|
||||
/// Fixed simulation tick rate in Hz.
|
||||
pub const TICK_HZ: u32 = 60;
|
||||
@@ -0,0 +1,5 @@
|
||||
[toolchain]
|
||||
channel = "stable"
|
||||
profile = "minimal"
|
||||
components = ["rustfmt", "clippy"]
|
||||
targets = ["aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android"]
|
||||
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "balance"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
authors.workspace = true
|
||||
description = "Headless mass simulation for balance tuning"
|
||||
|
||||
[[bin]]
|
||||
name = "balance"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
sim.workspace = true
|
||||
content.workspace = true
|
||||
serde_json.workspace = true
|
||||
@@ -0,0 +1,8 @@
|
||||
//! Headless balance CLI. Real implementation at M2.
|
||||
|
||||
fn main() {
|
||||
println!(
|
||||
"balance: sim_version={} (not implemented yet, M2)",
|
||||
sim::SIM_VERSION
|
||||
);
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Full local CI gate. Fails fast on the first broken rule.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
echo '==> cargo fmt --check'
|
||||
cargo fmt --all -- --check
|
||||
|
||||
echo '==> clippy (deny warnings)'
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
|
||||
echo '==> float guard in crates/sim/src'
|
||||
if grep -rnE '(^|[^A-Za-z0-9_])f(32|64)([^A-Za-z0-9_]|$)' crates/sim/src --include='*.rs' | grep -v '^.*://' ; then
|
||||
echo 'ERROR: floating point types in crates/sim (see ADR 0002)' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo '==> cargo test'
|
||||
cargo test --workspace
|
||||
|
||||
echo '==> OK'
|
||||
Reference in New Issue
Block a user