From 6c9103d0e21b81202a65a854e1a48a25f92651cc Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Wed, 1 Nov 2023 20:04:20 +1300 Subject: [PATCH] Don't set UPDATE=1 on xtask auto-unignore --- xtask/src/file_analyzer.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xtask/src/file_analyzer.rs b/xtask/src/file_analyzer.rs index 7038c08194..90b20e48ba 100644 --- a/xtask/src/file_analyzer.rs +++ b/xtask/src/file_analyzer.rs @@ -12,6 +12,7 @@ use crate::{ /// Command builder for running tests/base.rs pub struct TestBaseArgs<'a> { inner: CargoTestArgs<'a>, + update: bool, ignored: bool, } @@ -20,6 +21,7 @@ impl<'a> TestBaseArgs<'a> { pub fn new() -> Self { Self { inner: CargoTestArgs::new("stc_ts_file_analyzer").with_test("base").with_lib(true), + update: true, ignored: false, } } @@ -60,6 +62,13 @@ impl<'a> TestBaseArgs<'a> { self } + /// Whether to set UPDATE=1 environment variable + #[must_use] + pub fn with_update(mut self, value: bool) -> Self { + self.update = value; + self + } + /// Set the standard --fast options. #[must_use] pub fn fast(self) -> Self { @@ -70,7 +79,11 @@ impl<'a> TestBaseArgs<'a> { pub fn to_command(&self) -> std::process::Command { let mut cmd = self.inner.to_command(); - cmd.env("UPDATE", "1").arg("--").arg("-Zunstable-options").arg("--report-time"); + if self.update { + cmd.env("UPDATE", "1"); + } + + cmd.arg("--").arg("-Zunstable-options").arg("--report-time"); if self.ignored { cmd.arg("--ignored"); @@ -110,6 +123,7 @@ pub fn auto_unignore() -> anyhow::Result<()> { let _ = TestBaseArgs::new() .with_log_max_level(LogFilterLevel::Off) .with_lib(false) + .with_update(false) .with_ignored() .run();