2020-10-30 14:54:13 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2017-07-03 15:38:19 +08:00
|
|
|
|
2016-01-04 19:35:25 +08:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
|
|
|
ROOT=$(dirname $(dirname $(realpath "$0")))
|
|
|
|
else
|
|
|
|
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
2022-02-17 01:16:46 +08:00
|
|
|
# --disable-dev-shm-usage: when run on docker containers where size of /dev/shm
|
2021-05-04 17:18:19 +08:00
|
|
|
# partition < 64MB which causes OOM failure for chromium compositor that uses the partition for shared memory
|
2022-02-17 01:16:46 +08:00
|
|
|
LINUX_EXTRA_ARGS="--disable-dev-shm-usage"
|
2016-01-04 19:35:25 +08:00
|
|
|
fi
|
|
|
|
|
2016-05-10 22:42:47 +08:00
|
|
|
cd $ROOT
|
2016-05-10 22:15:48 +08:00
|
|
|
|
2016-08-09 23:13:08 +08:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2016-08-09 23:56:05 +08:00
|
|
|
NAME=`node -p "require('./product.json').nameLong"`
|
2016-08-09 23:13:08 +08:00
|
|
|
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
|
|
|
else
|
|
|
|
NAME=`node -p "require('./product.json').applicationName"`
|
2016-08-09 23:57:09 +08:00
|
|
|
CODE=".build/electron/$NAME"
|
2016-08-09 23:13:08 +08:00
|
|
|
fi
|
|
|
|
|
2021-11-19 18:12:49 +08:00
|
|
|
VSCODECRASHDIR=$ROOT/.build/crashes
|
|
|
|
|
2016-04-21 08:41:11 +08:00
|
|
|
# Node modules
|
2024-09-06 21:18:02 +08:00
|
|
|
test -d node_modules || npm i
|
2016-04-21 08:41:11 +08:00
|
|
|
|
|
|
|
# Get electron
|
2024-09-06 21:18:02 +08:00
|
|
|
npm run electron
|
2016-04-21 08:41:11 +08:00
|
|
|
|
2016-01-04 19:35:25 +08:00
|
|
|
# Unit Tests
|
2017-07-03 17:45:11 +08:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2017-04-10 16:20:56 +08:00
|
|
|
cd $ROOT ; ulimit -n 4096 ; \
|
2019-09-02 15:30:31 +08:00
|
|
|
ELECTRON_ENABLE_LOGGING=1 \
|
2016-08-09 23:13:08 +08:00
|
|
|
"$CODE" \
|
2021-11-19 18:12:49 +08:00
|
|
|
test/unit/electron/index.js --crash-reporter-directory=$VSCODECRASHDIR "$@"
|
2016-01-04 19:35:25 +08:00
|
|
|
else
|
2017-04-10 16:20:56 +08:00
|
|
|
cd $ROOT ; \
|
2019-09-02 15:30:31 +08:00
|
|
|
ELECTRON_ENABLE_LOGGING=1 \
|
2016-08-09 23:13:08 +08:00
|
|
|
"$CODE" \
|
2021-11-19 18:12:49 +08:00
|
|
|
test/unit/electron/index.js --crash-reporter-directory=$VSCODECRASHDIR $LINUX_EXTRA_ARGS "$@"
|
2016-01-04 19:35:25 +08:00
|
|
|
fi
|