lbry-desktop/build.sh

99 lines
1.9 KiB
Bash
Raw Normal View History

2017-01-18 16:39:21 -05:00
#!/bin/bash
2017-01-16 14:06:53 -05:00
2017-03-06 17:17:03 -05:00
set -euo pipefail
set -x
2017-01-16 14:06:53 -05:00
2017-01-18 11:37:44 -05:00
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$ROOT"
if [ "$(uname)" == "Darwin" ]; then
2017-01-26 18:21:27 -06:00
ICON="$ROOT/build/icon.icns"
else
2017-01-26 18:21:27 -06:00
ICON="$ROOT/build/icons/lbry48.png"
fi
2017-02-10 13:11:26 -06:00
FULL_BUILD="${FULL_BUILD:-false}"
if [ -n "${TEAMCITY_VERSION:-}" -o -n "${APPVEYOR:-}" ]; then
2017-02-10 13:11:26 -06:00
FULL_BUILD="true"
fi
if [ "$FULL_BUILD" == "true" ]; then
# install dependencies
$ROOT/prebuild.sh
2017-01-19 03:51:54 -06:00
VENV="$ROOT/build_venv"
if [ -d "$VENV" ]; then
rm -rf "$VENV"
fi
virtualenv "$VENV"
set +u
source "$VENV/bin/activate"
set -u
2017-03-06 11:52:03 -05:00
pip install -r "$ROOT/requirements.txt"
python "$ROOT/set_version.py"
python "$ROOT/set_build.py"
2017-01-18 16:35:06 -05:00
fi
2017-01-18 16:33:27 -05:00
2017-03-07 10:28:37 -05:00
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
mkdir -p "$ROOT/dist"
[ -d "$ROOT/app/dist" ] && rm -rf "$ROOT/app/dist"
2017-03-06 18:00:57 -05:00
mkdir -p "$ROOT/app/dist"
2017-03-06 17:17:03 -05:00
2017-01-26 19:38:52 -06:00
npm install
2017-03-06 17:17:03 -05:00
############
# UI #
############
2017-01-18 11:37:44 -05:00
(
cd "$ROOT/lbry-web-ui"
npm install
node_modules/.bin/node-sass --output dist/css --sourcemap=none scss/
node_modules/.bin/webpack
2017-03-07 10:28:37 -05:00
cp -r dist/* "$ROOT/app/dist/"
2017-01-18 11:37:44 -05:00
)
2017-01-16 14:06:53 -05:00
2017-01-26 12:30:02 -06:00
2017-03-07 10:28:37 -05:00
####################
# lbrynet-daemon #
####################
(
cd "$ROOT/lbrynet-daemon"
pip install -r linux_macos.txt
pyinstaller -y lbry.onefile.spec
mv dist/lbrynet-daemon "$ROOT/app/dist/"
)
python zip_daemon.py
2017-03-06 17:17:03 -05:00
###################
# Build the app #
###################
(
cd "$ROOT/app"
npm install
)
2017-02-10 13:11:26 -06:00
if [ "$FULL_BUILD" == "true" ]; then
2017-01-26 20:36:05 -06:00
if [ "$(uname)" == "Darwin" ]; then
security unlock-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain
fi
2017-01-18 13:03:10 -05:00
2017-02-09 18:54:42 -06:00
node_modules/.bin/build -p never
2017-03-07 10:28:37 -05:00
# 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.
python release_on_tag.py
2017-02-09 18:53:07 -06:00
2017-03-06 17:17:03 -05:00
deactivate
echo 'Build and packaging complete.'
else
2017-02-08 10:20:34 -06:00
echo 'Build complete. Run `./node_modules/.bin/electron app` to launch the app'
2017-03-06 17:17:03 -05:00
fi