Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (77 loc) · 3.08 KB
/
Copy pathMakefile
File metadata and controls
98 lines (77 loc) · 3.08 KB
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
# Makefile, Stutter (native)
GRADLEW := ./gradlew
help: ## list targets
@echo "targets:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sed -n 's/^\(.*\): \(.*\)##\(.*\)/ \1|\3/p' \
| column -t -s '|'
doctor: ## print toolchain expectations
@echo "Requires:"
@echo " - JDK (version per Gradle config)"
@echo " - Android SDK with platform tools"
@echo " - ANDROID_SDK_ROOT or ANDROID_HOME set"
@echo ""
@if [ ! -x "$(GRADLEW)" ]; then \
echo "ERROR: gradlew not found or not executable."; \
echo "Run 'make bootstrap' to generate the Gradle wrapper."; \
exit 1; \
fi
@$(GRADLEW) -v
bootstrap: ## generate Gradle wrapper if missing (one time)
@if [ -x "$(GRADLEW)" ]; then \
echo "gradlew already present."; \
else \
echo "Generating Gradle wrapper..."; \
gradle wrapper; \
chmod +x gradlew; \
fi
setup: doctor ## download dependencies and prime Gradle caches
@$(GRADLEW) --no-daemon --refresh-dependencies tasks >/dev/null
deps: ## refresh dependencies
@$(GRADLEW) --no-daemon --refresh-dependencies
build: ## build debug APK
@$(GRADLEW) --no-daemon assembleDebug
release: ## build release APK
@$(GRADLEW) --no-daemon assembleRelease
bundle: ## build release AAB
@$(GRADLEW) --no-daemon bundleRelease
test: ## run unit tests
@$(GRADLEW) --no-daemon test
check: ## run all verification tasks
@$(GRADLEW) --no-daemon check
lint: ## run Android lint
@$(GRADLEW) --no-daemon lint
install: ## install debug build on device
@$(GRADLEW) --no-daemon installDebug
run: ## install and launch reader activity on device/emulator
@adb devices | awk 'NR>1 && $$2=="device" {found=1} END {if (!found) {print "ERROR: no connected devices/emulators. Start an AVD or plug in a device."; exit 1}}'
@$(GRADLEW) --no-daemon installDebug
@adb shell am start -n org.tomasino.stutter/.ReaderActivity
debug: ## install, launch, and stream logcat for the app
@adb devices | awk 'NR>1 && $$2=="device" {found=1} END {if (!found) {print "ERROR: no connected devices/emulators. Start an AVD or plug in a device."; exit 1}}'
@$(GRADLEW) --no-daemon installDebug
@adb shell am start -n org.tomasino.stutter/.ReaderActivity >/dev/null
@pid=$$(adb shell pidof org.tomasino.stutter | tr -d '\r'); \
if [ -z "$$pid" ]; then \
for i in 1 2 3 4 5; do \
sleep 0.5; \
pid=$$(adb shell pidof org.tomasino.stutter | tr -d '\r'); \
[ -n "$$pid" ] && break; \
done; \
fi; \
if [ -z "$$pid" ]; then \
echo "ERROR: app process not found. Launch the app and retry."; \
exit 1; \
fi; \
echo "Streaming logcat for pid $$pid (Ctrl+C to stop)"; \
adb logcat --pid $$pid
connected: ## run instrumentation tests
@./scripts/gradlew-java17.sh --no-daemon connectedAndroidTest
screenshots: ## capture screenshots on a connected device
@./scripts/screenshots.sh
clean: ## clean build outputs
@$(GRADLEW) --no-daemon clean
ci: clean setup check ## local CI pipeline
fdroid-sync: ## sync fdroiddata metadata/signatures from latest release tag
@./scripts/fdroid-sync.sh
.PHONY: help doctor bootstrap setup deps build release bundle test check lint install run debug connected screenshots clean ci fdroid-sync