modified Makefile to include src-d/ci/Makefile.main
This commit is contained in:
parent
29f7bc77b7
commit
1d1e090149
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.linguist
|
||||
benchmarks/output
|
||||
.ci
|
||||
Makefile.main
|
||||
|
49
Makefile
49
Makefile
@ -1,32 +1,36 @@
|
||||
COVERAGE_REPORT := coverage.txt
|
||||
COVERAGE_PROFILE := profile.out
|
||||
COVERAGE_MODE := atomic
|
||||
# Package configuration
|
||||
PROJECT = enry
|
||||
COMMANDS = cli/enry
|
||||
|
||||
# Including ci Makefile
|
||||
MAKEFILE = Makefile.main
|
||||
CI_REPOSITORY = https://github.com/src-d/ci.git
|
||||
CI_FOLDER = .ci
|
||||
|
||||
# If you need to build more than one dockerfile, you can do so like this:
|
||||
# DOCKERFILES = Dockerfile_filename1:repositoryname1 Dockerfile_filename2:repositoryname2 ...
|
||||
|
||||
$(MAKEFILE):
|
||||
@git clone --quiet $(CI_REPOSITORY) $(CI_FOLDER); \
|
||||
cp $(CI_FOLDER)/$(MAKEFILE) .;
|
||||
|
||||
-include $(MAKEFILE)
|
||||
|
||||
LINGUIST_PATH = .linguist
|
||||
|
||||
# build CLI
|
||||
VERSION := $(shell git describe --tags --abbrev=0)
|
||||
COMMIT := $(shell git rev-parse --short HEAD)
|
||||
LDFLAGS = -s -X main.Version=$(VERSION) -X main.GitHash=$(COMMIT)
|
||||
LOCAL_TAG := $(shell git describe --tags --abbrev=0)
|
||||
LOCAL_COMMIT := $(shell git rev-parse --short HEAD)
|
||||
LOCAL_BUILD := $(shell date +"%m-%d-%Y_%H_%M_%S")
|
||||
LOCAL_LDFLAGS = -s -X main.version=$(LOCAL_TAG) -X main.build=$(LOCAL_BUILD) -X main.commit=$(LOCAL_COMMIT)
|
||||
|
||||
$(LINGUIST_PATH):
|
||||
git clone https://github.com/github/linguist.git $@
|
||||
|
||||
test: $(LINGUIST_PATH)
|
||||
go test -v ./...
|
||||
clean-linguist:
|
||||
rm -rf $(LINGUIST_PATH)
|
||||
|
||||
test-coverage: $(LINGUIST_PATH)
|
||||
@echo "mode: $(COVERAGE_MODE)" > $(COVERAGE_REPORT); \
|
||||
for dir in `find . -name "*.go" | grep -o '.*/' | sort -u | grep -v './fixtures/' | grep -v './.linguist/'`; do \
|
||||
go test $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
|
||||
if [ $$? != 0 ]; then \
|
||||
exit 2; \
|
||||
fi; \
|
||||
if [ -f $(COVERAGE_PROFILE) ]; then \
|
||||
tail -n +2 $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
|
||||
rm $(COVERAGE_PROFILE); \
|
||||
fi; \
|
||||
done;
|
||||
clean: clean-linguist
|
||||
|
||||
code-generate: $(LINGUIST_PATH)
|
||||
mkdir -p data
|
||||
@ -42,8 +46,5 @@ benchmarks-slow: $(LINGUST_PATH)
|
||||
mkdir -p benchmarks/output && go test -run=NONE -bench=. -slow -benchtime=100ms -timeout=100h >benchmarks/output/enry_samples.bench && \
|
||||
benchmarks/linguist-samples.rb 5 >benchmarks/output/linguist_samples.bench
|
||||
|
||||
clean:
|
||||
rm -rf $(LINGUIST_PATH)
|
||||
|
||||
build-cli:
|
||||
go build -o enry -ldflags "$(LDFLAGS)" cli/enry/main.go
|
||||
go build -o enry -ldflags "$(LOCAL_LDFLAGS)" cli/enry/main.go
|
||||
|
@ -14,8 +14,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Version = "undefined"
|
||||
GitHash = "undefined"
|
||||
version = "undefined"
|
||||
build = "undefined"
|
||||
commit = "undefined"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -111,13 +112,13 @@ func main() {
|
||||
func usage() {
|
||||
fmt.Fprintf(
|
||||
os.Stderr,
|
||||
` %[1]s %[2]s commit: %[3]s
|
||||
enry, A simple (and faster) implementation of github/linguist
|
||||
` %[1]s %[2]s build: %[3]s commit: %[4]s
|
||||
%[1]s, A simple (and faster) implementation of github/linguist
|
||||
usage: %[1]s <path>
|
||||
%[1]s [-json] [-breakdown] <path>
|
||||
%[1]s [-json] [-breakdown]
|
||||
`,
|
||||
os.Args[0], Version, GitHash,
|
||||
os.Args[0], version, build, commit,
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user