2017-12-09 23:45:29 +08:00
|
|
|
default: test get
|
2014-01-31 21:08:56 +08:00
|
|
|
|
2015-02-27 09:29:40 +08:00
|
|
|
get:
|
2020-01-14 22:19:57 +08:00
|
|
|
go get -trimpath -ldflags \
|
2020-07-07 05:28:49 +08:00
|
|
|
"-X github.com/elves/elvish/pkg/buildinfo.Version=$$(git describe --tags --always --dirty=-dirty) \
|
2020-01-14 22:19:57 +08:00
|
|
|
-X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" .
|
2013-09-18 16:58:51 +08:00
|
|
|
|
2020-06-14 21:03:44 +08:00
|
|
|
# Used by elves/up
|
|
|
|
buildall:
|
|
|
|
./tools/buildall.sh
|
|
|
|
|
2016-10-13 16:18:22 +08:00
|
|
|
generate:
|
|
|
|
go generate ./...
|
|
|
|
|
2020-08-19 04:32:26 +08:00
|
|
|
# Run unit tests -- with race detection if the platform supports it. Go's
|
|
|
|
# Windows port supports race detection, but requires GCC, so we don't enable it
|
|
|
|
# there.
|
2016-10-26 17:36:26 +08:00
|
|
|
test:
|
2020-08-19 04:32:26 +08:00
|
|
|
if echo `go env GOOS GOARCH` | egrep -qx '(linux|freebsd|darwin) amd64'; then \
|
2020-07-31 11:06:11 +08:00
|
|
|
go test -race ./... ; \
|
|
|
|
else \
|
|
|
|
go test ./... ; \
|
|
|
|
fi
|
2014-01-25 21:15:54 +08:00
|
|
|
|
2020-08-15 12:06:45 +08:00
|
|
|
# Generate a basic test coverage report. This will open the report in your
|
|
|
|
# browser. See also https://codecov.io/gh/elves/elvish/.
|
|
|
|
cover:
|
2020-11-28 11:41:54 +08:00
|
|
|
go test -coverprofile=cover -coverpkg=./pkg/... ./pkg/...
|
|
|
|
go tool cover -html=cover
|
|
|
|
go tool cover -func=cover | tail -1 | awk '{ print "Overall coverage:", $$NF }'
|
2020-08-15 12:06:45 +08:00
|
|
|
|
|
|
|
# Ensure the style of Go and Markdown source files is consistent.
|
2020-04-03 08:30:21 +08:00
|
|
|
style:
|
|
|
|
find . -name '*.go' | xargs goimports -w
|
|
|
|
find . -name '*.md' | xargs prettier --tab-width 4 --prose-wrap always --write
|
|
|
|
|
2020-09-09 10:28:37 +08:00
|
|
|
# Check if the style of the Go and Markdown files is correct without modifying
|
|
|
|
# those files.
|
2020-06-25 06:07:46 +08:00
|
|
|
checkstyle: checkstyle-go checkstyle-md
|
|
|
|
|
|
|
|
checkstyle-go:
|
2020-09-09 10:28:37 +08:00
|
|
|
./tools/checkstyle-go.sh
|
2020-06-25 06:00:23 +08:00
|
|
|
|
2020-06-25 06:07:46 +08:00
|
|
|
checkstyle-md:
|
2020-09-09 10:28:37 +08:00
|
|
|
./tools/checkstyle-md.sh
|
2020-06-25 06:00:23 +08:00
|
|
|
|
2020-06-25 06:07:46 +08:00
|
|
|
.SILENT: checkstyle-go checkstyle-md
|
2020-08-15 12:06:45 +08:00
|
|
|
.PHONY: default get generate test style checkstyle checkstyle-go checkstyle-md cover
|