@@ -17,7 +17,7 @@ use subprocess::{Exec, Redirection};
1717use crate :: manifest:: component_build_configs;
1818
1919/// If present, run the build command of each component.
20- pub async fn build ( manifest_file : & Path , component_ids : & [ String ] ) -> Result < ( ) > {
20+ pub async fn build ( manifest_file : & Path , component_ids : & [ String ] , skip_target_checks : bool ) -> Result < ( ) > {
2121 let ( components, deployment_targets, manifest) = component_build_configs ( manifest_file)
2222 . await
2323 . with_context ( || {
@@ -37,7 +37,8 @@ pub async fn build(manifest_file: &Path, component_ids: &[String]) -> Result<()>
3737 build_result?;
3838
3939 if let Ok ( manifest) = & manifest {
40- if !deployment_targets. is_empty ( ) {
40+ let should_check_targets = !skip_target_checks && !deployment_targets. is_empty ( ) ;
41+ if should_check_targets {
4142 let resolution_context =
4243 spin_environments:: ResolutionContext :: new ( manifest_file. parent ( ) . unwrap ( ) ) . await ?;
4344 spin_environments:: validate_application_against_environment_ids (
@@ -163,6 +164,6 @@ mod tests {
163164 #[ tokio:: test]
164165 async fn can_load_even_if_trigger_invalid ( ) {
165166 let bad_trigger_file = test_data_root ( ) . join ( "bad_trigger.toml" ) ;
166- build ( & bad_trigger_file, & [ ] ) . await . unwrap ( ) ;
167+ build ( & bad_trigger_file, & [ ] , true ) . await . unwrap ( ) ;
167168 }
168169}
0 commit comments