euchre-live

Euchre web-app for the socially distant family
git clone git://git.alexkarle.com/euchre-live.git
Log | Files | Refs | README | LICENSE

commit 14480732a8194c8e1fe54ef83e67c3838be276bd (patch)
parent 97b41cd38bf92fd09d3da6cf4c4fbab852fc4a25
Author: Alex Karle <alex@karle.co>
Date:   Wed, 13 May 2020 00:17:33 -0400

make: Add proper dependency logic to build/release

As mentioned in the top comment, building webpack take both over a
minute on my development laptop and gets my fans spinning real good.

So for cutting a release where no public content has changed, it's
reallllly painful to have to sit through that! (ok, I exaggerate, but my
hobby time is precious!)

Thankfully, this is exactly what make was built for -- only building
that which has changed. Throw in a couple `find`'s and some dependency
magic with timestamp files and boom, we don't have to rebuild webpack
anymore!

Diffstat:
M.gitignore | 1+
MMakefile | 23++++++++++++++++++++---
Mbuild.sh | 9---------
3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -3,3 +3,4 @@ public/asset tags /build/ /build.*/ +.public.ts diff --git a/Makefile b/Makefile @@ -1,3 +1,8 @@ +# Rebuilding the webpack for a server-only release is a painful +# few minutes on my poor old thinkpad. We can do better +PUBLIC_FILES := $(shell find public -type f) +LIB_FILES := $(shell find lib -type f) + .PHONY: all all: test tags @@ -10,12 +15,24 @@ test: perl -c gloat.pl perl t/Rules.t -.PHONY: release -release: test +# If no public files have changed, don't rebuild the webpack! +# We make this timestamp file the dependency for build to +# ensure we don't do it too often... +.public.ts: $(PUBLIC_FILES) ./build.sh + touch .public.ts + +# Only rebuild if any of public/ or the Perl stuff has changed +build: .public.ts $(LIB_FILES) gloat.pl + mkdir -p build + cp -a gloat.pl public lib build + @echo ">>> Build Success! <<<" + +.PHONY: release +release: build test scp -r build/* www@euchre.live:/var/www/euchre-live ssh www@euchre.live sh /var/www/deploy.sh .PHONY: clean clean: - rm -rf build build.1* + rm -rf build diff --git a/build.sh b/build.sh @@ -15,12 +15,3 @@ export MOJO_WEBPACK_BUILD=1 # Run an effectively no-op (non daemonizing) command to kick it off ./gloat.pl routes - -# Make the build directory -[ -d "build" ] && mv build build.`date +%s` -mkdir build -cp -a public lib gloat.pl build - -echo "---------------------------------------------------------------" -echo " Build Success!" -echo "---------------------------------------------------------------"