From 45a25a1b8bd182cc6dff2926974681ef1bf4fc6f Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 4 Dec 2017 18:03:27 -0500 Subject: [PATCH] Rudimentary build checking for -dev only. --- .gitignore | 1 + client/package.json | 7 ++++--- scripts/common_startup.sh | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 439dad9bc09..2b466c923fb 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ config/plugins/interactive_environments/**/*.ini !config/plugins static/welcome.html.* static/welcome.html +static/client_build_hash.txt # Tool data. tool-data/annotation_profiler_options.xml diff --git a/client/package.json b/client/package.json index efac95cbb96..12839a74f21 100644 --- a/client/package.json +++ b/client/package.json @@ -32,10 +32,11 @@ }, "scripts": { "watch": "gulp stage-libs && concurrently \"yarn run webpack-watch\" \"yarn run gulp watch\" \"yarn run style-watch\"", - "build": "NODE_ENV=development gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack\" \"yarn run gulp clean && yarn run gulp\"", - "build-production": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production\" \"yarn run gulp clean && yarn run gulp-production\"", - "build-production-maps": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production-maps\" \"yarn run gulp clean && yarn run gulp-production-maps\"", + "build": "NODE_ENV=development gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack\" \"yarn run gulp clean && yarn run gulp\" && yarn run save-build-hash", + "build-production": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production\" \"yarn run gulp clean && yarn run gulp-production\" && yarn run save-build-hash", + "build-production-maps": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production-maps\" \"yarn run gulp clean && yarn run gulp-production-maps\" && yarn run save-build-hash", "webpack": "webpack -d", + "save-build-hash": "git rev-parse HEAD > ../static/client_build_hash.txt", "webpack-watch": "webpack -d --watch", "webpack-production": "webpack -p", "webpack-production-maps": "GXY_BUILD_SOURCEMAPS=1 webpack -p", diff --git a/scripts/common_startup.sh b/scripts/common_startup.sh index 1fdff27ad4a..8e976c17d4d 100755 --- a/scripts/common_startup.sh +++ b/scripts/common_startup.sh @@ -18,6 +18,7 @@ FETCH_WHEELS=1 CREATE_VENV=1 REPLACE_PIP=$SET_VENV COPY_SAMPLE_FILES=1 +SKIP_CLIENT_BUILD=0 for arg in "$@"; do [ "$arg" = "--skip-eggs" ] && FETCH_WHEELS=0 @@ -28,6 +29,7 @@ for arg in "$@"; do [ "$arg" = "--replace-pip" ] && REPLACE_PIP=1 [ "$arg" = "--stop-daemon" ] && FETCH_WHEELS=0 [ "$arg" = "--skip-samples" ] && COPY_SAMPLE_FILES=0 + [ "$arg" = "--no-client-build" ] && SKIP_CLIENT_BUILD=1 done SAMPLES=" @@ -61,6 +63,28 @@ for rmfile in $RMFILES; do [ -f "$rmfile" ] && rm -f "$rmfile" done +# Check client build state. +if [ $SKIP_CLIENT_BUILD -eq 0 ]; then + gitbranch=$(git rev-parse --abbrev-ref HEAD) + if [ $gitbranch == "dev" ]; then + # We're on dev. This branch (only, currently) doesn't have build artifacts. Compare hash. + if [ -f static/client_build_hash.txt ]; then + githash=$(git rev-parse HEAD) + statichash=$(cat static/client_build_hash.txt) + if [ $githash == $statichash ]; then + SKIP_CLIENT_BUILD=1 + fi + fi + else + # Not on dev. We're not going to bug people about building. + SKIP_CLIENT_BUILD=1 + fi + if [ $SKIP_CLIENT_BUILD -eq 0 ]; then + echo "The Galaxy client build is out of date. Please run 'make client-production' or your choice of build target. Please see ./client/README.md for more information." + exit 1 + fi +fi + : ${GALAXY_CONFIG_FILE:=config/galaxy.ini} if [ ! -f "$GALAXY_CONFIG_FILE" ]; then GALAXY_CONFIG_FILE=universe_wsgi.ini