-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
161 lines (112 loc) · 5.38 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
SHORT_NAME = gor
BRANCH = $$(git rev-parse --abbrev-ref HEAD)
COMMIT_HASH = $$(git rev-parse --short HEAD)
CURRENT_VERSION = $$(cat VERSION)
CURRENT_TAG_VERSION = "v${CURRENT_VERSION}"
help: ## This help.
@grep -E '^[a-zA-Z0-9_-]+:.*?#*.*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?#+"}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
#
# Common build targets - just the most common gradle targets.
#
clean: ## Clean the build env.
./gradlew clean
build: ## Create local installation.
./gradlew installDist
all-test: ## Run all tests.
./gradlew test slowTest integrationTest
compile-all-with-warnings: ## Compile code and tests.
./gradlew --rerun-tasks --console=plain --warning-mode all clean compileJava compileTestJava
build-doc: ## Build documentation
./gradlew :documentation:publishToMavenLocal -Pinclude.documentation -Pversion=$(CURRENT_VERSION)-SNAPSHOT
build-doc-os-aarch: ## Build documentation on osx using aarch
./gradlew :documentation:publishToMavenLocal -Pinclude.documentation -Psphinx.binaryUrl="https://github.com/trustin/sphinx-binary/releases/download/v0.8.1/sphinx.osx-x86_64" -Pversion=$(CURRENT_VERSION)-SNAPSHOT
#
# Local testinga
#
publish-local: ## Publish libraries locally (mavenLocal), then compile services with -PuseMavenLocal
./gradlew -Pversion=$(CURRENT_VERSION)-SNAPSHOT publishToMavenLocal -x documentation:publishToMavenLocal
publish-maven-central: ## Publish to maven central
./gradlew -Pversion=$(CURRENT_VERSION)-SNAPSHOT -PpublishToMavenCentral publish
docker-build: build ## Build all docker images
docker build .
#
# Git targets
#
update-master: ## Update master and its submodules
git checkout master
git pull
git submodule update --init --recursive
update-branch: ## Update the current branch
git pull
git submodule update --init --recursive
#
# Release from master.
#
release-milestone-from-master: ## Release from master based on milestone (MILESTONE must be passed in)
@buildSrc/src/main/scripts/release_milestone_from_master.sh 17033400 ${MILESTONE}
release-from-master: ## Release from master (VERSION must be passed in). DEPRECATED: Use release-milestone-from-master instead.
@if [ -z "${VERSION}" ]; then { echo "ERROR: VERSION should be set! Exiting..."; exit 1; }; fi
git checkout master
git pull
echo "${VERSION}" > VERSION
git add VERSION
# Commit and push to the branch
git commit -m "Updated version to ${VERSION}"
git push
git tag -a "v${VERSION}" -m "Releasing GOR v${VERSION}"
git push origin "v${VERSION}"
#
# Release from release branch.
#
update-master-version: update-master ## Update version on the master branch, assumes NEW_VERSION is passed in. DEPRECATED: Use release-milestone-from-master instead.
@if [ -z "${NEW_VERSION}" ]; then { echo "ERROR: NEW_VERSION should be set! Exiting..."; exit 1; }; fi
# Update version on master
git checkout -b "Update_master_version_to_${NEW_VERSION}"
# Update the version numbers
echo "${NEW_VERSION}" > VERSION
git add VERSION
# Commit and push to the branch
git commit -m "Updated version to ${NEW_VERSION} on master."
git push -u origin "Update_master_version_to_${NEW_VERSION}"
# Create a release branch with library locks and update version info.
create-release-branch: update-master ## Create a release branch, assumes BRANCH_VERSION is passed in. DEPRECATED: Use release-milestone-from-master instead.
@if [ -z "${BRANCH_VERSION}" ]; then { echo "ERROR: BRANCH_VERSION should be set! Exiting..."; exit 1; }; fi
# Create the release branch.
@echo "Creating new release branch release/v${BRANCH_VERSION}"
git checkout -b release/v${BRANCH_VERSION}
# Create the library locks
./gradlew allDeps --write-locks
find . -name '*.lockfile' | grep -v '/build/' | xargs git add
git commit -m "Creating release branch ${BRANCH_VERSION}, updating dependency locking"
# Update versions
echo "${BRANCH_VERSION}.0" > VERSION
git add VERSION
git commit -m "Updating version to ${BRANCH_VERSION}.0 on release/v${BRANCH_VERSION}."
# Push to the branch
git push -u origin release/v${BRANCH_VERSION}
# Must also Call update-master-version.
update-release-version: ## Update version on the development branch, assumes BRANCH_VERSION, NEW_VERSION is passed in. DEPRECATED: Use release-milestone-from-master instead.
@if [ -z "${BRANCH_VERSION}" ]; then { echo "ERROR: BRANCH_VERSION should be set! Exiting..."; exit 1; }; fi
@if [ -z "${NEW_VERSION}" ]; then { echo "ERROR: NEW_VERSION should be set! Exiting..."; exit 1; }; fi
# Check out the release branch
git checkout release/v${BRANCH_VERSION}
git pull
git submodule update --init --recursive
# Update the version numbers
echo "${NEW_VERSION}" > VERSION
git add VERSION
# Commit and push to the branch
git commit -m "Updated version to ${NEW_VERSION} on on release/v${BRANCH_VERSION}."
git push
release-from-release: ## Release from the given release branch. Assumes BRANCH_VERSION is passed in. DEPRECATED: Use release-milestone-from-master instead.
@if [ -z "${BRANCH_VERSION}" ]; then { echo "ERROR: BRANCH_VERSION should be set! Exiting..."; exit 1; }; fi
# Check out release the branch
git checkout release/v${BRANCH_VERSION}
git pull
# git tag -a ${CURRENT_TAG_VERSION} -m "Releasing gor-services ${CURRENT_TAG_VERSION}"
# git push origin $(CURRENT_TAG_VERSION)
#
# Misc
#
dependencies-check-for-updates: ## Check for available library updates (updates versions.properties)
./gradlew refreshVersions