add hosted-ci target back in

This commit is contained in:
bunnie 2022-10-02 17:52:30 +08:00
parent b4febb78ff
commit b431059715
2 changed files with 24 additions and 7 deletions

View file

@ -96,6 +96,8 @@ pub(crate) struct Builder {
run_svd2repl: bool, run_svd2repl: bool,
locale_override: Option<String>, locale_override: Option<String>,
locale_stash: String, locale_stash: String,
/// when set to true, hosted mode builds but does not run
dry_run: bool,
} }
impl Builder { impl Builder {
@ -119,6 +121,7 @@ impl Builder {
run_svd2repl: false, run_svd2repl: false,
locale_override: None, locale_override: None,
locale_stash: String::new(), locale_stash: String::new(),
dry_run: false,
} }
} }
/// Specify an alternate loader key, as a String that can encode a file name /// 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.kernel_features.push(feature.into());
self 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 /// 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()` /// 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") 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 { match self.stream {
BuildStream::Release => hosted_args.push("--release"), BuildStream::Release => hosted_args.push("--release"),
_ => {} _ => {}

View file

@ -37,7 +37,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"susres", // suspend/resume manager "susres", // suspend/resume manager
].to_vec(); ].to_vec();
// minimal set of packages to do bare-iron graphical I/O // minimal set of packages to do bare-iron graphical I/O
let gfx_dev_pkgs = [ let gfx_base_pkgs = [
&base_pkgs[..], &base_pkgs[..],
&[ &[
"graphics-server", // raw (unprotected) frame buffer primitives "graphics-server", // raw (unprotected) frame buffer primitives
@ -48,8 +48,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
].concat(); ].concat();
// packages in the user image // packages in the user image
let user_pkgs = [ let user_pkgs = [
&base_pkgs[..], &gfx_base_pkgs[..],
&gfx_dev_pkgs[..],
&[ &[
// net services // net services
"com", "com",
@ -190,10 +189,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
Some("gfx-dev") => { Some("gfx-dev") => {
builder.target_hosted() 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_services(&get_cratespecs())
.add_feature("graphics-server/testing"); .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 ------ // ------ Precursor hardware image configs ------
Some("app-image") => { Some("app-image") => {
@ -232,13 +237,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
Some("usbdev") => { Some("usbdev") => {
builder.target_precursor(PRECURSOR_SOC_VERSION) 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()); .add_services(&get_cratespecs());
builder.add_service("usb-test"); builder.add_service("usb-test");
} }
Some("ffi-test") => { Some("ffi-test") => {
builder.target_precursor(PRECURSOR_SOC_VERSION) 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()); .add_services(&get_cratespecs());
builder.add_service("ffi-test"); builder.add_service("ffi-test");
builder.add_loader_feature("renode-bypass"); builder.add_loader_feature("renode-bypass");