This repository was archived by the owner on Nov 15, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 14 files changed +96
-55
lines changed Expand file tree Collapse file tree 14 files changed +96
-55
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,8 @@ matrix:
14
14
script :
15
15
- cargo test --all
16
16
- cargo clean
17
- - ./publish-wasm.sh
17
+ - ./init.sh
18
+ - ./build.sh
19
+ - if [ "$TRAVIS_PULL_REQUEST" != "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
20
+ ./publish-wasm.sh;
21
+ fi
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
3
- # NOTE `cargo install wasm-gc` before running this script.
4
- # NOTE `cargo install --git https://github.com/pepyakin/wasm-export-table.git`
3
+ # This script assumes that all pre-requisites are installed.
5
4
6
5
set -e
6
+
7
+ source ` dirname " $0 " ` /common.sh
8
+
7
9
export CARGO_INCREMENTAL=0
8
10
9
- cd demo/runtime/wasm && ./build.sh && cd ../../..
10
- cd substrate/executor/wasm && ./build.sh && cd ../../..
11
- cd substrate/test-runtime/wasm && ./build.sh && cd ../../..
12
- cd polkadot/runtime/wasm && ./build.sh && cd ../../..
13
- cd polkadot/parachain/test-chains && ./build.sh && cd ../../..
11
+ # Save current directory.
12
+ pushd .
13
+
14
+ cd $ROOT
15
+
16
+ for SRC in " ${SRCS[@]} "
17
+ do
18
+ echo " *** Building wasm binaries in $SRC "
19
+ cd $SRC
20
+
21
+ ./build.sh
22
+
23
+ cd - >> /dev/null
24
+ done
25
+
26
+ # Restore initial directory.
27
+ popd
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ ROOT=` dirname " $0 " `
4
+
5
+ # A list of directories which contain wasm projects.
6
+ SRCS=(
7
+ " polkadot/runtime/wasm"
8
+ " substrate/executor/wasm"
9
+ " demo/runtime/wasm"
10
+ " substrate/test-runtime/wasm"
11
+ " polkadot/parachain/test-chains/basic_add"
12
+ )
13
+
14
+ # Make pushd/popd silent.
15
+
16
+ pushd () {
17
+ command pushd " $@ " > /dev/null
18
+ }
19
+
20
+ popd () {
21
+ command popd " $@ " > /dev/null
22
+ }
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
set -e
3
3
4
4
cargo +nightly build --target=wasm32-unknown-unknown --release
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ echo " *** Initilising WASM build environment"
6
+
7
+ rustup update nightly
8
+ rustup target add wasm32-unknown-unknown --toolchain nightly
9
+ rustup update stable
10
+
11
+ # Install wasm-gc. It's useful for stripping slimming down wasm binaries.
12
+ command -v wasm-gc || \
13
+ cargo +nightly install --git https://github.com/alexcrichton/wasm-gc
14
+
15
+ # At the moment of writing, rustc still uses LLD 6 which produces wasm binaries
16
+ # that don't export a table. Meanwhile, we are waiting for LLD 7 to come
17
+ # in rustc we could use this handy little tool.
18
+ command -v wasm-export-table || \
19
+ cargo +nightly install --git https://github.com/pepyakin/wasm-export-table.git
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -e
3
+
4
+ # Make LLD produce a binary that imports memory from the outside environment.
5
+ export RUSTFLAGS=" -C link-arg=--import-memory"
6
+
7
+ cargo +nightly build --target=wasm32-unknown-unknown --release --no-default-features
8
+
9
+ for i in basic_add
10
+ do
11
+ wasm-gc target/wasm32-unknown-unknown/release/$i .wasm target/wasm32-unknown-unknown/release/$i .compact.wasm
12
+ done
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
set -e
3
3
4
4
rm -rf ./target
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
set -e
3
3
4
4
cargo +nightly build --target=wasm32-unknown-unknown --release
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments