2019-03-31 18:07:03 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source `dirname $0`/resolve_commands.sh
|
|
|
|
BASEDIR=$(dirname "$0")
|
|
|
|
cd "$BASEDIR/../"
|
|
|
|
|
|
|
|
source_path="client-api/environment/ui-files/raw"
|
|
|
|
if [[ "$1" == "development" ]] || [[ "$1" == "dev" ]] || [[ "$1" == "debug" ]]; then
|
|
|
|
type="development"
|
|
|
|
elif [[ "$1" == "release" ]] || [[ "$1" == "rel" ]]; then
|
|
|
|
type="release"
|
|
|
|
else
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
|
|
echo "Invalid argument count!"
|
|
|
|
else
|
|
|
|
echo "Invalid option $1"
|
|
|
|
fi
|
|
|
|
echo 'Available options are: "development" or "dev", "release" or "rel"'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-10-30 20:39:38 +00:00
|
|
|
echo "Generating file helper script"
|
|
|
|
npm run compile-file-helper
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to generate file helper"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-03-31 18:07:03 +00:00
|
|
|
echo "Generating style files"
|
|
|
|
npm run compile-sass
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to generate style files"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Generating web workers"
|
|
|
|
npm run build-worker-codec
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to build web worker codec"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
npm run build-worker-pow
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to build web worker pow"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Lets build some tools
|
|
|
|
#dtsgen should be already build by build_declarations.sh
|
|
|
|
./tools/build_trgen.sh
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to build typescript translation generator"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Now lets build the declarations
|
|
|
|
echo "Building declarations"
|
2019-09-12 21:59:35 +00:00
|
|
|
./scripts/build_declarations.sh force
|
2019-03-31 18:07:03 +00:00
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to generate declarations"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$type" == "release" ]]; then #Compile everything for release mode
|
|
|
|
#Compile the shared source first
|
|
|
|
echo "Building shared source"
|
|
|
|
./shared/generate_packed.sh
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to build shared source"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Now compile the web client itself
|
2019-09-12 21:59:35 +00:00
|
|
|
echo "Building client UI"
|
2019-03-31 18:07:03 +00:00
|
|
|
./client/generate_packed.sh
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to build web client"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
elif [[ "$type" == "development" ]]; then
|
|
|
|
echo "Building shared source"
|
|
|
|
execute_ttsc -p ./shared/tsconfig/tsconfig.json
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to compile shared sources"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-09-12 21:59:35 +00:00
|
|
|
echo "Building client UI source"
|
2019-03-31 18:07:03 +00:00
|
|
|
execute_ttsc -p ./client/tsconfig/tsconfig.json
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to compile web sources"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Generating environment"
|
2019-10-30 20:52:54 +00:00
|
|
|
node file.js generate client ${type}
|
2019-03-31 18:07:03 +00:00
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo "Failed to generate environment"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Successfully build!"
|