-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the bindata source as a target to the Makefile #12367
Add the bindata source as a target to the Makefile #12367
Conversation
`make backend` fails if parallelism is turned on with `make -jx`. This happens because when the executable starts to be built the sources for the bindata files are not available. If however, we add a target that makes the sources for the bindata - i.e. the generate target - then parallelism will work again. Signed-off-by: Andrew Thornton <art27@cantab.net>
How about doing it the other way around and making a proper dependency chain? I think it'd be more in line with our other targets like .PHONY: generate
generate: $(BINDATA_DEST)
$(BINDATA_DEST): $(TAGS_PREREQ) |
Because generate does not and should not only produce BINDATA |
It should not matter if we specify all generated files or not. For example |
… finished Signed-off-by: Andrew Thornton <art27@cantab.net>
What we do not want is a situation whereby generate will only run if you are using bindata. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
|
Signed-off-by: Andrew Thornton <art27@cantab.net>
Damn we have to use .NOTPARALLEL |
Can we not just put the generate command into |
Ah wait, no that can't work because of the release tasks which expect generate to have ran. |
@@ -526,9 +526,12 @@ frontend: node-check $(FOMANTIC_DEST) $(WEBPACK_DEST) | |||
backend: go-check generate $(EXECUTABLE) | |||
|
|||
.PHONY: generate | |||
.NOTPARALLEL: generate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I gather .NOTPARALLEL
does not take any arguments, just plain .NOTPARALLEL:
anywhere in the makefile should disable parallelism for the whole makefile.
Actually,
|
So
So I think the best solution is adding |
So I got some success with below changes but there's no diff --git a/Makefile b/Makefile
index 890332fde..baa54ec1e 100644
--- a/Makefile
+++ b/Makefile
@@ -89,14 +89,14 @@ LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(G
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list -mod=vendor ./... | grep -v /vendor/)))
FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables
-FOMANTIC_DEST := web_src/fomantic/build/semantic.js web_src/fomantic/build/semantic.css
+FOMANTIC_DEST := web_src/fomantic/build/semantic.js
FOMANTIC_DEST_DIR := web_src/fomantic/build
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f) $(FOMANTIC_DEST)
WEBPACK_CONFIGS := webpack.config.js
-WEBPACK_DEST := public/js/index.js public/css/index.css
+WEBPACK_DEST := public/js/index.js
WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack public/serviceworker.js
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
@@ -519,18 +519,18 @@ install: $(wildcard *.go)
.PHONY: build
build: frontend backend
.PHONY: frontend
-frontend: node-check $(FOMANTIC_DEST) $(WEBPACK_DEST)
+frontend: $(FOMANTIC_DEST) $(WEBPACK_DEST)
.PHONY: backend
-backend: go-check generate $(EXECUTABLE)
+backend: go-check $(EXECUTABLE)
.PHONY: generate
-generate: $(TAGS_PREREQ)
+generate: frontend $(TAGS_PREREQ)
CC= GOOS= GOARCH= $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)
-$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
+$(EXECUTABLE): generate $(GO_SOURCES) $(TAGS_PREREQ)
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
.PHONY: release
release: frontend generate release-windows release-linux release-darwin release-copy release-compress release-sources release-docs release-check |
Regarding node-check and go-check, maybe they can be made a simple if condition that checks supplied make arguments so it won't mess up dependency tracking: NODE_GOALS: frontend webpack fomantic
ifeq ($(filter $(NODE_GOALS),$(MAKECMDGOALS)),)
# do node check
endif |
I'm questioning if it's really worth it to introduce the frontend dependency in the backend chain. For example the dev setup recommends frontend/backend ran in two tabs. Now if we have the dependency frontend will build in the backend tab if its unclean and then again in the frontend tab. I think we're better off with a recommendation to not enable make parallism in |
Alternative to go-gitea#12367
make backend
fails if parallelism is turned on withmake -jx
.This happens because when the executable starts to be built the sources
for the bindata files are not available.
If however, we add a target that makes the sources for the bindata -
i.e. the generate target - then parallelism will work again.
References: #11756
Signed-off-by: Andrew Thornton art27@cantab.net