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 ark0f committed Feb 27, 2023
1 parent b0a8622 commit dc0e4bf
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 @@ -629,8 +642,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 dc0e4bf

Please sign in to comment.