aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorsilverwind2022-09-09 17:33:01 +0200
committerGitHub2022-09-09 11:33:01 -0400
commitb5d21c0adf38a4726b14157786be8ad11c1eda22 (patch)
tree23c09f5b4ca9c1f640ac8b1372f3bb7ec2120079 /Makefile
parent86ed47e622dabf5c27d60f00883fff46bd349d95 (diff)
Generate go-licenses during tidy again (#21108)
We can not have the `frontend` target depend on golang because of they way drone is set up. Move the `go-licenses` generation back into `tidy` where it will now also be checked for consistency during `tidy-check`. (I assume all `main` branch builds should currently fail [like this](https://drone.gitea.io/go-gitea/gitea/60244/1/11)). The reasony why it shouldn't be treated the same as for example `go generate` is because output files are checked in. tidy is imho the optimal target to run this after. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 9 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index a102072fc..3662e836a 100644
--- a/Makefile
+++ b/Makefile
@@ -210,7 +210,7 @@ help:
@echo " - golangci-lint run golangci-lint linter"
@echo " - go-licenses regenerate go licenses"
@echo " - vet examines Go source code and reports suspicious constructs"
- @echo " - tidy run go mod tidy and regenerate go licenses"
+ @echo " - tidy run go mod tidy"
@echo " - test[\#TestSpecificName] run unit test"
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
@echo " - pr#<index> build and start gitea from a PR with integration test data loaded"
@@ -406,9 +406,9 @@ tidy:
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
$(GO) mod tidy -compat=$(MIN_GO_VERSION)
-.PHONY: vendor
-vendor: tidy
+vendor: go.mod go.sum
$(GO) mod vendor
+ @touch vendor
.PHONY: tidy-check
tidy-check: tidy
@@ -420,9 +420,9 @@ tidy-check: tidy
fi
.PHONY: go-licenses
-go-licenses: assets/go-licenses.json
+go-licenses: $(GO_LICENSE_FILE)
-assets/go-licenses.json: go.mod go.sum
+$(GO_LICENSE_FILE): go.mod go.sum
-$(GO) run $(GO_LICENSES_PACKAGE) save . --force --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null
$(GO) run build/generate-go-licenses.go $(GO_LICENSE_TMP_DIR) $(GO_LICENSE_FILE)
@rm -rf $(GO_LICENSE_TMP_DIR)
@@ -717,16 +717,17 @@ backend: go-check generate-backend $(EXECUTABLE)
.PHONY: generate
generate: generate-backend generate-frontend
+.PHONY: generate-frontend
+generate-frontend: $(GO_LICENSE_FILE)
+
.PHONY: generate-backend
generate-backend: $(TAGS_PREREQ) generate-go
+.PHONY: generate-go
generate-go: $(TAGS_PREREQ)
@echo "Running go generate..."
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' $(GO_PACKAGES)
-.PHONY: generate-frontend
-generate-frontend: $(TAGS_PREREQ) go-licenses
-
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@