docs: add --build (MVP) usage to READMEs; guide updated with WSL tips. cli/runner: wire minimal --build to produce EXE (plugins→core→AOT→link).

This commit is contained in:
Tomoaki
2025-09-06 16:53:12 +09:00
parent 07f270b966
commit 9e6b77226e
4 changed files with 247 additions and 0 deletions

View File

@ -57,6 +57,13 @@ pub struct CliConfig {
// Phase-15: JSON IR v0 bridge
pub ny_parser_pipe: bool,
pub json_file: Option<String>,
// Build system (MVP)
pub build_path: Option<String>,
pub build_app: Option<String>,
pub build_out: Option<String>,
pub build_aot: Option<String>,
pub build_profile: Option<String>,
pub build_target: Option<String>,
}
impl CliConfig {
@ -317,6 +324,43 @@ impl CliConfig {
.help("Opt-in: read [ny_plugins] from nyash.toml and load scripts in order")
.action(clap::ArgAction::SetTrue)
)
// Build system (MVP)
.arg(
Arg::new("build")
.long("build")
.value_name("PATH")
.help("Build AOT executable using nyash.toml at PATH (MVP)")
)
.arg(
Arg::new("build-app")
.long("app")
.value_name("FILE")
.help("Entry Nyash script for --build (e.g., apps/hello/main.nyash)")
)
.arg(
Arg::new("build-out")
.long("out")
.value_name("FILE")
.help("Output executable name for --build (default: app/app.exe)")
)
.arg(
Arg::new("build-aot")
.long("build-aot")
.value_name("{cranelift|llvm}")
.help("AOT backend for --build (default: cranelift)")
)
.arg(
Arg::new("build-profile")
.long("profile")
.value_name("{release|debug}")
.help("Cargo profile for --build (default: release)")
)
.arg(
Arg::new("build-target")
.long("target")
.value_name("TRIPLE")
.help("Target triple for --build (e.g., x86_64-pc-windows-msvc)")
)
}
/// Convert ArgMatches to CliConfig
@ -361,6 +405,12 @@ impl CliConfig {
parser_ny: matches.get_one::<String>("parser").map(|s| s == "ny").unwrap_or(false),
ny_parser_pipe: matches.get_flag("ny-parser-pipe"),
json_file: matches.get_one::<String>("json-file").cloned(),
build_path: matches.get_one::<String>("build").cloned(),
build_app: matches.get_one::<String>("build-app").cloned(),
build_out: matches.get_one::<String>("build-out").cloned(),
build_aot: matches.get_one::<String>("build-aot").cloned(),
build_profile: matches.get_one::<String>("build-profile").cloned(),
build_target: matches.get_one::<String>("build-target").cloned(),
}
}
}