Build production-ready editor authoring workflows
CI / Format, lint, test, build (push) Waiting to run
CI / Format, lint, test, build (push) Waiting to run
This commit is contained in:
1 parent
cc1fa6ea3b
commit
0553a85220
163 files changed
+34547
-1565
No files matched your search
+14
-1
@@ -13,10 +13,23 @@ required-features = ["validate-levels"]
|
||||
name = "clean-target"
|
||||
path = "src/clean_target.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "package-project"
|
||||
path = "src/package_project.rs"
|
||||
required-features = ["validate-levels"]
|
||||
|
||||
[dependencies]
|
||||
walkdir = "2.5"
|
||||
scene = { path = "../crates/scene", optional = true }
|
||||
settings = { workspace = true, optional = true }
|
||||
serde_json = "1"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
ron = "0.8"
|
||||
blake3 = "1"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
validate-levels = ["dep:scene"]
|
||||
validate-levels = ["dep:scene", "dep:settings"]
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,26 +1,54 @@
|
||||
//! Validate all level scenes under assets/levels/ (H2 CI helper).
|
||||
//! Validate project content through the same report consumed by the editor.
|
||||
|
||||
use std::path::Path;
|
||||
use walkdir::WalkDir;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let mut errors = 0;
|
||||
for entry in WalkDir::new("assets/levels").into_iter().flatten() {
|
||||
let path = entry.path();
|
||||
if path.extension().is_some_and(|ext| ext == "ron") {
|
||||
if let Err(err) = validate_level_file(path) {
|
||||
eprintln!("{}: {err}", path.display());
|
||||
errors += 1;
|
||||
let mut project_root = PathBuf::from(".");
|
||||
let mut json = false;
|
||||
let mut args = std::env::args().skip(1);
|
||||
while let Some(argument) = args.next() {
|
||||
match argument.as_str() {
|
||||
"--json" => json = true,
|
||||
"--project" => {
|
||||
let Some(path) = args.next() else {
|
||||
eprintln!("validate-levels: --project requires a path");
|
||||
std::process::exit(2);
|
||||
};
|
||||
project_root = PathBuf::from(path);
|
||||
}
|
||||
_ => {
|
||||
eprintln!("validate-levels: unknown argument `{argument}`");
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if errors > 0 {
|
||||
eprintln!("validate-levels: {errors} file(s) failed");
|
||||
|
||||
let report = scene::validate_project(&project_root);
|
||||
if json {
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&report).expect("validation report must serialize")
|
||||
);
|
||||
} else {
|
||||
for finding in &report.findings {
|
||||
let actor = finding
|
||||
.owner_actor_id
|
||||
.as_deref()
|
||||
.map(|actor| format!(" actor={actor}"))
|
||||
.unwrap_or_default();
|
||||
eprintln!(
|
||||
"{:?} [{}] {}{}: {}",
|
||||
finding.severity, finding.code, finding.source_path, actor, finding.message
|
||||
);
|
||||
}
|
||||
println!(
|
||||
"validate-levels: {} dependencies, {} findings, {} blocking errors",
|
||||
report.dependencies.len(),
|
||||
report.findings.len(),
|
||||
report.blocking_error_count()
|
||||
);
|
||||
}
|
||||
if !report.is_release_ready() {
|
||||
std::process::exit(1);
|
||||
}
|
||||
println!("validate-levels: ok");
|
||||
}
|
||||
|
||||
fn validate_level_file(path: &Path) -> Result<(), String> {
|
||||
scene::validate_level_file(path)
|
||||
}
|
||||
Reference in new issue
Block a user