Skip to content

Commit 61b83bf

Browse files
flowey: add explicit no_incremental flag for cargo builds
1 parent cc187bc commit 61b83bf

File tree

13 files changed

+54
-26
lines changed

13 files changed

+54
-26
lines changed

flowey/flowey_hvlite/src/pipelines/build_igvm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ impl IntoPipeline for BuildIgvmCli {
407407
verbose: ReadVar::from_static(verbose),
408408
locked,
409409
deny_warnings: false,
410+
no_incremental: false,
410411
})
411412
.dep_on(|ctx| flowey_lib_hvlite::_jobs::local_build_igvm::Params {
412413
artifact_dir: ctx.publish_artifact(pub_out_dir),

flowey/flowey_hvlite/src/pipelines/build_reproducible.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,16 @@ impl IntoPipeline for BuildReproducibleCli {
5757
let (pub_openhcl_igvm_extras, _use_openhcl_igvm_extras) =
5858
pipeline.new_artifact("x64-cvm-openhcl-igvm-extras");
5959

60+
let local_run_args = {
61+
let mut args = crate::pipelines_shared::cfg_common_params::LocalRunArgs::default();
62+
args.locked = true;
63+
args.no_incremental = true;
64+
args
65+
};
6066
let cfg_common_params = crate::pipelines_shared::cfg_common_params::get_cfg_common_params(
6167
&mut pipeline,
6268
backend_hint,
63-
None,
69+
Some(local_run_args),
6470
)?;
6571

6672
let openvmm_repo_source =

flowey/flowey_hvlite/src/pipelines/custom_vmfirmwareigvm_dll.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ impl IntoPipeline for CustomVmfirmwareigvmDllCli {
8383
verbose: ReadVar::from_static(false),
8484
locked: false,
8585
deny_warnings: false,
86+
no_incremental: false,
8687
})
8788
.dep_on(
8889
|ctx| flowey_lib_hvlite::_jobs::local_custom_vmfirmwareigvm_dll::Params {

flowey/flowey_hvlite/src/pipelines/restore_packages.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ impl IntoPipeline for RestorePackagesCli {
4343
verbose: ReadVar::from_static(true),
4444
locked: false,
4545
deny_warnings: false,
46+
no_incremental: false,
4647
});
4748

4849
let arches = {

flowey/flowey_hvlite/src/pipelines/vmm_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ impl IntoPipeline for VmmTestsCli {
173173
verbose: ReadVar::from_static(verbose),
174174
locked: false,
175175
deny_warnings: false,
176+
no_incremental: false,
176177
})
177178
.dep_on(|ctx| {
178179
flowey_lib_hvlite::_jobs::local_build_and_run_nextest_vmm_tests::Params {

flowey/flowey_hvlite/src/pipelines_shared/cfg_common_params.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ pub struct LocalRunArgs {
1616

1717
/// Run builds with --locked
1818
#[clap(long)]
19-
locked: bool,
19+
pub locked: bool,
20+
21+
/// Disable incremental compilation (sets CARGO_INCREMENTAL=0)
22+
#[clap(long)]
23+
pub no_incremental: bool,
2024

2125
/// Automatically install all required dependencies
2226
#[clap(long)]
@@ -37,6 +41,7 @@ fn get_params_local(
3741
let LocalRunArgs {
3842
verbose,
3943
locked,
44+
no_incremental,
4045
auto_install_deps,
4146
non_interactive,
4247
} = local_run_args.clone().unwrap_or_default();
@@ -50,6 +55,7 @@ fn get_params_local(
5055
verbose: ReadVar::from_static(verbose),
5156
locked,
5257
deny_warnings: false,
58+
no_incremental,
5359
}
5460
}))
5561
}
@@ -70,6 +76,7 @@ fn get_params_cloud(
7076
verbose: ctx.use_parameter(param_verbose.clone()),
7177
locked: true,
7278
deny_warnings: true,
79+
no_incremental: true,
7380
}
7481
}))
7582
}

flowey/flowey_lib_common/src/cfg_cargo_common_flags.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ use flowey::node::prelude::*;
1414
pub struct Flags {
1515
pub locked: bool,
1616
pub verbose: bool,
17+
pub no_incremental: bool,
1718
}
1819

1920
flowey_request! {
2021
pub enum Request {
2122
SetLocked(bool),
2223
SetVerbose(ReadVar<bool>),
24+
SetNoIncremental(bool),
2325
GetFlags(WriteVar<Flags>),
2426
}
2527
}
@@ -37,13 +39,17 @@ impl FlowNode for Node {
3739
let mut set_locked = None;
3840
let mut set_verbose = None;
3941
let mut get_flags = Vec::new();
42+
let mut set_no_incremental = None;
4043

4144
for req in requests {
4245
match req {
4346
Request::SetLocked(v) => same_across_all_reqs("SetLocked", &mut set_locked, v)?,
4447
Request::SetVerbose(v) => {
4548
same_across_all_reqs_backing_var("SetVerbose", &mut set_verbose, v)?
4649
}
50+
Request::SetNoIncremental(v) => {
51+
same_across_all_reqs("SetNoIncremental", &mut set_no_incremental, v)?
52+
}
4753
Request::GetFlags(v) => get_flags.push(v),
4854
}
4955
}
@@ -52,6 +58,7 @@ impl FlowNode for Node {
5258
set_locked.ok_or(anyhow::anyhow!("Missing essential request: SetLocked"))?;
5359
let set_verbose =
5460
set_verbose.ok_or(anyhow::anyhow!("Missing essential request: SetVerbose"))?;
61+
let set_no_incremental = set_no_incremental.unwrap_or(false);
5562
let get_flags = get_flags;
5663

5764
// -- end of req processing -- //
@@ -72,6 +79,7 @@ impl FlowNode for Node {
7279
&Flags {
7380
locked: set_locked,
7481
verbose: set_verbose,
82+
no_incremental: set_no_incremental,
7583
},
7684
);
7785
}

flowey/flowey_lib_common/src/gen_cargo_nextest_run_cmd.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,6 @@ impl FlowNode for Node {
342342
with_env.insert("RUST_BACKTRACE".into(), "1".into());
343343
}
344344

345-
// if running in CI, no need to waste time with incremental
346-
// build artifacts
347-
if !matches!(rt.backend(), FlowBackend::Local) {
348-
with_env.insert("CARGO_INCREMENTAL".into(), "0".into());
349-
}
350-
351345
// also update WSLENV in cases where we're running windows tests via WSL2
352346
if !portable && crate::_util::running_in_wsl(rt) {
353347
let old_wslenv = std::env::var("WSLENV");
@@ -405,6 +399,7 @@ pub(crate) fn cargo_nextest_build_args_and_env(
405399
no_default_features: bool,
406400
mut extra_env: BTreeMap<String, String>,
407401
) -> (Vec<String>, BTreeMap<String, String>) {
402+
let no_incremental = cargo_flags.no_incremental;
408403
let locked = cargo_flags.locked.then_some("--locked");
409404
let verbose = cargo_flags.verbose.then_some("--verbose");
410405
let cargo_profile = match &cargo_profile {
@@ -452,6 +447,10 @@ pub(crate) fn cargo_nextest_build_args_and_env(
452447

453448
let mut env = BTreeMap::new();
454449

450+
if no_incremental {
451+
env.insert("CARGO_INCREMENTAL".into(), "0".into());
452+
}
453+
455454
env.append(&mut extra_env);
456455

457456
(args, env)

flowey/flowey_lib_common/src/run_cargo_build.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ impl FlowNode for Node {
187187
let in_folder = rt.read(in_folder);
188188
let with_env = rt.read(extra_env).unwrap_or_default();
189189

190-
let crate::cfg_cargo_common_flags::Flags { locked, verbose } = flags;
190+
let crate::cfg_cargo_common_flags::Flags {
191+
locked,
192+
verbose,
193+
no_incremental,
194+
} = flags;
191195

192196
let cargo_profile = match &profile {
193197
CargoBuildProfile::Debug => "dev",
@@ -265,12 +269,10 @@ impl FlowNode for Node {
265269

266270
rt.sh.change_dir(cargo_work_dir);
267271
let mut cmd = flowey::shell_cmd!(rt, "{argv0} {params...}");
268-
if !matches!(rt.backend(), FlowBackend::Local) {
269-
// if running in CI, no need to waste time with incremental
270-
// build artifacts
272+
if no_incremental {
271273
with_env.insert("CARGO_INCREMENTAL".to_owned(), "0".to_owned());
272-
} else {
273-
// if build locally, use per-package target dirs
274+
} else if matches!(rt.backend(), FlowBackend::Local) {
275+
// if building locally, use per-package target dirs
274276
// to avoid rebuilding
275277
// TODO: remove this once cargo's caching improves
276278
cmd = cmd

flowey/flowey_lib_common/src/run_cargo_clippy.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ impl FlowNode for Node {
8181
let in_folder = rt.read(in_folder);
8282
let exclude = rt.read(exclude);
8383

84-
let crate::cfg_cargo_common_flags::Flags { locked, verbose } = flags;
84+
let crate::cfg_cargo_common_flags::Flags {
85+
locked,
86+
verbose,
87+
no_incremental,
88+
} = flags;
8589

8690
let target = target.to_string();
8791

@@ -134,9 +138,7 @@ impl FlowNode for Node {
134138
flowey::shell_cmd!(rt, "cargo")
135139
};
136140

137-
// if running in CI, no need to waste time with incremental
138-
// build artifacts
139-
if !matches!(rt.backend(), FlowBackend::Local) {
141+
if no_incremental {
140142
cmd = cmd.env("CARGO_INCREMENTAL", "0");
141143
}
142144
if let Some(env) = extra_env {

0 commit comments

Comments
 (0)