Skip to content

Commit 588b583

Browse files
committed
allow disabling targets
1 parent d75362c commit 588b583

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

xtask/src/build_docker_image.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ pub fn build_docker_image(
137137
targets = get_matrix()
138138
.iter()
139139
.filter(|m| m.os.starts_with("ubuntu"))
140+
.filter(|m| !m.disabled)
140141
.map(|m| m.to_image_target())
141142
.collect();
142143
} else {

xtask/src/ci/target_matrix.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub enum TargetMatrixSub {
3434
impl TargetMatrix {
3535
pub(crate) fn run(&self) -> Result<(), color_eyre::Report> {
3636
let mut matrix: Vec<CiTarget> = get_matrix().clone();
37+
matrix.retain(|t| !t.disabled);
3738
let mut is_default_try = false;
3839
let pr: Option<String>;
3940
let (prs, mut app) = match self {
@@ -411,6 +412,7 @@ mod tests {
411412
#[track_caller]
412413
fn run<'a>(args: impl IntoIterator<Item = &'a str>) -> Vec<CiTarget> {
413414
let mut matrix = get_matrix().clone();
415+
matrix.retain_mut(|t| !t.disabled);
414416
TargetMatrixArgs::try_parse_from(args)
415417
.unwrap()
416418
.filter(&mut matrix);
@@ -468,7 +470,9 @@ mod tests {
468470
#[test]
469471
fn all() {
470472
let matrix = run([]);
471-
assert_eq!(get_matrix(), &matrix);
473+
let mut all = get_matrix().clone();
474+
all.retain(|t| !t.disabled);
475+
assert_eq!(&all, &matrix);
472476
}
473477

474478
#[test]

xtask/src/codegen.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ use std::fmt::Write;
55
use crate::util::{get_cargo_workspace, get_matrix};
66

77
#[derive(Args, Debug)]
8-
pub struct Codegen {
9-
/// Provide verbose diagnostic output.
10-
#[clap(short, long)]
11-
verbose: bool,
12-
}
8+
pub struct Codegen {}
139

1410
pub fn codegen(Codegen { .. }: Codegen) -> cross::Result<()> {
1511
let path = get_cargo_workspace().join("src/docker/provided_images.rs");
@@ -28,7 +24,7 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &["#,
2824

2925
for image_target in get_matrix()
3026
.iter()
31-
.filter(|i| i.builds_image() && i.to_image_target().is_toolchain_image())
27+
.filter(|i| i.builds_image() && i.to_image_target().is_toolchain_image() && !i.disabled)
3228
{
3329
write!(
3430
&mut images,

xtask/src/util.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ pub struct CiTarget {
6464
/// if `true` test no std support as if std does exists. If `false` build https://github.com/rust-lang/compiler-builtins
6565
#[serde(skip_serializing_if = "Option::is_none")]
6666
pub std: Option<bool>,
67+
#[serde(skip_serializing_if = "is_false", default)]
68+
pub disabled: bool,
69+
}
70+
71+
pub fn is_false(b: &bool) -> bool {
72+
!*b
6773
}
6874

6975
impl CiTarget {

0 commit comments

Comments
 (0)