From e07e60495bb6595f61d2bab6e4f32c986f2db60f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 31 Aug 2023 07:33:14 +1000 Subject: [PATCH] Pull in latest upstream n2 fixes - Fixes an issue where tasks would continue to appear active for a while after they had finished on Unix platforms - The latest n2 now behaves the same way as ninja when substituting variables, so we no longer need to do the substitution ourselves. --- build/ninja_gen/src/render.rs | 13 +++++-------- tools/install-n2 | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/build/ninja_gen/src/render.rs b/build/ninja_gen/src/render.rs index 4c83e382f..a9a32cf84 100644 --- a/build/ninja_gen/src/render.rs +++ b/build/ninja_gen/src/render.rs @@ -22,12 +22,17 @@ impl Build { ) .unwrap(); + writeln!(&mut buf, "builddir = {}", self.buildroot.as_str()).unwrap(); writeln!( &mut buf, "runner = $builddir/rust/release/{}", with_exe("runner") ) .unwrap(); + for (key, value) in &self.variables { + writeln!(&mut buf, "{} = {}", key, value).unwrap(); + } + buf.push('\n'); for (key, value) in &self.pools { writeln!(&mut buf, "pool {}\n depth = {}", key, value).unwrap(); @@ -49,14 +54,6 @@ impl Build { buf.push_str(&self.trailing_text); - buf = buf.replace("$builddir", self.buildroot.as_str()); - for (key, value) in &self.variables { - buf = buf.replace( - &format!("${key}"), - &value.replace("$builddir", self.buildroot.as_str()), - ); - } - buf } diff --git a/tools/install-n2 b/tools/install-n2 index a87017954..d4ef988aa 100755 --- a/tools/install-n2 +++ b/tools/install-n2 @@ -1,3 +1,3 @@ #!/bin/bash -cargo install --git https://github.com/ankitects/n2.git --rev 56202604d4c541524b82381162eafae4290fdd22 +cargo install --git https://github.com/ankitects/n2.git --rev 3eca2545a8f4c8cbdd8ed697936bd2ae929b55dd