This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Refactor build scripts. #210
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,13 +1,27 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
# NOTE `cargo install wasm-gc` before running this script. | ||
# NOTE `cargo install --git https:/pepyakin/wasm-export-table.git` | ||
# This script assumes that all pre-requisites are installed. | ||
|
||
set -e | ||
|
||
source `dirname "$0"`/common.sh | ||
|
||
export CARGO_INCREMENTAL=0 | ||
|
||
cd demo/runtime/wasm && ./build.sh && cd ../../.. | ||
cd substrate/executor/wasm && ./build.sh && cd ../../.. | ||
cd substrate/test-runtime/wasm && ./build.sh && cd ../../.. | ||
cd polkadot/runtime/wasm && ./build.sh && cd ../../.. | ||
cd polkadot/parachain/test-chains && ./build.sh && cd ../../.. | ||
# Save current directory. | ||
pushd . | ||
|
||
cd $ROOT | ||
|
||
for SRC in "${SRCS[@]}" | ||
do | ||
echo "*** Building wasm binaries in $SRC" | ||
cd $SRC | ||
|
||
./build.sh | ||
|
||
cd - >> /dev/null | ||
done | ||
|
||
# Restore initial directory. | ||
popd |
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,22 @@ | ||
#!/bin/bash | ||
|
||
ROOT=`dirname "$0"` | ||
|
||
# A list of directories which contain wasm projects. | ||
SRCS=( | ||
"polkadot/runtime/wasm" | ||
"substrate/executor/wasm" | ||
"demo/runtime/wasm" | ||
"substrate/test-runtime/wasm" | ||
"polkadot/parachain/test-chains/basic_add" | ||
) | ||
|
||
# Make pushd/popd silent. | ||
|
||
pushd () { | ||
command pushd "$@" > /dev/null | ||
} | ||
|
||
popd () { | ||
command popd "$@" > /dev/null | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
echo "*** Initilising WASM build environment" | ||
|
||
rustup update nightly | ||
rustup target add wasm32-unknown-unknown --toolchain nightly | ||
rustup update stable | ||
|
||
# Install wasm-gc. It's useful for stripping slimming down wasm binaries. | ||
command -v wasm-gc || \ | ||
cargo +nightly install --git https:/alexcrichton/wasm-gc | ||
|
||
# At the moment of writing, rustc still uses LLD 6 which produces wasm binaries | ||
# that don't export a table. Meanwhile, we are waiting for LLD 7 to come | ||
# in rustc we could use this handy little tool. | ||
command -v wasm-export-table || \ | ||
cargo +nightly install --git https:/pepyakin/wasm-export-table.git |
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,12 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Make LLD produce a binary that imports memory from the outside environment. | ||
export RUSTFLAGS="-C link-arg=--import-memory" | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release --no-default-features | ||
|
||
for i in basic_add | ||
do | ||
wasm-gc target/wasm32-unknown-unknown/release/$i.wasm target/wasm32-unknown-unknown/release/$i.compact.wasm | ||
done |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
rm -rf ./target | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo +nightly build --target=wasm32-unknown-unknown --release | ||
|
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to test this condition without merging the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally set GH_TOKEN and then manually run the publish script just to make sure it goes through. (You may not have access to the repo, will add you there). At least it will make sure the publish part works (The above condition itself should)