Skip to content

Commit 1bb5ec0

Browse files
committed
Fix bad behaviour on "invalid Wasm" case (used in tests)
Signed-off-by: itowlson <[email protected]>
1 parent c960d87 commit 1bb5ec0

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

crates/build/src/deployment.rs

+6
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ impl DeploymentTargets {
1414
pub fn iter(&self) -> impl Iterator<Item = &str> {
1515
self.target_environments.iter().map(|s| s.as_str())
1616
}
17+
18+
pub fn is_empty(&self) -> bool {
19+
// TODO: it would be nice to let "no-op" behaviour fall out organically,
20+
// but currently we do some stuff eagerly, so...
21+
self.target_environments.is_empty()
22+
}
1723
}

crates/build/src/lib.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ pub async fn build(manifest_file: &Path, component_ids: &[String]) -> Result<()>
3737
build_result?;
3838

3939
if let Ok(manifest) = &manifest {
40-
let resolution_context = spin_environments::ResolutionContext {
41-
base_dir: manifest_file.parent().unwrap().to_owned(),
42-
};
43-
spin_environments::validate_application_against_environment_ids(
44-
deployment_targets.iter(),
45-
manifest,
46-
&resolution_context,
47-
)
48-
.await?;
40+
if !deployment_targets.is_empty() {
41+
let resolution_context = spin_environments::ResolutionContext {
42+
base_dir: manifest_file.parent().unwrap().to_owned(),
43+
};
44+
spin_environments::validate_application_against_environment_ids(
45+
deployment_targets.iter(),
46+
manifest,
47+
&resolution_context,
48+
)
49+
.await?;
50+
}
4951
}
5052

5153
Ok(())

0 commit comments

Comments
 (0)