From e9da652e9a8d20c47e17824611dd3e7bfb2f47a6 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 25 Dec 2022 11:46:32 -0500 Subject: [PATCH] scripts --- setup_linux.sh | 5 +++++ veilid-flutter/example/lib/app.dart | 3 +++ veilid-wasm/wasm_build.sh | 28 +++++++++++++++++++--------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/setup_linux.sh b/setup_linux.sh index 87118146..38d97ba0 100755 --- a/setup_linux.sh +++ b/setup_linux.sh @@ -1,6 +1,11 @@ #!/bin/bash SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +if [[ "$(uname)" != "Linux" ]]; then + echo Not running Linux + exit 1 +fi + if [ "$(lsb_release -d | grep -qEi 'debian|buntu|mint')" ]; then echo Not a supported Linux exit 1 diff --git a/veilid-flutter/example/lib/app.dart b/veilid-flutter/example/lib/app.dart index f630303d..3c9e7fbb 100644 --- a/veilid-flutter/example/lib/app.dart +++ b/veilid-flutter/example/lib/app.dart @@ -167,6 +167,9 @@ class _MyAppState extends State with UiLoggy { }, onSubmitted: (String v) async { try { + if (v.isEmpty) { + return; + } var res = await Veilid.instance.debug(v); loggy.info(res); setState(() { diff --git a/veilid-wasm/wasm_build.sh b/veilid-wasm/wasm_build.sh index 9aa3cbf8..093bbcc1 100755 --- a/veilid-wasm/wasm_build.sh +++ b/veilid-wasm/wasm_build.sh @@ -1,6 +1,13 @@ #!/bin/bash SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +set -eo pipefail + +get_abs_filename() { + # $1 : relative filename + echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" +} + pushd $SCRIPTDIR &> /dev/null if [ -f /usr/local/opt/llvm/bin/llvm-dwarfdump ]; then @@ -15,7 +22,15 @@ else fi -if [[ "$1" == "debug" ]]; then +if [[ "$1" == "release" ]]; then + OUTPUTDIR=../target/wasm32-unknown-unknown/release/pkg + INPUTDIR=../target/wasm32-unknown-unknown/release + + cargo build --target wasm32-unknown-unknown --release + mkdir -p $OUTPUTDIR + wasm-bindgen --out-dir $OUTPUTDIR --target web --no-typescript $INPUTDIR/veilid_wasm.wasm + wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm +else OUTPUTDIR=../target/wasm32-unknown-unknown/debug/pkg INPUTDIR=../target/wasm32-unknown-unknown/debug @@ -24,14 +39,9 @@ if [[ "$1" == "debug" ]]; then wasm-bindgen --out-dir $OUTPUTDIR --target web --no-typescript --keep-debug --debug $INPUTDIR/veilid_wasm.wasm ./wasm-sourcemap.py $OUTPUTDIR/veilid_wasm_bg.wasm -o $OUTPUTDIR/veilid_wasm_bg.wasm.map --dwarfdump $DWARFDUMP # wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm -else - OUTPUTDIR=../target/wasm32-unknown-unknown/release/pkg - INPUTDIR=../target/wasm32-unknown-unknown/release - - cargo build --target wasm32-unknown-unknown --release - mkdir -p $OUTPUTDIR - wasm-bindgen --out-dir $OUTPUTDIR --target web --no-typescript $INPUTDIR/veilid_wasm.wasm - wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm fi popd &> /dev/null + +# Print for use with scripts +echo SUCCESS:OUTPUTDIR=$(get_abs_filename $OUTPUTDIR) \ No newline at end of file