#!/bin/bash -ea target=${1-dev} echo "building ui modules with target=$target" cd "$(git rev-parse --show-toplevel)" mkdir -p public/compiled ts_apps1="common chess" ts_apps2="ceval game tree chat" apps="site chat cli challenge notify learn insight editor puzzle round analyse lobby tournament tournamentSchedule simul perfStat dasher" yarn install --non-interactive build_ts() { echo "build_ts" "$@" set -ev cd ui/$1 yarn run compile } build() { echo "build" "$@" set -ev cd ui/$1 gulp $target } if type -p parallel; then # parallel execution! if [ -z "$P_OPTS" -a ! -e ~/.parallel/config ]; then P_OPTS="-j+4 --halt 2" [ "$TRAVIS" = "true" ] || P_OPTS+=" --bar" fi set -x parallel --gnu $P_OPTS build_ts ::: $ts_apps1 parallel --gnu $P_OPTS build_ts ::: $ts_apps2 parallel --gnu $P_OPTS build ::: $apps else # sequential execution echo "For faster builds, install GNU parallel." for app in $ts_apps1 $ts_apps2; do (build_ts $app); done for app in $apps; do (build $app); done fi