本站源代码
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

52 lines
1.1KB

  1. # General
  2. WORKDIR = $(PWD)
  3. # Go parameters
  4. GOCMD = go
  5. GOTEST = $(GOCMD) test -v
  6. # Git config
  7. GIT_VERSION ?=
  8. GIT_DIST_PATH ?= $(PWD)/.git-dist
  9. GIT_REPOSITORY = http://github.com/git/git.git
  10. # Coverage
  11. COVERAGE_REPORT = coverage.txt
  12. COVERAGE_PROFILE = profile.out
  13. COVERAGE_MODE = atomic
  14. ifneq ($(origin CI), undefined)
  15. WORKDIR := $(GOPATH)/src/gopkg.in/src-d/go-git.v4
  16. endif
  17. build-git:
  18. @if [ -f $(GIT_DIST_PATH)/git ]; then \
  19. echo "nothing to do, using cache $(GIT_DIST_PATH)"; \
  20. else \
  21. git clone $(GIT_REPOSITORY) -b $(GIT_VERSION) --depth 1 --single-branch $(GIT_DIST_PATH); \
  22. cd $(GIT_DIST_PATH); \
  23. make configure; \
  24. ./configure; \
  25. make all; \
  26. fi
  27. test:
  28. @cd $(WORKDIR); \
  29. $(GOTEST) ./...
  30. test-coverage:
  31. @cd $(WORKDIR); \
  32. echo "" > $(COVERAGE_REPORT); \
  33. for dir in `find . -name "*.go" | grep -o '.*/' | sort | uniq`; do \
  34. $(GOTEST) $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
  35. if [ $$? != 0 ]; then \
  36. exit 2; \
  37. fi; \
  38. if [ -f $(COVERAGE_PROFILE) ]; then \
  39. cat $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
  40. rm $(COVERAGE_PROFILE); \
  41. fi; \
  42. done; \
  43. clean:
  44. rm -rf $(GIT_DIST_PATH)
上海开阖软件有限公司 沪ICP备12045867号-1