elvish/Makefile

48 lines
1.4 KiB
Makefile
Raw Normal View History

default: test get
2015-02-27 09:29:40 +08:00
get:
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) \
-X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" .
2013-09-18 16:58:51 +08:00
# Used by elves/up
buildall:
./tools/buildall.sh
generate:
go generate ./...
# Run unit tests -- with race detection if the platform supports it.
2016-10-26 17:36:26 +08:00
test:
if echo `go env GOOS GOARCH` | egrep -qx '(linux|freebsd|darwin|windows) amd64'; then \
go test -race ./... ; \
else \
go test ./... ; \
fi
# Generate a basic test coverage report. This will open the report in your
# browser. See also https://codecov.io/gh/elves/elvish/.
cover:
2020-08-17 00:04:02 +08:00
go test -covermode=set -coverprofile=$@ ./...
go tool cover -html=$@
# Ensure the style of Go and Markdown source files is consistent.
style:
find . -name '*.go' | xargs goimports -w
find . -name '*.md' | xargs prettier --tab-width 4 --prose-wrap always --write
checkstyle: checkstyle-go checkstyle-md
checkstyle-go:
2020-06-25 06:00:23 +08:00
echo 'Go files that need formatting:'
! find . -name '*.go' | xargs goimports -l \
| sed 's/^/ /' | grep . && echo ' None!'
checkstyle-md:
2020-06-25 06:00:23 +08:00
echo 'Markdown files that need formatting:'
! find . -name '*.md' | xargs prettier --tab-width 4 --prose-wrap always -l \
| sed 's/^/ /' | grep . && echo ' None!'
.SILENT: checkstyle-go checkstyle-md
.PHONY: default get generate test style checkstyle checkstyle-go checkstyle-md cover