mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 15:41:02 +00:00
Refactor build scripts.
This commit is contained in:
@@ -14,4 +14,8 @@ matrix:
|
|||||||
script:
|
script:
|
||||||
- cargo test --all
|
- cargo test --all
|
||||||
- cargo clean
|
- cargo clean
|
||||||
- ./publish-wasm.sh
|
- ./init.sh
|
||||||
|
- ./build.sh
|
||||||
|
- if [ "$TRAVIS_PULL_REQUEST" != "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||||
|
./publish-wasm.sh;
|
||||||
|
fi
|
||||||
|
|||||||
+22
-8
@@ -1,13 +1,27 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# NOTE `cargo install wasm-gc` before running this script.
|
# This script assumes that all pre-requisites are installed.
|
||||||
# NOTE `cargo install --git https://github.com/pepyakin/wasm-export-table.git`
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
source `dirname "$0"`/common.sh
|
||||||
|
|
||||||
export CARGO_INCREMENTAL=0
|
export CARGO_INCREMENTAL=0
|
||||||
|
|
||||||
cd demo/runtime/wasm && ./build.sh && cd ../../..
|
# Save current directory.
|
||||||
cd substrate/executor/wasm && ./build.sh && cd ../../..
|
pushd .
|
||||||
cd substrate/test-runtime/wasm && ./build.sh && cd ../../..
|
|
||||||
cd polkadot/runtime/wasm && ./build.sh && cd ../../..
|
cd $ROOT
|
||||||
cd polkadot/parachain/test-chains && ./build.sh && cd ../../..
|
|
||||||
|
for SRC in "${SRCS[@]}"
|
||||||
|
do
|
||||||
|
echo "*** Building wasm binaries in $SRC"
|
||||||
|
cd $SRC
|
||||||
|
|
||||||
|
./build.sh
|
||||||
|
|
||||||
|
cd - >> /dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
# Restore initial directory.
|
||||||
|
popd
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cargo +nightly build --target=wasm32-unknown-unknown --release
|
cargo +nightly build --target=wasm32-unknown-unknown --release
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/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
|
|
||||||
Executable
+19
@@ -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://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
|
||||||
@@ -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
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -rf ./target
|
rm -rf ./target
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cargo +nightly build --target=wasm32-unknown-unknown --release
|
cargo +nightly build --target=wasm32-unknown-unknown --release
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/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
|
|
||||||
+11
-20
@@ -1,35 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/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
|
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="github.com/paritytech/polkadot-wasm-bin.git"
|
||||||
REPO_AUTH="${GH_TOKEN}:@${REPO}"
|
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"
|
DST=".wasm-binaries"
|
||||||
TARGET="wasm32-unknown-unknown"
|
TARGET="wasm32-unknown-unknown"
|
||||||
UTCDATE=`date -u "+%Y%m%d.%H%M%S.0"`
|
UTCDATE=`date -u "+%Y%m%d.%H%M%S.0"`
|
||||||
|
|
||||||
pushd .
|
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"
|
echo "*** Cloning repo"
|
||||||
rm -rf $DST
|
rm -rf $DST
|
||||||
git clone https://$REPO $DST
|
git clone https://$REPO $DST
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cargo +nightly build --target=wasm32-unknown-unknown --release
|
cargo +nightly build --target=wasm32-unknown-unknown --release
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cargo +nightly build --target=wasm32-unknown-unknown --release
|
cargo +nightly build --target=wasm32-unknown-unknown --release
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/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
|
|
||||||
Reference in New Issue
Block a user