mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 13:53:57 +01:00
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 <lauris@nix.lv>
This commit is contained in:
parent
4160bd6ef1
commit
e9afd74bbe
1 changed files with 9 additions and 9 deletions
18
Makefile
18
Makefile
|
@ -27,7 +27,6 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
|
||||
GOFMT ?= gofmt -s
|
||||
|
||||
GOFLAGS := -v
|
||||
|
@ -64,7 +63,9 @@ LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(G
|
|||
|
||||
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/)))
|
||||
|
||||
GO_SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||
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)
|
||||
GO_SOURCES_OWN := $(filter-out ./vendor/% %/bindata.go, $(GO_SOURCES))
|
||||
|
||||
WEBPACK_SOURCES ?= $(shell find web_src/js web_src/less -type f)
|
||||
WEBPACK_CONFIGS := webpack.config.js .eslintrc .stylelintrc
|
||||
|
||||
|
@ -74,15 +75,13 @@ BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
|
|||
|
||||
WEBPACK_DEST_DIRS := public/js public/css
|
||||
|
||||
FOMANTIC_SOURCES ?= $(shell find web_src/fomantic -type f)
|
||||
FOMANTIC_SOURCES ?= web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables
|
||||
FOMANTIC_DEST_DIR := public/fomantic
|
||||
FOMANTIC_EVIDENCE := $(MAKE_EVIDENCE_DIR)/fomantic
|
||||
|
||||
TAGS ?=
|
||||
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
|
||||
|
||||
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
|
||||
|
||||
#To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/swagger@v0.20.1
|
||||
SWAGGER := GO111MODULE=on $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger
|
||||
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
|
||||
|
@ -174,7 +173,7 @@ clean:
|
|||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
$(GOFMT) -w $(GOFILES)
|
||||
$(GOFMT) -w $(GO_SOURCES_OWN)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
|
@ -229,19 +228,19 @@ misspell-check:
|
|||
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
|
||||
fi
|
||||
misspell -error -i unknwon,destory $(GOFILES)
|
||||
misspell -error -i unknwon,destory $(GO_SOURCES_OWN)
|
||||
|
||||
.PHONY: misspell
|
||||
misspell:
|
||||
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
|
||||
fi
|
||||
misspell -w -i unknwon $(GOFILES)
|
||||
misspell -w -i unknwon $(GO_SOURCES_OWN)
|
||||
|
||||
.PHONY: fmt-check
|
||||
fmt-check:
|
||||
# get all go files and run go fmt on them
|
||||
@diff=$$($(GOFMT) -d $(GOFILES)); \
|
||||
@diff=$$($(GOFMT) -d $(GO_SOURCES_OWN)); \
|
||||
if [ -n "$$diff" ]; then \
|
||||
echo "Please run 'make fmt' and commit the result:"; \
|
||||
echo "$${diff}"; \
|
||||
|
@ -569,6 +568,7 @@ update-translations:
|
|||
|
||||
.PHONY: generate-images
|
||||
generate-images:
|
||||
$(eval TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp'))
|
||||
mkdir -p $(TMPDIR)/images
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 880 -h 880 -e $(PWD)/public/img/gitea-lg.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 512 -h 512 -e $(PWD)/public/img/gitea-512.png
|
||||
|
|
Loading…
Reference in a new issue