Skip to content

Commit 89ba6cf

Browse files
authored
Add a target to check Gradle daemon status (#576)
1 parent a5fc2c6 commit 89ba6cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ smithy-build:
3030
smithy-clean:
3131
cd codegen && ./gradlew clean
3232

33+
GRADLE_RETRIES := 3
34+
GRADLE_SLEEP := 2
35+
36+
# We're making a call to ./gradlew to trigger downloading Gradle and
37+
# starting the daemon. Any call works, so using `./gradlew help`
38+
ensure-gradle-up:
39+
@cd codegen && for i in $(shell seq 1 $(GRADLE_RETRIES)); do \
40+
echo "Checking if Gradle daemon is up, attempt $$i..."; \
41+
if ./gradlew help; then \
42+
echo "Gradle daemon is up!"; \
43+
exit 0; \
44+
fi; \
45+
echo "Failed to start Gradle, retrying in $(GRADLE_SLEEP) seconds..."; \
46+
sleep $(GRADLE_SLEEP); \
47+
done; \
48+
echo "Failed to start Gradle after $(GRADLE_RETRIES) attempts."; \
49+
exit 1
50+
3351
##################
3452
# Linting/Verify #
3553
##################

0 commit comments

Comments
 (0)