forked from hyperledger-iroha/iroha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[change] generation script to be a separate shell script
Signed-off-by: Asem-Abdelhady <[email protected]>
- Loading branch information
1 parent
81bb940
commit 5e7efb7
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,4 @@ result | |
/test/ | ||
/iroha-java/ | ||
/lcov.info | ||
**/test-smartcontracts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <source-dir>" | ||
exit 1 | ||
fi | ||
|
||
# First argument is the source directory | ||
SOURCE_DIR="$1" | ||
|
||
TARGET_DIR="test-smartcontracts" | ||
|
||
mkdir -p "$TARGET_DIR" | ||
|
||
for folder in "$SOURCE_DIR"/**; do | ||
if [ -d "$folder" ] && [ "$(basename "$folder")" != ".cargo" ]; then | ||
|
||
folder_name=$(basename "$folder") | ||
target_wasm_file_path="${TARGET_DIR}/${folder_name}.wasm" | ||
# Build the smart contracts | ||
cargo run --bin iroha_wasm_builder_cli -- build "$folder" --optimize --outfile "$target_wasm_file_path" | ||
|
||
fi | ||
done | ||
|
||
echo "Smart contracts build complete." | ||
|
||
# How to run: | ||
# make sure you root from the root directrory if iroha or | ||
# any iroha directory that is not a package in the working space | ||
# run the following command: | ||
# ./path/to/script/generate_wasm.sh /path/to/smart_contracts |