Makefile: Be clear about exactly which files are generated, and how
This mostly aims to document how everything was generated, and the steps necessary to re-generate the same files verbatim; the goal is to figure out how to reproduce the files as they currently are. The exception is that we strip out the timestamp out of install.sh.
This commit is contained in:
parent
d7a38bbdf2
commit
2508856219
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@
|
||||
/.idea/
|
||||
/test/path
|
||||
/golangci-lint
|
||||
/tools/
|
||||
|
80
Makefile
80
Makefile
@ -1,5 +1,17 @@
|
||||
.DEFAULT_GOAL = test
|
||||
.PHONY: FORCE
|
||||
export GO111MODULE = on
|
||||
|
||||
# Build
|
||||
|
||||
build: golangci-lint
|
||||
clean:
|
||||
rm -f golangci-lint test/path
|
||||
rm -rf tools
|
||||
.PHONY: build clean
|
||||
|
||||
# Test
|
||||
|
||||
test: build
|
||||
GL_TEST_RUN=1 ./golangci-lint run -v
|
||||
GL_TEST_RUN=1 ./golangci-lint run --fast --no-config -v --skip-dirs 'test/testdata_etc,pkg/golinters/goanalysis/(checker|passes)'
|
||||
@ -8,35 +20,81 @@ test: build
|
||||
|
||||
build:
|
||||
go build -o golangci-lint ./cmd/golangci-lint
|
||||
.PHONY: test
|
||||
|
||||
test_race:
|
||||
go build -race -o golangci-lint ./cmd/golangci-lint
|
||||
GL_TEST_RUN=1 ./golangci-lint run -v --deadline=5m
|
||||
.PHONY: test_race
|
||||
|
||||
test_linters:
|
||||
GL_TEST_RUN=1 go test -v ./test -count 1 -run TestSourcesFromTestdataWithIssuesDir/$T
|
||||
.PHONY: test_linters
|
||||
|
||||
assets:
|
||||
svg-term --cast=183662 --out docs/demo.svg --window --width 110 --height 30 --from 2000 --to 20000 --profile Dracula --term iterm2
|
||||
# Maintenance
|
||||
|
||||
readme:
|
||||
go run ./scripts/gen_readme/main.go
|
||||
|
||||
gen:
|
||||
go generate ./...
|
||||
generate: docs/demo.svg README.md install.sh pkg/logutils/log_mock.go vendor
|
||||
maintainer-clean: clean
|
||||
rm -f docs/demo.svg README.md install.sh pkg/logutils/log_mock.go
|
||||
rm -rf vendor
|
||||
.PHONY: generate maintainer-clean
|
||||
|
||||
check_generated:
|
||||
$(MAKE) readme update_deps
|
||||
$(MAKE) --always-make generate
|
||||
git diff --exit-code # check no changes
|
||||
.PHONY: check_generated
|
||||
|
||||
release:
|
||||
rm -rf dist
|
||||
curl -sL https://git.io/goreleaser | bash
|
||||
.PHONY: release
|
||||
|
||||
update_deps:
|
||||
# Non-PHONY targets (real files)
|
||||
|
||||
golangci-lint: FORCE pkg/logutils/log_mock.go
|
||||
go build -o $@ ./cmd/golangci-lint
|
||||
|
||||
tools/mockgen: go.mod go.sum
|
||||
GOBIN=$(CURDIR)/tools go install github.com/golang/mock/mockgen
|
||||
|
||||
tools/goimports: go.mod go.sum
|
||||
GOBIN=$(CURDIR)/tools go install golang.org/x/tools/cmd/goimports
|
||||
|
||||
tools/go.mod:
|
||||
@mkdir -p tools
|
||||
@rm -f $@
|
||||
cd tools && go mod init local-tools
|
||||
|
||||
tools/godownloader: Makefile tools/go.mod
|
||||
cd tools && GOBIN=$(CURDIR)/tools go get github.com/goreleaser/godownloader@3b90d248ba30307915288f08ab3f2fc2d9f6710c
|
||||
|
||||
tools/svg-term:
|
||||
@mkdir -p tools
|
||||
cd tools && npm install svg-term-cli
|
||||
ln -sf node_modules/.bin/svg-term $@
|
||||
|
||||
tools/Dracula.itermcolors:
|
||||
@mkdir -p tools
|
||||
curl -fL -o $@ https://raw.githubusercontent.com/dracula/iterm/master/Dracula.itermcolors
|
||||
|
||||
docs/demo.svg: tools/svg-term tools/Dracula.itermcolors
|
||||
PATH=$(CURDIR)/tools:$${PATH} svg-term --cast=183662 --out docs/demo.svg --window --width 110 --height 30 --from 2000 --to 20000 --profile ./tools/Dracula.itermcolors --term iterm2
|
||||
|
||||
install.sh: tools/godownloader .goreleaser.yml
|
||||
PATH=$(CURDIR)/tools:$${PATH} tools/godownloader .goreleaser.yml | sed '/DO NOT EDIT/s/ on [0-9TZ:-]*//' > $@
|
||||
|
||||
README.md: FORCE golangci-lint
|
||||
go run ./scripts/gen_readme/main.go
|
||||
|
||||
pkg/logutils/log_mock.go: tools/mockgen tools/goimports pkg/logutils/log.go
|
||||
@rm -f $@
|
||||
PATH=$(CURDIR)/tools:$${PATH} go generate ./...
|
||||
|
||||
go.mod: FORCE
|
||||
go mod verify
|
||||
go mod tidy
|
||||
go.sum: go.mod
|
||||
|
||||
vendor: go.mod go.sum
|
||||
rm -rf vendor
|
||||
go mod vendor
|
||||
|
||||
.PHONY: test
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
# Code generated by godownloader on 2018-06-05T12:04:55Z. DO NOT EDIT.
|
||||
# Code generated by godownloader. DO NOT EDIT.
|
||||
#
|
||||
|
||||
usage() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package logutils
|
||||
|
||||
//go:generate mockgen -package logutils -source log.go -destination log_mock.go
|
||||
//go:generate goimports -w log_mock.go
|
||||
|
||||
type Log interface {
|
||||
Fatalf(format string, args ...interface{})
|
||||
|
Loading…
x
Reference in New Issue
Block a user