Skip to content

Commit

Permalink
wasm-builder: Fall back to release profile for unknown profiles (pa…
Browse files Browse the repository at this point in the history
  • Loading branch information
athei authored and Wizdave97 committed Feb 4, 2022
1 parent 5de236b commit e0a7d97
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions utils/wasm-builder/src/wasm_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,21 @@ impl Profile {
(Some(Profile::Debug), false) => Profile::Release,
// For any other profile or when overriden we take it at face value.
(Some(profile), _) => profile,
// For non overriden unknown profiles we fall back to `Release`.
// This allows us to continue building when a custom profile is used for the
// main builds cargo. When explicitly passing a profile via env variable we are
// not doing a fallback.
(None, false) => {
let profile = Profile::Release;
build_helper::warning!(
"Unknown cargo profile `{}`. Defaulted to `{:?}` for the runtime build.",
name,
profile,
);
profile
},
// Invalid profile specified.
(None, _) => {
(None, true) => {
// We use println! + exit instead of a panic in order to have a cleaner output.
println!(
"Unexpected profile name: `{}`. One of the following is expected: {:?}",
Expand Down Expand Up @@ -627,8 +640,8 @@ fn compress_wasm(wasm_binary_path: &Path, compressed_binary_out_path: &Path) ->

true
} else {
println!(
"cargo:warning=Writing uncompressed wasm. Exceeded maximum size {}",
build_helper::warning!(
"Writing uncompressed wasm. Exceeded maximum size {}",
CODE_BLOB_BOMB_LIMIT,
);

Expand Down

0 comments on commit e0a7d97

Please sign in to comment.