lbry-desktop/build/build.sh
Igor Gassmann 77ae75a655 chore: remove daemon download from build.sh
Daemon is now being download when the command $ yarn install is used.
2018-03-07 18:26:35 -05:00

77 lines
2 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
cd "$ROOT"
BUILD_DIR="$ROOT/build"
LINUX=false
OSX=false
if [ "$(uname)" == "Darwin" ]; then
echo -e "\033[0;32mBuilding for OSX\x1b[m"
OSX=true
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
echo -e "\033[0;32mBuilding for Linux\x1b[m"
LINUX=true
else
echo -e "\033[1;31mPlatform detection failed\x1b[m"
exit 1
fi
if $OSX; then
ICON="$BUILD_DIR/icon.icns"
else
ICON="$BUILD_DIR/icons/48x48.png"
fi
FULL_BUILD="${FULL_BUILD:-false}"
if [ -n "${TEAMCITY_VERSION:-}" -o -n "${APPVEYOR:-}" ]; then
FULL_BUILD="true"
fi
DEPS="${DEPS:-$FULL_BUILD}"
if [ "$DEPS" != "true" ]; then
echo -e "\033[1;36mDependencies will NOT be installed. Run with \"INSTALL_DEPENDENCIES=true\" to install dependencies, or \"FULL_BUILD=true\" to install dependencies and build a complete app.\x1b[m"
else
# install dependencies
echo -e "\033[0;32mInstalling Dependencies\x1b[m"
"$BUILD_DIR/install_deps.sh"
fi
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
yarn install
###################
# Build the app #
###################
if [ "$FULL_BUILD" == "true" ]; then
if $OSX; then
security unlock-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain
fi
yarn build
# Workaround: TeamCity expects the dmg to be in dist/mac, but in the new electron-builder
# it's put directly in dist/ (the right way to solve this is to update the TeamCity config)
if $OSX; then
cp dist/*.dmg dist/mac
fi
# electron-build has a publish feature, but I had a hard time getting
# it to reliably work and it also seemed difficult to configure. Not proud of
# this, but it seemed better to write my own.
VENV="$BUILD_DIR/venv"
if [ -d "$VENV" ]; then
rm -rf "$VENV"
fi
virtualenv "$VENV"
"$VENV/bin/pip" install -r "$BUILD_DIR/requirements.txt"
"$VENV/bin/python" "$BUILD_DIR/upload_assets.py"
echo -e '\033[0;32mBuild and packaging complete.\x1b[m'
else
echo -e 'Build complete. Run \033[1;31myarn dev\x1b[m to launch the app'
fi