You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Makefile
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -43,15 +43,18 @@ install-modernize: FORCE
43
43
@if !hash modernize 2>/dev/null;thenprintf"\e[1;36m>> Installing modernize (this may take a while)...\e[0m\n"; go install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest;fi
@if !hash go-licence-detector 2>/dev/null;thenprintf"\e[1;36m>> Installing go-licence-detector (this may take a while)...\e[0m\n"; go install go.elastic.co/go-licence-detector@latest;fi
50
50
51
51
install-addlicense: FORCE
52
52
@if !hash addlicense 2>/dev/null;thenprintf"\e[1;36m>> Installing addlicense (this may take a while)...\e[0m\n"; go install github.com/google/addlicense@latest;fi
53
53
54
-
prepare-static-check: FORCE install-golangci-lint install-modernize install-shellcheck install-go-licence-detector install-addlicense
54
+
install-reuse: FORCE
55
+
@if !hash reuse 2>/dev/null;thenif!hash pip3 2>/dev/null;thenprintf"\e[1;31m>> Cannot install reuse because no pip3 was found. Either install it using your package manager or install pip3\e[0m\n";elseprintf"\e[1;36m>> Installing reuse...\e[0m\n"; pip3 install --user reuse;fi;fi
56
+
57
+
prepare-static-check: FORCE install-golangci-lint install-modernize install-shellcheck install-go-licence-detector install-addlicense install-reuse
55
58
56
59
GO_BUILDFLAGS =
57
60
GO_LDFLAGS =
@@ -140,7 +143,7 @@ check-addlicense: FORCE install-addlicense
140
143
@printf "\e[1;36m>> addlicense --check\e[0m\n"
141
144
@addlicense --check -- $(patsubst$(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...))
142
145
143
-
check-reuse: FORCE
146
+
check-reuse: FORCE install-reuse
144
147
@printf "\e[1;36m>> reuse lint\e[0m\n"
145
148
@if ! reuse lint -q;then reuse lint;fi
146
149
@@ -158,7 +161,7 @@ tidy-deps: FORCE
158
161
go mod tidy
159
162
go mod verify
160
163
161
-
license-headers: FORCE install-addlicense
164
+
license-headers: FORCE install-addlicense install-reuse
162
165
@printf "\e[1;36m>> addlicense (for license headers on source code files)\e[0m\n"
163
166
@printf "%s\0"$(patsubst$(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...))|$(XARGS) -0 -I{} bash -c 'year="$$(grep 'Copyright' {} | head -n1 | grep -E -o '"'"'[0-9]{4}(-[0-9]{4})?'"'"')"; if [[ -z "$$year" ]]; then year=$$(date +%Y); fi; gawk -i inplace '"'"'{if (display) {print} else {!/^\/\*/ && !/^\*/}}; {if (!display && $$0 ~ /^(package |$$)/) {display=1} else { }}'"'"' {}; addlicense -c "SAP SE or an SAP affiliate company" -s=only -y "$$year" -- {}; $(SED) -i '"'"'1s+// Copyright +// SPDX-FileCopyrightText: +'"'"' {}; '
164
167
@printf "\e[1;36m>> reuse annotate (for license headers on other files)\e[0m\n"
@@ -214,6 +217,7 @@ help: FORCE
214
217
@printf " \e[36minstall-shellcheck\e[0m Install shellcheck required by run-shellcheck/static-check\n"
215
218
@printf " \e[36minstall-go-licence-detector\e[0m Install-go-licence-detector required by check-dependency-licenses/static-check\n"
216
219
@printf " \e[36minstall-addlicense\e[0m Install addlicense required by check-license-headers/license-headers/static-check\n"
220
+
@printf " \e[36minstall-reuse\e[0m Install reuse required by license-headers/check-reuse\n"
217
221
@printf " \e[36mprepare-static-check\e[0m Install any tools required by static-check. This is used in CI before dropping privileges, you should probably install all the tools using your package manager\n"
0 commit comments