Skip to content

Commit 272bb2a

Browse files
author
sapcc-bot
committed
Run go-makefile-maker
1 parent 1c86ea8 commit 272bb2a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ install-go-licence-detector: FORCE
4242
install-addlicense: FORCE
4343
@if ! hash addlicense 2>/dev/null; then printf "\e[1;36m>> Installing addlicense (this may take a while)...\e[0m\n"; go install github.com/google/addlicense@latest; fi
4444

45-
prepare-static-check: FORCE install-golangci-lint install-modernize install-shellcheck install-go-licence-detector install-addlicense
45+
install-reuse: FORCE
46+
@if ! hash reuse 2>/dev/null; then if ! hash pip3 2>/dev/null; then printf "\e[1;31m>> Cannot install reuse because no pip3 was found. Either install it using your package manager or install pip3\e[0m\n"; else printf "\e[1;36m>> Installing reuse...\e[0m\n"; pip3 install --user reuse; fi; fi
47+
48+
prepare-static-check: FORCE install-golangci-lint install-modernize install-shellcheck install-go-licence-detector install-addlicense install-reuse
4649

4750
GO_BUILDFLAGS = -mod vendor
4851
GO_LDFLAGS =
@@ -111,7 +114,7 @@ check-addlicense: FORCE install-addlicense
111114
@printf "\e[1;36m>> addlicense --check\e[0m\n"
112115
@addlicense --check -- $(patsubst $(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...))
113116

114-
check-reuse: FORCE
117+
check-reuse: FORCE install-reuse
115118
@printf "\e[1;36m>> reuse lint\e[0m\n"
116119
@if ! reuse lint -q; then reuse lint; fi
117120

@@ -135,7 +138,7 @@ vendor-compat: FORCE
135138
go mod vendor
136139
go mod verify
137140

138-
license-headers: FORCE install-addlicense
141+
license-headers: FORCE install-addlicense install-reuse
139142
@printf "\e[1;36m>> addlicense (for license headers on source code files)\e[0m\n"
140143
@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: +'"'"' {}; '
141144
@printf "\e[1;36m>> reuse annotate (for license headers on other files)\e[0m\n"
@@ -191,6 +194,7 @@ help: FORCE
191194
@printf " \e[36minstall-shellcheck\e[0m Install shellcheck required by run-shellcheck/static-check\n"
192195
@printf " \e[36minstall-go-licence-detector\e[0m Install-go-licence-detector required by check-dependency-licenses/static-check\n"
193196
@printf " \e[36minstall-addlicense\e[0m Install addlicense required by check-license-headers/license-headers/static-check\n"
197+
@printf " \e[36minstall-reuse\e[0m Install reuse required by license-headers/check-reuse\n"
194198
@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"
195199
@printf "\n"
196200
@printf "\e[1mBuild\e[0m\n"

0 commit comments

Comments
 (0)