@@ -111,6 +111,8 @@ WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack pub
111
111
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
112
112
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST ) )
113
113
114
+ GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go
115
+
114
116
SVG_DEST_DIR := public/img/svg
115
117
116
118
AIR_TMP_DIR := .air
@@ -130,9 +132,12 @@ GO_DIRS := cmd tests models modules routers build services tools
130
132
131
133
GO_SOURCES := $(wildcard * .go)
132
134
GO_SOURCES += $(shell find $(GO_DIRS ) -type f -name "* .go" -not -path modules/options/bindata.go -not -path modules/public/bindata.go -not -path modules/templates/bindata.go)
135
+ GO_SOURCES += $(GENERATED_GO_DEST )
136
+ GO_SOURCES_NO_BINDATA := $(GO_SOURCES )
133
137
134
138
ifeq ($(filter $(TAGS_SPLIT ) ,bindata) ,bindata)
135
139
GO_SOURCES += $(BINDATA_DEST)
140
+ GENERATED_GO_DEST += $(BINDATA_DEST)
136
141
endif
137
142
138
143
# Force installation of playwright dependencies by setting this flag
@@ -259,7 +264,7 @@ clean:
259
264
fmt :
260
265
@MISSPELL_PACKAGE=$(MISSPELL_PACKAGE ) GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE ) $(GO ) run build/code-batch-process.go gitea-fmt -w ' {file-list}'
261
266
$(eval TEMPLATES := $(shell find templates -type f -name '* .tmpl') )
262
- @# strip whitespace after '{{' and before `}}` unless there is only whitespace before it
267
+ @# strip whitespace after '{{' and before `}}` unless there is only whitespace before it
263
268
@$(SED_INPLACE ) -e ' s/{{[ ]\{1,\}/{{/g' -e ' /^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' $(TEMPLATES )
264
269
265
270
.PHONY : vet
@@ -278,7 +283,9 @@ TAGS_PREREQ := $(TAGS_EVIDENCE)
278
283
endif
279
284
280
285
.PHONY : generate-swagger
281
- generate-swagger :
286
+ generate-swagger : $(SWAGGER_SPEC )
287
+
288
+ $(SWAGGER_SPEC ) : $(GO_SOURCES_NO_BINDATA )
282
289
$(GO ) run $(SWAGGER_PACKAGE ) generate spec -x " $( SWAGGER_EXCLUDE) " -o ' ./$(SWAGGER_SPEC)'
283
290
$(SED_INPLACE ) ' $(SWAGGER_SPEC_S_TMPL)' ' ./$(SWAGGER_SPEC)'
284
291
$(SED_INPLACE ) $(SWAGGER_NEWLINE_COMMAND ) ' ./$(SWAGGER_SPEC)'
@@ -398,7 +405,6 @@ unit-test-coverage:
398
405
tidy :
399
406
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2) )
400
407
$(GO ) mod tidy -compat=$(MIN_GO_VERSION )
401
- @$(MAKE ) --no-print-directory assets/go-licenses.json
402
408
403
409
.PHONY : vendor
404
410
vendor : tidy
@@ -702,16 +708,25 @@ install: $(wildcard *.go)
702
708
build : frontend backend
703
709
704
710
.PHONY : frontend
705
- frontend : $(WEBPACK_DEST )
711
+ frontend : generate-frontend $(WEBPACK_DEST )
706
712
707
713
.PHONY : backend
708
- backend : go-check generate $(EXECUTABLE )
714
+ backend : go-check generate-backend $(EXECUTABLE )
709
715
716
+ # We generate the backend before the frontend in case we in future we want to generate things in the frontend from generated files in backend
710
717
.PHONY : generate
711
- generate : $(TAGS_PREREQ )
718
+ generate : generate-backend generate-frontend
719
+
720
+ .PHONY : generate-backend
721
+ generate-backend : $(TAGS_PREREQ ) generate-go
722
+
723
+ generate-go : $(TAGS_PREREQ )
712
724
@echo " Running go generate..."
713
725
@CC= GOOS= GOARCH= $(GO ) generate -tags ' $(TAGS)' $(GO_PACKAGES )
714
726
727
+ .PHONY : generate-frontend
728
+ generate-frontend : $(TAGS_PREREQ ) go-licenses
729
+
715
730
$(EXECUTABLE ) : $(GO_SOURCES ) $(TAGS_PREREQ )
716
731
CGO_CFLAGS=" $( CGO_CFLAGS) " $(GO ) build $(GOFLAGS ) $(EXTRA_GOFLAGS ) -tags ' $(TAGS)' -ldflags ' -s -w $(LDFLAGS)' -o $@
717
732
0 commit comments