diff --git a/util/sdks/assemblyscript.sh b/util/sdks/assemblyscript.sh index f97128fc1..45962f82a 100755 --- a/util/sdks/assemblyscript.sh +++ b/util/sdks/assemblyscript.sh @@ -70,10 +70,11 @@ build_assemblyscript_sdk() { if [[ -f "$DIR_PROXY_WASM_ASSEMBLYSCRIPT_SDK/.hash" \ && $(cat "$DIR_PROXY_WASM_ASSEMBLYSCRIPT_SDK/.hash") == $(echo $hash_src) - && -z "$clean" ]]; + && -z "$clean" ]] && \ + find $DIR_PROXY_WASM_ASSEMBLYSCRIPT_SDK -name '*.wasm' | grep -q . then notice "AssemblyScript examples already built" - exit + return fi echo $hash_src > "$DIR_PROXY_WASM_ASSEMBLYSCRIPT_SDK/.hash" @@ -87,7 +88,17 @@ build_assemblyscript_sdk() { pushd $example npm install npm run asbuild - cp build/debug.wasm $DIR_TESTS_LIB_WASM/assemblyscript_$name.wasm + popd + done +} + +install_assemblyscript_sdk_examples() { + for example in $DIR_PROXY_WASM_ASSEMBLYSCRIPT_SDK/examples/*; do + name=$(basename $example) + name=$(echo $name | sed 's/-/_/g') + + pushd $example + cp -av build/debug.wasm $DIR_TESTS_LIB_WASM/assemblyscript_$name.wasm popd done } @@ -103,4 +114,5 @@ if [ "$mode" = "download" ]; then else build_assemblyscript_sdk "$version" "$clean" + install_assemblyscript_sdk_examples fi diff --git a/util/sdks/go.sh b/util/sdks/go.sh index b7bed5964..3432e76c0 100755 --- a/util/sdks/go.sh +++ b/util/sdks/go.sh @@ -66,10 +66,11 @@ build_go_sdk() { if [[ -d "$DIR_PATCHED_PROXY_WASM_GO_SDK" \ && -f "$DIR_PATCHED_PROXY_WASM_GO_SDK/.hash" \ && $(cat "$DIR_PATCHED_PROXY_WASM_GO_SDK/.hash") == $(echo $hash_src) - && -z "$clean" ]]; + && -z "$clean" ]] && \ + find $DIR_PATCHED_PROXY_WASM_GO_SDK -name '*.wasm' | grep -q . then notice "Go examples already built" - exit + return fi rm -rf $DIR_PATCHED_PROXY_WASM_GO_SDK @@ -105,7 +106,11 @@ EOF notice "compiling Go examples..." make build.examples || exit 0 + popd +} +install_go_sdk_examples() { + pushd $DIR_PATCHED_PROXY_WASM_GO_SDK cd examples find . -name "*.wasm" | while read f; do @@ -128,4 +133,5 @@ if [ "$mode" = "download" ]; then else build_go_sdk "$version" "$clean" + install_go_sdk_examples fi