diff --git a/xtask/src/builder.rs b/xtask/src/builder.rs index 8fbb9ddc8..6614ef95f 100644 --- a/xtask/src/builder.rs +++ b/xtask/src/builder.rs @@ -96,6 +96,8 @@ pub(crate) struct Builder { run_svd2repl: bool, locale_override: Option, locale_stash: String, + /// when set to true, hosted mode builds but does not run + dry_run: bool, } impl Builder { @@ -119,6 +121,7 @@ impl Builder { run_svd2repl: false, locale_override: None, locale_stash: String::new(), + dry_run: false, } } /// Specify an alternate loader key, as a String that can encode a file name @@ -260,6 +263,11 @@ impl Builder { self.kernel_features.push(feature.into()); self } + /// only build a hosted target. don't run it. Used exclusively to confirm that hosted mode builds in CI. + pub fn hosted_build_only<'a>(&'a mut self) -> &'a mut Builder { + self.dry_run = true; + self + } /// The builder sets up all the cargo arguments to build a set of packages with features for a respective /// target and stream. It also runs the build as well. It's meant to be called only by the `build()` @@ -484,7 +492,11 @@ impl Builder { service.push_str(".exe") } } - let mut hosted_args = vec!["run"]; + let mut hosted_args = if self.dry_run { + vec!["build"] + } else { + vec!["run"] + }; match self.stream { BuildStream::Release => hosted_args.push("--release"), _ => {} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index c4833707b..3101483e4 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -37,7 +37,7 @@ fn main() -> Result<(), Box> { "susres", // suspend/resume manager ].to_vec(); // minimal set of packages to do bare-iron graphical I/O - let gfx_dev_pkgs = [ + let gfx_base_pkgs = [ &base_pkgs[..], &[ "graphics-server", // raw (unprotected) frame buffer primitives @@ -48,8 +48,7 @@ fn main() -> Result<(), Box> { ].concat(); // packages in the user image let user_pkgs = [ - &base_pkgs[..], - &gfx_dev_pkgs[..], + &gfx_base_pkgs[..], &[ // net services "com", @@ -190,10 +189,16 @@ fn main() -> Result<(), Box> { } Some("gfx-dev") => { builder.target_hosted() - .add_services(&gfx_dev_pkgs.into_iter().map(String::from).collect()) + .add_services(&gfx_base_pkgs.into_iter().map(String::from).collect()) .add_services(&get_cratespecs()) .add_feature("graphics-server/testing"); }, + Some("hosted-ci") => { + builder.target_hosted() + .add_services(&user_pkgs.into_iter().map(String::from).collect()) + .hosted_build_only() + .add_apps(&get_cratespecs()); + } // ------ Precursor hardware image configs ------ Some("app-image") => { @@ -232,13 +237,13 @@ fn main() -> Result<(), Box> { } Some("usbdev") => { builder.target_precursor(PRECURSOR_SOC_VERSION) - .add_services(&gfx_dev_pkgs.into_iter().map(String::from).collect()) + .add_services(&gfx_base_pkgs.into_iter().map(String::from).collect()) .add_services(&get_cratespecs()); builder.add_service("usb-test"); } Some("ffi-test") => { builder.target_precursor(PRECURSOR_SOC_VERSION) - .add_services(&gfx_dev_pkgs.into_iter().map(String::from).collect()) + .add_services(&gfx_base_pkgs.into_iter().map(String::from).collect()) .add_services(&get_cratespecs()); builder.add_service("ffi-test"); builder.add_loader_feature("renode-bypass");