Skip to content

Commit

Permalink
Support building app jar to custom path
Browse files Browse the repository at this point in the history
  • Loading branch information
mluypaert committed Jan 25, 2024
1 parent 4ea0c50 commit 069ff77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif

STORE_SECRETS_FILE = secrets.makedef

DEPLOY_JAR := app.jar
APP_JAR_PATH ?= build/app.jar
PORT := 3000
WB_ACC_NUM := 357210185381

Expand Down Expand Up @@ -109,12 +109,16 @@ ui-build: ENV.GOOGLE_OAUTH_CLIENT_ID \
clean: \
$(call print-help,clean,\
Remove the locally built JAR file.)
@rm -f ./build/${DEPLOY_JAR}
@rm -f ${APP_JAR_PATH}

build/${DEPLOY_JAR}: \
$(call print-help,build/${DEPLOY_JAR},\
${APP_JAR_PATH}: build/ \
$(call print-help,${APP_JAR_PATH},\
Build the jar file.)
@./scripts/build-appjar.sh
@./scripts/build-appjar.sh ${APP_JAR_PATH}

build-app-jar: ${APP_JAR_PATH} \
$(call print-help,build-app-jar,\
Build the jar file.)

.PHONY: docker-build
docker-build: clean build \
Expand Down
12 changes: 5 additions & 7 deletions scripts/build-appjar.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#!/bin/bash

ARTEFACT="build/app.jar"
LATEST_TAG=$(git describe --abbrev=0)
RELEASE_NAME="wormbase-names-${LATEST_TAG}"
DEPLOY_JAR="target/${RELEASE_NAME}.jar"
ARTEFACT=$1
TMP_JAR=$(mktemp --dry-run target/wb-names-app-XXXXXXXXXX.jar)

rm -rf target
mkdir -p target
clj -Spom
clj -A:logging:prod:datomic-pro:webassets:depstar -m hf.depstar.uberjar "${DEPLOY_JAR}"
clj -A:logging:prod:datomic-pro:webassets:depstar -m hf.depstar.uberjar "${TMP_JAR}"
if [ $? -eq 0 ]; then
mv "${DEPLOY_JAR}" "${ARTEFACT}"
echo "${ARTEFACT}"
mv "${TMP_JAR}" "${ARTEFACT}"
exit 0
else
echo >&2 "Failed to build jar '${TMP_JAR}'"
exit 1
fi

0 comments on commit 069ff77

Please sign in to comment.