Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

wasm-builder: Fall back to release profile for unknown profiles #10775

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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