Skip to content

Commit

Permalink
Fix env parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lrubasze committed Oct 24, 2024
1 parent a6bb25f commit d3d97ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion radix-clis/src/scrypto/cmd_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ impl Build {
if let Some(env) = &self.env {
let env_variables_decoded: Vec<Vec<&str>> = env
.iter()
.map(|e| e.split('=').collect::<Vec<&str>>())
.map(|e|
// Split string on the first '=' occurence.
// This is to cover cases like this:
// ENV_NAME=foo=bar
match e.split_once('=') {
Some((key, val)) => vec![key, val],
None => vec![e.as_str()],
})
.collect();
for v in env_variables_decoded {
if v.len() == 1 {
Expand Down
7 changes: 5 additions & 2 deletions radix-clis/tests/scrypto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $scrypto new-package hello-world --path $test_pkg --local
#
# To test that the generated Cargo.lock is good, we run a build with the --locked command below.
# This checks that the templated cargo lock is complete.
#
#
# If this line fails, run ./update-cargo-locks-minimally.sh from the repo root to
# regenerate the Cargo.lock_template which is used.
$scrypto build --path $test_pkg --locked
Expand All @@ -30,6 +30,9 @@ $scrypto test --path $test_pkg --locked
$scrypto test --path $test_pkg --locked -- test_hello --nocapture
$scrypto test --path $test_pkg --locked -- --nocapture


$scrypto build --path ../examples/everything --env ENV_NAME=foo=bar

# Logging
$scrypto build --path ../examples/everything --log-level ERROR --locked
size1=$(ls -la ../examples/everything/target/wasm32-unknown-unknown/release/everything.wasm | cut -d ' ' -f 5)
Expand All @@ -51,4 +54,4 @@ else
fi

# Clean up
rm -fr $test_pkg
rm -fr $test_pkg

0 comments on commit d3d97ee

Please sign in to comment.