Skip to content

Commit 94037ad

Browse files
authored
Hook go-licenses into tidy again (#21353)
Running it as part of the build is really unnecessary because we have a valid output file in the repo and assuming go dependencies do not change unless go.mod also changes, tidy really is the best target to run the license generation after. Also, regenerate the file as I missed to do so during the chroma update, and mark all json files in assets as generated.
1 parent 083ac16 commit 94037ad

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

.drone.yml

+3-13
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ steps:
100100
- name: checks-backend
101101
image: golang:1.19
102102
commands:
103-
- make checks-backend
103+
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
104104
depends_on: [deps-backend]
105105
volumes:
106106
- name: deps
@@ -112,16 +112,11 @@ steps:
112112
- make test-frontend
113113
depends_on: [lint-frontend]
114114

115-
- name: generate-frontend
116-
image: golang:1.19
117-
commands:
118-
- make generate-frontend
119-
120115
- name: build-frontend
121116
image: node:18
122117
commands:
123118
- make frontend
124-
depends_on: [deps-frontend, generate-frontend]
119+
depends_on: [deps-frontend]
125120

126121
- name: build-backend-no-gcc
127122
image: golang:1.18 # this step is kept as the lowest version of golang that we support
@@ -549,16 +544,11 @@ steps:
549544
commands:
550545
- make deps-frontend
551546

552-
- name: generate-frontend
553-
image: golang:1.18
554-
commands:
555-
- make generate-frontend
556-
557547
- name: build-frontend
558548
image: node:18
559549
commands:
560550
- make frontend
561-
depends_on: [deps-frontend, generate-frontend]
551+
depends_on: [deps-frontend]
562552

563553
- name: deps-backend
564554
image: golang:1.18

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
* text=auto eol=lf
22
*.tmpl linguist-language=Handlebars
3+
/assets/*.json linguist-generated
34
/public/vendor/** -text -eol linguist-vendored
45
/vendor/** -text -eol linguist-vendored
56
/web_src/fomantic/build/** linguist-generated

Makefile

+4-6
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,15 @@ unit-test-coverage:
406406
tidy:
407407
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
408408
$(GO) mod tidy -compat=$(MIN_GO_VERSION)
409+
@$(MAKE) --no-print-directory $(GO_LICENSE_FILE)
409410

410411
vendor: go.mod go.sum
411412
$(GO) mod vendor
412413
@touch vendor
413414

414415
.PHONY: tidy-check
415416
tidy-check: tidy
416-
@diff=$$(git diff go.mod go.sum); \
417+
@diff=$$(git diff go.mod go.sum $(GO_LICENSE_FILE)); \
417418
if [ -n "$$diff" ]; then \
418419
echo "Please run 'make tidy' and commit the result:"; \
419420
echo "$${diff}"; \
@@ -709,17 +710,14 @@ install: $(wildcard *.go)
709710
build: frontend backend
710711

711712
.PHONY: frontend
712-
frontend: generate-frontend $(WEBPACK_DEST)
713+
frontend: $(WEBPACK_DEST)
713714

714715
.PHONY: backend
715716
backend: go-check generate-backend $(EXECUTABLE)
716717

717718
# 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
718719
.PHONY: generate
719-
generate: generate-backend generate-frontend
720-
721-
.PHONY: generate-frontend
722-
generate-frontend: $(GO_LICENSE_FILE)
720+
generate: generate-backend
723721

724722
.PHONY: generate-backend
725723
generate-backend: $(TAGS_PREREQ) generate-go

0 commit comments

Comments
 (0)