forked from serpro69/kotlin-faker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
183 lines (155 loc) · 5.43 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
SHELL := env ORCHID_DIAGNOSE=$(ORCHID_DIAGNOSE) $(SHELL)
ORCHID_DIAGNOSE ?= false
.DEFAULT_GOAL := help
# https://stackoverflow.com/a/10858332
# Check that given variables are set and all have non-empty values,
# die with an error otherwise.
#
# Params:
# 1. Variable name(s) to test.
# 2. (optional) Error message to print.
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))
__java_version_ok := $(shell java -version 2>&1|grep 1.8.0 >/dev/null; printf $$?)
.PHONY: check_java
check_java: ## check current java version (mostly used in other targets)
ifneq ($(__java_version_ok),$(shell echo 0))
$(error "Expected java 1.8")
endif
.PHONY: deploy-docs
deploy-docs: ## deploys documentation with orchid
sed -i 's/^\s\sbaseUrl:\shttp:\/\/localhost:8080/ baseUrl: https:\/\/serpro69.github.io\/kotlin-faker/' ./docs/src/orchid/resources/config.yml
sed -i 's/^\s\shomePageOnly:.*/#/' ./docs/src/orchid/resources/config.yml
./gradlew :docs:orchidDeploy -PorchidEnvironment=prod -PorchidDiagnose=$(ORCHID_DIAGNOSE)
git checkout ./docs/src/orchid/resources/config.yml
.PHONY: snapshot-in-pre-release
_snapshot-in-pre-release: ## (DEPRECATED) publishes next snapshot in current pre-release version
./gradlew clean test integrationTest \
printVersion \
nativeImage \
publishToSonatype \
-PpromoteToRelease \
--info
.PHONY: snapshot-major
_snapshot-major: ## (DEPRECATED) publishes next snapshot with a major version bump
./gradlew clean test integrationTest \
printVersion \
nativeImage \
publishToSonatype \
-PbumpComponent=major \
--info
.PHONY: snapshot-minor
snapshot-minor: check_java ## publishes next snapshot with a minor version bump
@:$(call check_defined, VERSION, semantic version string - 'X.Y.Z(-rc.\d+)?')
./gradlew clean test integrationTest -Pversion='$(VERSION)-SNAPSHOT'
./gradlew nativeImage -Pversion='$(VERSION)-SNAPSHOT' --info
./gradlew publishToSonatype -Pversion='$(VERSION)-SNAPSHOT' --info
.PHONY: snapshot-patch
_snapshot-patch: ## (DEPRECATED) publishes next snapshot with a patch version bump
./gradlew clean test integrationTest \
printVersion \
nativeImage \
publishToSonatype \
-PbumpComponent=patch \
--info
.PHONY: pre-release-major
_pre-release-major: ## (DEPRECATED) publishes next pre-release version with a major version bump
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PnewPreRelease -PbumpComponent=major \
--info
git push origin --tags
.PHONY: pre-release-minor
_pre-release-minor: ## (DEPRECATED) publishes next pre-release with a minor version bump
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PnewPreRelease -PbumpComponent=minor \
--info
git push origin --tags
.PHONY: pre-release-patch
_pre-release-patch: ## (DEPRECATED) publishes next pre-release with a patch version bump
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PnewPreRelease -PbumpComponent=patch \
--info
git push origin --tags
.PHONY: next-pre-release
_next-pre-release: ## (DEPRECATED) publishes next pre-release version
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PpreRelease \
--info
git push origin --tags
.PHONY: promote-to-release
_promote-to-release: ## (DEPRECATED) publishes next release from the current pre-release version
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PpromoteToRelease \
--info
git push origin --tags
.PHONY: release-major
_release-major: ## (DEPRECATED) publishes next major release version
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PbumpComponent=major \
--info
git push origin --tags
.PHONY: release-minor
_release-minor: ## (DEPRECATED) publishes next minor release version
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PbumpComponent=minor \
--info
git push origin --tags
.PHONY: release-patch
_release-patch: ## (DEPRECATED) publishes next patch release version
./gradlew clean test integrationTest \
tag \
nativeImage \
publishToSonatype \
closeSonatypeStagingRepository \
-Prelease -PbumpComponent=patch \
--info
git push origin --tags
.PHONY: release
release: check_java ## publishes the next release with a specified VERSION
@:$(call check_defined, VERSION, semantic version string - 'X.Y.Z(-rc.\d+)?')
# run tests
./gradlew clean test integrationTest -Pversion=$(VERSION)
# build and test native image
./gradlew nativeImage -Pversion=$(VERSION) --info
./cli-bot/build/graal/faker-bot_$(VERSION) list --verbose >/dev/null || false
./cli-bot/build/graal/faker-bot_$(VERSION) lookup a --verbose >/dev/null || false
# publish to sonatype and close staging repo
./gradlew publishToSonatype closeSonatypeStagingRepository -Pversion=$(VERSION) --info
# create and push git tag
git tag v$(VERSION)
git push origin --tags
.PHONY: help
help: ## Displays this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'