From cc0880560b5ac939deb3891df7cd58cce6e2ad81 Mon Sep 17 00:00:00 2001 From: Matt Weiden <538456+mweiden@users.noreply.github.com> Date: Wed, 18 Dec 2019 17:45:37 -0800 Subject: [PATCH] Modularize Makefile into client and server Makefiles Part of the reason that the Makefile in the root directory is a bit complicated is that it tries to handle tasks that can be handled separately in the client and server modules. This commit pushes some of the make logic specific to each module into their own makefiles and calls out to those makefiles from that in the project root. --- Makefile | 38 +++++++++++++++++++++----------------- client/Makefile | 12 ++++++++++++ server/Makefile | 4 ++++ 3 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 client/Makefile create mode 100644 server/Makefile diff --git a/Makefile b/Makefile index f5688400..31a9ff7e 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,30 @@ CLEANFILES := $(BUILDDIR)/ client/build build dist cellxgene.egg-info PART ?= patch + +# CLEANING +.PHONY: clean +clean: clean-lite clean-server clean-client + +# cleaning the client's node_modules is the longest one, so we avoid that if possible +.PHONY: clean-lite +clean-lite: + rm -rf $(CLEANFILES) + +clean-%: + cd $(*) && $(MAKE) clean + + # BUILDING PACKAGE .PHONY: build build: clean build-server @echo "done" +.PHONY: build-client +build-client: + cd client && $(MAKE) install build + .PHONY: build-server build-server: build-client mkdir -p $(SERVERBUILD) @@ -24,11 +42,6 @@ build-server: build-client cp $(CLIENTBUILD)/service-worker.js $(SERVERBUILD)/app/web/static/js/ cp MANIFEST.in README.md setup.cfg setup.py $(BUILDDIR) -.PHONY: build-client -build-client: - npm install --prefix client/ client - npm run --prefix client build - # If you are actively developing in the server folder use this, dirties the source tree .PHONY: build-for-server-dev build-for-server-dev: clean-server build-client @@ -40,19 +53,8 @@ build-for-server-dev: clean-server build-client cp client/build/favicon.png server/app/web/static/img cp client/build/service-worker.js server/app/web/static/js/ -.PHONY: clean -clean: clean-lite clean-server - rm -rf client/node_modules -# cleaning node_modules is the longest one, so we avoid that if possible -.PHONY: clean-lite -clean-lite: - rm -rf $(CLEANFILES) -.PHONY: clean-server -clean-server: - rm -f server/app/web/templates/index.html - rm -rf server/app/web/static # CREATING DISTRIBUTION RELEASE @@ -61,6 +63,7 @@ pydist: build cd $(BUILDDIR); python setup.py sdist -d ../dist @echo "done" + # RELEASE HELPERS # create new version to commit to master @@ -91,6 +94,7 @@ release-directly-to-prod: dev-env pydist twine-prod .PHONY: dev-env dev-env: + cd client && make install pip install -r server/requirements-dev.txt .PHONY: gui-env @@ -113,7 +117,7 @@ twine-prod: # quicker than re-building client .PHONY: gen-package-lock gen-package-lock: - npm install --prefix client/ client + cd client && $(MAKE) install # INSTALL diff --git a/client/Makefile b/client/Makefile new file mode 100644 index 00000000..25171e7d --- /dev/null +++ b/client/Makefile @@ -0,0 +1,12 @@ +.PHONY: install +install: + npm install client + +.PHONY: build +build: install + npm run build + +.PHONY: clean +clean: + rm -rf node_modules + diff --git a/server/Makefile b/server/Makefile new file mode 100644 index 00000000..fef80f96 --- /dev/null +++ b/server/Makefile @@ -0,0 +1,4 @@ +.PHONY: clean +clean: + rm -f app/web/templates/index.html + rm -rf app/web/static