-
Notifications
You must be signed in to change notification settings - Fork 259
/
Copy pathjustfile
212 lines (174 loc) · 5.35 KB
/
justfile
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# This justfile requires https://github.com/casey/just
# Load environment variables from `.env` file.
set dotenv-load
# Fail the script if the env file is not found.
set dotenv-required
project_dir := justfile_directory()
build_dir := project_dir + "/target"
app_uber_jar := build_dir + "/app.jar"
# print available targets
[group("project-agnostic")]
default:
@just --list --justfile {{justfile()}}
# evaluate and print all just variables
[group("project-agnostic")]
evaluate:
@just --evaluate
# print system information such as OS and architecture
[group("project-agnostic")]
system-info:
@echo "architecture: {{arch()}}"
@echo "os: {{os()}}"
@echo "os family: {{os_family()}}"
# perform static code analysis
[group("development")]
analyze:
#!/usr/bin/env bash
echo "Running static code analysis with spotbugs"
just spotbugs
if command -v infer &>/dev/null; then
echo "Running static code analysis with infer"
just infer
fi
# benchmark the app's HTTP endpoint with plow (requires https://github.com/six-ddc/plow)
[group("benchmarking")]
benchmark-plow:
@echo plow -c 100 --duration=30s http://localhost:${APP_PORT}/welcome
@plow -c 100 --duration=30s http://localhost:${APP_PORT}/welcome
# benchmark the app's HTTP endpoint with wrk (requires https://github.com/wg/wrk)
[group("benchmarking")]
benchmark-wrk:
@echo wrk -t 10 -c 100 --latency --duration 30 http://localhost:${APP_PORT}/welcome
@wrk -t 10 -c 100 --latency --duration 30 http://localhost:${APP_PORT}/welcome
# alias for 'compile'
[group("development")]
build: compile
# clean (remove) the build artifacts
[group("development")]
clean:
@./mvnw clean
# compile the project
[group("development")]
compile:
@./mvnw compile
# create coverage report
[group("development")]
coverage: verify
@./mvnw jacoco:report && \
echo "Coverage report is available under {{build_dir}}/site/jacoco/"
# list dependency tree of this project
[group("development")]
dependencies:
@./mvnw dependency:tree
# create a docker image (requires Docker)
[group("docker")]
docker-image-create:
@echo "Creating a docker image ..."
@./tools/create_image.sh
# size of the docker image (requires Docker)
[group("docker")]
docker-image-size:
@docker images $DOCKER_IMAGE_NAME
# run the docker image (requires Docker)
[group("docker")]
docker-image-run:
@echo "Running container from docker image ..."
@./tools/start_container.sh
# generate Java documentation
[group("development")]
docs:
@./mvnw javadoc:javadoc
# format sources
[group("development")]
format:
@./mvnw spotless:apply
# check formatting of sources (without modifying)
[group("development")]
format-check:
@./mvnw spotless:check
# static code analysis with infer (requires https://github.com/facebook/infer)
[group("development")]
infer:
@infer run -- ./mvnw clean compile
# list active profiles
[group("maven")]
maven-active-profiles:
@./mvnw help:active-profiles
# list all profiles
[group("maven")]
maven-all-profiles:
@./mvnw help:all-profiles
# show maven lifecycles like 'clean', 'compile'
[group("maven")]
maven-lifecycles:
@echo "See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference"
# print effective pom.xml
[group("maven")]
maven-pom:
@./mvnw help:effective-pom
# show help of maven-help-plugin
[group("maven")]
maven-help:
@./mvnw help:help
# print platform details like system properties, env variables
[group("maven")]
maven-system:
@./mvnw help:system
# upgrade maven wrapper
[group("maven")]
mvnw-upgrade:
@./mvnw wrapper:wrapper
# list outdated dependencies
[group("development")]
outdated:
@./mvnw versions:display-dependency-updates
# list outdated maven plugins
[group("development")]
outdated-plugins:
@./mvnw versions:display-plugin-updates
# package the app to create an uber jar
[group("development")]
package:
@./mvnw verify package
# send request to the app's HTTP endpoint (requires running app)
[group("development")]
send-request-to-app:
@echo curl http://localhost:${APP_PORT}/welcome
@curl http://localhost:${APP_PORT}/welcome
# generate site incl. reports for spotbugs, dependencies, javadocs, licenses
[group("development")]
site: compile
@./mvnw site && \
echo "Reports are available under {{build_dir}}/site/" && \
echo "Javadocs are available under {{build_dir}}/site/apidocs/"
# static code analysis with spotbugs
[group("development")]
spotbugs: compile
@./mvnw spotbugs:check
# start the app
[group("development")]
start:
#!/usr/bin/env bash
declare -r JVM_ARGS="-XX:+UseZGC -XX:+ZGenerational"
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="$JVM_ARGS"
# start the app via its packaged jar (requires 'package' step)
[group("development")]
start-jar:
#!/usr/bin/env bash
APP_JAR="{{app_uber_jar}}"
if [ ! -f "$APP_JAR" ]; then
just package
else
echo "Using existing application uber jar at $APP_JAR."
echo "If you want to recompile the uber jar, run \`./mvnw package\` (or \`just package\`) manually."
fi
declare -r JVM_ARGS="-XX:+UseZGC -XX:+ZGenerational"
java $JVM_ARGS -jar "$APP_JAR"
# run unit tests
[group("development")]
test:
@./mvnw test
# run unit and integration tests, coverage check, static code analysis
[group("development")]
verify:
@./mvnw verify