From 74e734422176d909540486c4cc1b0e89c4d1af63 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 16 Nov 2021 10:01:12 +0100 Subject: [PATCH] prevent multiple yarn builds of accounts and settings when running `make ci-node-generate` int the repo root --- .make/recursion.mk | 8 ++++++++ Makefile | 7 +++++-- accounts/Makefile | 2 ++ glauth/Makefile | 2 ++ graph-explorer/Makefile | 2 ++ graph/Makefile | 2 ++ idp/Makefile | 2 ++ idp/package.json | 3 ++- ocis-pkg/Makefile | 2 ++ ocis/Makefile | 11 ++++++----- ocs/Makefile | 2 ++ proxy/Makefile | 2 ++ settings/Makefile | 2 ++ storage/Makefile | 2 ++ store/Makefile | 2 ++ thumbnails/Makefile | 2 ++ web/Makefile | 2 ++ webdav/Makefile | 2 ++ 18 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 .make/recursion.mk diff --git a/.make/recursion.mk b/.make/recursion.mk new file mode 100644 index 00000000000..fcef863ebe4 --- /dev/null +++ b/.make/recursion.mk @@ -0,0 +1,8 @@ + +ifeq ($(MAKE_DEPTH),) +MAKE_DEPTH := 0 +else +$(eval MAKE_DEPTH := $(shell echo "$$(( $(MAKE_DEPTH) + 1 ))" ) ) +endif + +export diff --git a/Makefile b/Makefile index 491210e3ac2..16a93413182 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,8 @@ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` include .bingo/Variables.mk endif +include .make/recursion.mk + .PHONY: help help: @echo "Please use 'make ' where is one of the following:" @@ -130,9 +132,10 @@ ci-go-generate: .PHONY: ci-node-generate ci-node-generate: - @for mod in $(OCIS_MODULES); do \ + @if [ $(MAKE_DEPTH) -le 1 ]; then \ + for mod in $(OCIS_MODULES); do \ $(MAKE) --no-print-directory -C $$mod ci-node-generate; \ - done + done; fi; .PHONY: go-mod-tidy go-mod-tidy: diff --git a/accounts/Makefile b/accounts/Makefile index 6a7c2656d27..975ab4de28b 100644 --- a/accounts/Makefile +++ b/accounts/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := accounts +include ../.make/recursion.mk + .PHONY: test-acceptance-webui test-acceptance-webui: ./ui/tests/run-acceptance-test.sh $(FEATURE_PATH) diff --git a/glauth/Makefile b/glauth/Makefile index 7723d008e72..da706d7f1ed 100644 --- a/glauth/Makefile +++ b/glauth/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := glauth +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/graph-explorer/Makefile b/graph-explorer/Makefile index bc3d0589cab..ae3917574b1 100644 --- a/graph-explorer/Makefile +++ b/graph-explorer/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := graph-explorer +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/graph/Makefile b/graph/Makefile index dfc7d54a23e..23390312f8b 100644 --- a/graph/Makefile +++ b/graph/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := graph +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/idp/Makefile b/idp/Makefile index d93751cd0c6..d9d57a864be 100644 --- a/idp/Makefile +++ b/idp/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := idp +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/idp/package.json b/idp/package.json index ed5e5844f07..3f403f58f74 100644 --- a/idp/package.json +++ b/idp/package.json @@ -150,5 +150,6 @@ "webpack-manifest-plugin": "3.1.0", "workbox-webpack-plugin": "4.3.1", "yarn-deduplicate": "^3.1.0" - } + }, + "packageManager": "yarn@3.1.0" } diff --git a/ocis-pkg/Makefile b/ocis-pkg/Makefile index c32326e5d3b..74493817512 100644 --- a/ocis-pkg/Makefile +++ b/ocis-pkg/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := ocis-pkg +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/ocis/Makefile b/ocis/Makefile index 390ab0ab1c6..34b4837d3d8 100644 --- a/ocis/Makefile +++ b/ocis/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := ocis +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk @@ -31,8 +33,7 @@ ci-go-generate: # CI runs ci-node-generate automatically before this target @go generate ./... .PHONY: ci-node-generate -ci-node-generate: # no need to recreate go code, just add assets - @make -C ../accounts ci-node-generate - @make -C ../graph-explorer ci-node-generate - @make -C ../settings ci-node-generate - @make -C ../web ci-node-generate +ci-node-generate: # ocis needs assets of all other modules + @if [ $(MAKE_DEPTH) -le 1 ]; then \ + $(MAKE) --no-print-directory -C .. ci-node-generate \ + ; fi; diff --git a/ocs/Makefile b/ocs/Makefile index f64c8b62a2e..a605985649e 100644 --- a/ocs/Makefile +++ b/ocs/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := ocs +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/proxy/Makefile b/proxy/Makefile index 85e94f59e05..377ff3371ff 100644 --- a/proxy/Makefile +++ b/proxy/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := proxy +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/settings/Makefile b/settings/Makefile index 9bfaea6276b..349b780ac68 100644 --- a/settings/Makefile +++ b/settings/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := settings +include ../.make/recursion.mk + .PHONY: test-acceptance-webui test-acceptance-webui: ./ui/tests/run-acceptance-test.sh $(FEATURE_PATH) diff --git a/storage/Makefile b/storage/Makefile index bc2de8e8a8b..c4827d0541f 100644 --- a/storage/Makefile +++ b/storage/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := storage +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/store/Makefile b/store/Makefile index fad1bd63678..1f6bf0e54ec 100644 --- a/store/Makefile +++ b/store/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := store +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/thumbnails/Makefile b/thumbnails/Makefile index e88588a6b60..c07fabe3e0d 100644 --- a/thumbnails/Makefile +++ b/thumbnails/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := thumbnails +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/web/Makefile b/web/Makefile index 5b0114aa918..c5eb711e123 100644 --- a/web/Makefile +++ b/web/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := web +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk diff --git a/webdav/Makefile b/webdav/Makefile index ecbcb2a9783..503b5286c44 100644 --- a/webdav/Makefile +++ b/webdav/Makefile @@ -1,6 +1,8 @@ SHELL := bash NAME := webdav +include ../.make/recursion.mk + ############ tooling ############ ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI include ../.bingo/Variables.mk