Skip to content

Commit e9afd74

Browse files
silverwindlafriks
andauthored
Speed up make (#10560)
* Speed up make - stop `find` from venturing into node_modules and other directories that do not contain *.go files - only run `find` once for *.go files - move image tempdir generation to that task - rename GOFILES to GO_SOURCES_OWN for consistency and to indicate that vendor files are not included - pre-resolve FOMANTIC_SOURCES * exclude more Co-authored-by: Lauris BH <[email protected]>
1 parent 4160bd6 commit e9afd74

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ else
2727
endif
2828
endif
2929

30-
GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
3130
GOFMT ?= gofmt -s
3231

3332
GOFLAGS := -v
@@ -64,7 +63,9 @@ LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(G
6463

6564
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/)))
6665

67-
GO_SOURCES ?= $(shell find . -name "*.go" -type f)
66+
GO_SOURCES ?= $(shell find . -type d \( -path ./node_modules -o -path ./docs -o -path ./public -o -path ./options -o -path ./contrib -o -path ./data \) -prune -o -type f -name '*.go' -print)
67+
GO_SOURCES_OWN := $(filter-out ./vendor/% %/bindata.go, $(GO_SOURCES))
68+
6869
WEBPACK_SOURCES ?= $(shell find web_src/js web_src/less -type f)
6970
WEBPACK_CONFIGS := webpack.config.js .eslintrc .stylelintrc
7071

@@ -74,15 +75,13 @@ BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
7475

7576
WEBPACK_DEST_DIRS := public/js public/css
7677

77-
FOMANTIC_SOURCES ?= $(shell find web_src/fomantic -type f)
78+
FOMANTIC_SOURCES ?= web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables
7879
FOMANTIC_DEST_DIR := public/fomantic
7980
FOMANTIC_EVIDENCE := $(MAKE_EVIDENCE_DIR)/fomantic
8081

8182
TAGS ?=
8283
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
8384

84-
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
85-
8685
#To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/[email protected]
8786
SWAGGER := GO111MODULE=on $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger
8887
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
@@ -174,7 +173,7 @@ clean:
174173

175174
.PHONY: fmt
176175
fmt:
177-
$(GOFMT) -w $(GOFILES)
176+
$(GOFMT) -w $(GO_SOURCES_OWN)
178177

179178
.PHONY: vet
180179
vet:
@@ -229,19 +228,19 @@ misspell-check:
229228
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
230229
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
231230
fi
232-
misspell -error -i unknwon,destory $(GOFILES)
231+
misspell -error -i unknwon,destory $(GO_SOURCES_OWN)
233232

234233
.PHONY: misspell
235234
misspell:
236235
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
237236
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
238237
fi
239-
misspell -w -i unknwon $(GOFILES)
238+
misspell -w -i unknwon $(GO_SOURCES_OWN)
240239

241240
.PHONY: fmt-check
242241
fmt-check:
243242
# get all go files and run go fmt on them
244-
@diff=$$($(GOFMT) -d $(GOFILES)); \
243+
@diff=$$($(GOFMT) -d $(GO_SOURCES_OWN)); \
245244
if [ -n "$$diff" ]; then \
246245
echo "Please run 'make fmt' and commit the result:"; \
247246
echo "$${diff}"; \
@@ -569,6 +568,7 @@ update-translations:
569568

570569
.PHONY: generate-images
571570
generate-images:
571+
$(eval TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp'))
572572
mkdir -p $(TMPDIR)/images
573573
inkscape -f $(PWD)/assets/logo.svg -w 880 -h 880 -e $(PWD)/public/img/gitea-lg.png
574574
inkscape -f $(PWD)/assets/logo.svg -w 512 -h 512 -e $(PWD)/public/img/gitea-512.png

0 commit comments

Comments
 (0)