Skip to content
Snippets Groups Projects
Commit ca484169 authored by Sergey Pepyakin's avatar Sergey Pepyakin
Browse files

Refactor build scripts.

parent 14675edc
No related merge requests found
Showing with 96 additions and 55 deletions
......@@ -14,4 +14,8 @@ matrix:
script:
- cargo test --all
- cargo clean
- ./publish-wasm.sh
- ./init.sh
- ./build.sh
- if [ "$TRAVIS_PULL_REQUEST" != "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
./publish-wasm.sh;
fi
#!/bin/sh
#!/bin/bash
# NOTE `cargo install wasm-gc` before running this script.
# NOTE `cargo install --git https://github.com/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
#!/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
}
#!/bin/sh
#!/bin/bash
set -e
cargo +nightly build --target=wasm32-unknown-unknown --release
......
#!/bin/sh
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup update stable
cargo install --git https://github.com/alexcrichton/wasm-gc
cargo install --git https://github.com/pepyakin/wasm-export-table.git
#!/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://github.com/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://github.com/pepyakin/wasm-export-table.git
#!/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
#!/bin/sh
#!/bin/bash
set -e
rm -rf ./target
......
#!/bin/sh
#!/bin/bash
set -e
cargo +nightly build --target=wasm32-unknown-unknown --release
......
#!/bin/sh
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup update stable
cargo +nightly install --git https://github.com/alexcrichton/wasm-gc
cargo +nightly install --git https://github.com/pepyakin/wasm-export-table.git
#!/bin/bash
# Publish wasm binaries into the special repository.
# This script assumes that wasm binaries have already been built.
# Requires GH_TOKEN environment variable to be defined.
set -e
source `dirname "$0"`/common.sh
if [ -z ${GH_TOKEN+x} ]; then
echo "GH_TOKEN environment variable is not set"
exit 1
fi
REPO="github.com/paritytech/polkadot-wasm-bin.git"
REPO_AUTH="${GH_TOKEN}:@${REPO}"
SRCS=( "polkadot/runtime/wasm" "substrate/executor/wasm" "demo/runtime/wasm" "substrate/test-runtime/wasm" "polkadot/parachain/test-chains" )
DST=".wasm-binaries"
TARGET="wasm32-unknown-unknown"
UTCDATE=`date -u "+%Y%m%d.%H%M%S.0"`
pushd .
echo "*** Initilising WASM build environment"
cd polkadot/runtime/wasm
./init.sh || true
cd ../../..
for SRC in "${SRCS[@]}"
do
echo "*** Building wasm binaries in $SRC"
cd $SRC
./build.sh
cd ../../..
done
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "master" ]; then
popd
echo "*** Skipping wasm binary publish"
exit 0
fi
echo "*** Cloning repo"
rm -rf $DST
git clone https://$REPO $DST
......
#!/bin/sh
#!/bin/bash
set -e
cargo +nightly build --target=wasm32-unknown-unknown --release
......
#!/bin/sh
#!/bin/bash
set -e
cargo +nightly build --target=wasm32-unknown-unknown --release
......
#!/bin/sh
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup update stable
cargo install --git https://github.com/alexcrichton/wasm-gc
cargo install --git https://github.com/pepyakin/wasm-export-table.git
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment