Skip to content

Commit

Permalink
Add version number handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Jan 14, 2020
1 parent bc45266 commit 094acb2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ RUN export PATH=/cargo-home/bin:/rustup-home:$PATH && \

# we copy those only at the end which makes testing of new scripts faster as the other layers are cached
COPY ./scripts/* /srtool/
COPY VERSION /srtool/

CMD ["/srtool/build"]
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.9.0
42 changes: 26 additions & 16 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ trap "exit" INT
# This is where docker expects our substrate/polkadot repo to be
cd /build

echo "🧰 Substrate Runtime Toolbox 🧰"
echo " - by Chevdor -"
VERSION=`cat /srtool/VERSION`
GEN="srtool v$VERSION"

if [[ ! "$*" == *"--json"* ]]; then
echo "🧰 Substrate Runtime Toolbox - $GEN 🧰"
echo " - by Chevdor -"
fi

# srtool only makes sense when called from a Cargo folder so we check that
if [ ! -f Cargo.toml ]; then
Expand All @@ -22,10 +27,12 @@ fi

RUSTCV=`rustc -V`

echo -e "🏗 Building $PACKAGE as $PROFILE using $RUSTCV"
echo -e "⏳ That can take a little while, be patient... subsequent builds will be faster."
echo -e " Since you have to wait a little, you may want to learn more about Substrate runtimes:"
echo -e " https://substrate.dev/docs/en/runtime/architecture-of-a-runtime"
if [[ ! "$*" == *"--json"* ]]; then
echo -e "🏗 Building $PACKAGE as $PROFILE using $RUSTCV"
echo -e "⏳ That can take a little while, be patient... subsequent builds will be faster."
echo -e " Since you have to wait a little, you may want to learn more about Substrate runtimes:"
echo -e " https://substrate.dev/docs/en/runtime/architecture-of-a-runtime"
fi

# Build the runtime and time it :)
CMD="cargo build --$PROFILE -p $PACKAGE --target-dir target/srtool"
Expand All @@ -38,7 +45,9 @@ fi
# The following would be nice but not in rust stable yet
#--out-dir srtool-out

echo "✨ Your Substrate WASM Runtime is ready! ✨"
if [[ ! "$*" == *"--json"* ]]; then
echo "✨ Your Substrate WASM Runtime is ready! ✨"
fi

#WASM=`find . -type f -name *.wasm | grep $PROFILE | grep -v deps | grep compact | head -1`
WASM=`find ./target/srtool/$PROFILE/wbuild/$PACKAGE/*.compact.wasm`
Expand Down Expand Up @@ -76,7 +85,7 @@ esac
if [[ "$*" == *"--json"* ]]
then
JSON=$( jq -n \
--arg gen "srtool" \
--arg gen "$GEN" \
--arg rustc "$RUSTCV" \
--arg bytes "$SZ" \
--arg wasm "$WASM" \
Expand All @@ -94,12 +103,13 @@ then
fi
else
echo "Summary:"
echo " Time : $TMSP"
echo " Rustc : $RUSTCV"
echo " Size : $MB ($SZ)"
echo " Content : $PREVIEW"
printf " Package : ${PKG_COLOR}$PACKAGE${NC}\n"
printf " Proposal : ${YELLOW}$PROP${NC}\n"
echo " SHA256 : $SHA256"
echo " Wasm : $WASM"
echo " Generator : $GEN"
echo " Time : $TMSP"
echo " Rustc : $RUSTCV"
echo " Size : $MB ($SZ)"
echo " Content : $PREVIEW"
printf " Package : ${PKG_COLOR}$PACKAGE${NC}\n"
printf " Proposal : ${YELLOW}$PROP${NC}\n"
echo " SHA256 : $SHA256"
echo " Wasm : $WASM"
fi

0 comments on commit 094acb2

Please sign in to comment.