From 4121c11c026fc3399d79d9557f0d76c318246ef0 Mon Sep 17 00:00:00 2001 From: Chris McCormick Date: Fri, 26 Jul 2019 13:06:33 +0800 Subject: [PATCH] Makefile based build. Use `make` to build. Only those dependencies which have changed will be built. For example `node_modules` will only be installed if package.json has been changed or if it is missing. React app will only be built if web-app sources have been changed. Fixes #23 --- Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9f0a837 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +version=$(shell git describe --abbrev=0 --tags | tr -d 'v') +javasrc=$(shell find src) +websrc=$(shell find web-app/public web-app/src) web-app/package.json +webapptarget=src/main/resources/static/index.html + +target/poli-$(version).jar: $(javasrc) $(webapptarget) + mvn clean install -DskipTests + +web-app/node_modules: web-app/package.json + cd web-app && npm install + +web-app/build/index.html: $(websrc) web-app/node_modules + cd web-app && npm run build + +$(webapptarget): web-app/build/index.html + mkdir -p src/main/resources/static/ + rm -rf src/main/resources/static/* + cp -r web-app/build/* src/main/resources/static/ +