-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (57 loc) · 2.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# define standard colors
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
PURPLE := $(shell tput -Txterm setaf 5)
BLUE := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
else
BLACK := ""
RED := ""
GREEN := ""
YELLOW := ""
LIGHTPURPLE := ""
PURPLE := ""
BLUE := ""
WHITE := ""
RESET := ""
endif
.PHONY: help
help: ## describe all commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
generate: ## generate protobuf code
@printf "${BLUE}generating protobuf artefacts ... ${RESET}"
@buf generate
@printf "${BLUE}done${RESET}"
.PHONY: lint
lint: ## lint protobuf code
@printf "${BLUE}linting protobuf code ... ${RESET}"
@buf lint
@printf "${BLUE}done${RESET}"
.PHONY: format
format: ## format protobuf code
@printf "${BLUE}formatting protobuf code ... ${RESET} "
@buf format -w
@printf "${BLUE}done${RESET}"
.PHONY: check-for-breaking-changes
check-for-breaking-changes: ## check for breaking changes against the main branch
@buf breaking --against '.git#branch=main'
.PHONY: java-publish-local
java-publish-local: ## publish java protobuf package to the local maven repository as a snapshot package e.g make java-publish-local version=0.7.0-SNAPSHOT
@printf "${YELLOW}removing previous java build artefacts ... ${RESET}"
@rm -rf lib/java/build lib/java/src
@printf "${YELLOW}done${RESET}\n"
@printf "${BLUE}generating protobuf artefacts ... ${RESET}"
@buf generate
@printf "${BLUE}done${RESET}\n"
@printf "${GREEN}publishing to maven local ... ${GREEN}"
ifdef version
@cd lib/java;./gradlew clean; ./gradlew publishToMavenLocal -Pversion=$(version); cd ../..
else
@cd lib/java;./gradlew clean;./gradlew publishToMavenLocal; cd ../..
endif
@printf "${GREEN}done${RESET}\n"