Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ time = { version = "0.3.44", features = ["formatting", "macros", "parsing", "ser
ureq = { version = "2.10.5" }
wait-timeout = "0.2"
url = "^2.5.0"
ortho_config = { version = "0.7.0", features = ["serde_json"] }
ortho_config = { version = "0.8.0", features = ["serde_json"] }
sys-locale = "0.3.2"

[build-dependencies]
clap = { version = "4.5.0", features = ["derive"] }
clap_mangen = "0.2.29"
ortho_config = { version = "0.7.0", features = ["serde_json"] }
ortho_config = { version = "0.8.0", features = ["serde_json"] }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
thiserror = "1"
Expand Down
33 changes: 22 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ fn write_man_page(data: &[u8], dir: &Path, page_name: &str) -> std::io::Result<P
Ok(destination)
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
const fn verify_public_api_symbols() {
// Exercise CLI localization, config merge, and host pattern symbols so the
// shared modules remain linked when the build script is compiled without
// tests.
const _: usize = std::mem::size_of::<cli::BuildArgs>();
const _: usize = std::mem::size_of::<cli::CliConfig>();
const _: usize = std::mem::size_of::<cli::Commands>();
const _: usize = std::mem::size_of::<HostPattern>();
const _: fn(&[OsString]) -> Option<String> = cli::locale_hint_from_args;
const _: fn(&[OsString]) -> Option<bool> = cli::diag_json_hint_from_args;
Expand All @@ -100,11 +103,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
const _: fn(&cli::Cli, &ArgMatches) -> ortho_config::OrthoResult<cli::Cli> =
cli::merge_with_config;
const _: LocalizedParseFn = cli::parse_with_localizer_from;
const _: fn(&cli::Cli) -> Option<bool> = cli::Cli::no_emoji_override;
const _: fn(&cli::Cli) -> bool = cli::Cli::progress_enabled;
const _: fn(&str) -> Result<HostPattern, HostPatternError> = HostPattern::parse;
const _: fn(&HostPattern, host_pattern::HostCandidate<'_>) -> bool = HostPattern::matches;
}

// Regenerate the manual page when the CLI or metadata changes.
fn emit_rerun_directives() {
println!("cargo:rerun-if-changed=src/cli/mod.rs");
println!("cargo:rerun-if-changed=src/cli/config.rs");
println!("cargo:rerun-if-changed=src/cli/merge.rs");
println!("cargo:rerun-if-changed=src/cli/parser.rs");
println!("cargo:rerun-if-changed=src/cli/parsing.rs");
println!("cargo:rerun-if-env-changed=CARGO_PKG_VERSION");
println!("cargo:rerun-if-env-changed=CARGO_PKG_NAME");
Expand All @@ -117,13 +126,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed=src/localization/keys.rs");
println!("cargo:rerun-if-changed=locales/en-US/messages.ftl");
println!("cargo:rerun-if-changed=locales/es-ES/messages.ftl");
}

build_l10n_audit::audit_localization_keys()?;

// Packagers expect man pages under target/generated-man/<target>/<profile>.
let out_dir = out_dir_for_target_profile();

// The top-level page documents the entire command interface.
fn generate_man_page(out_dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
let cmd = cli::Cli::command();
let name = cmd
.get_bin_name()
Expand All @@ -141,15 +146,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let version = env::var("CARGO_PKG_VERSION").map_err(
|_| "CARGO_PKG_VERSION must be set by Cargo; cannot render manual page without it.",
)?;

let man = Man::new(cmd)
.section("1")
.source(format!("{cargo_bin} {version}"))
.date(manual_date());
let mut buf = Vec::new();
man.render(&mut buf)?;
let page_name = format!("{cargo_bin}.1");
write_man_page(&buf, &out_dir, &page_name)?;
write_man_page(&buf, out_dir, &page_name)?;
if let Some(extra_dir) = env::var_os("OUT_DIR") {
let extra_dir_path = PathBuf::from(extra_dir);
if let Err(err) = write_man_page(&buf, &extra_dir_path, &page_name) {
Expand All @@ -159,6 +163,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
);
}
}

Ok(())
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
verify_public_api_symbols();
emit_rerun_directives();
build_l10n_audit::audit_localization_keys()?;
let out_dir = out_dir_for_target_profile();
generate_man_page(&out_dir)
}
9 changes: 3 additions & 6 deletions docs/execplans/3-10-1-guarantee-status-message-ordering.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,18 @@ model provides the necessary ordering guarantees.
`NINJA_STDERR_MARKER`) to avoid coupling to localized UI strings.

2. **Status messages do not contaminate stdout in standard mode**: Verifies
stream
routing in non-accessible mode using the same stable markers.
stream routing in non-accessible mode using the same stable markers.

3. **Build artifacts can be captured via stdout redirection**: Verifies that
`netsuke manifest -` output goes to stdout without status contamination.

Supporting infrastructure added:

- `FakeNinjaConfig` struct in `tests/bdd/steps/progress_output.rs` for
configurable
fixture generation with optional stderr markers.
configurable fixture generation with optional stderr markers.
- `install_fake_ninja_with_config()` function for flexible fixture setup.
- Updated `fake_ninja_emits_stdout_output` fixture to emit both stdout and
stderr
markers for comprehensive stream routing verification.
stderr markers for comprehensive stream routing verification.

### Stage E: Documentation (completed)

Expand Down
Loading