Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
132 lines (118 loc) · 3.62 KB
/
Copy pathjustfile
File metadata and controls
132 lines (118 loc) · 3.62 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
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
# assemble debug APK
build:
./gradlew assembleDebug
# signed release APK (needs release.keystore + .env)
build-release:
#!/usr/bin/env bash
if [ ! -f release.keystore ] || [ ! -f .env ]; then
echo "No signing config found. Run: just setup-signing" >&2
exit 1
fi
./gradlew assembleRelease
# build + install + launch on connected device
install: build
#!/usr/bin/env bash
set -euo pipefail
if ! command -v adb >/dev/null 2>&1; then
echo "adb not found – run inside nix develop" >&2
exit 1
fi
if ! adb get-state >/dev/null 2>&1; then
echo "No device connected. Check: adb devices" >&2
exit 1
fi
APK="app/build/outputs/apk/debug/app-debug.apk"
[ -f "$APK" ] || { echo "APK not found – run 'just build' first" >&2; exit 1; }
DEVICE=$(adb get-serialno)
echo "Installing $APK on $DEVICE..."
adb install -r -d "$APK"
echo "Launching com.skiletro.wheelwitch/.MainActivity..."
adb shell am start -n com.skiletro.wheelwitch.debug/com.skiletro.wheelwitch.MainActivity
run: install
#!/usr/bin/env bash
sleep 2
echo "Getting pid..."
PID=$(adb shell pidof -s com.skiletro.wheelwitch.debug) || exit
adb logcat --pid $PID -v color
# run unit tests
test:
./gradlew testDebugUnitTest
# spotless + ktfmt auto-format
format:
./gradlew spotlessApply
# Android lint
lint:
./gradlew lint
# clean build outputs
clean:
./gradlew clean
# build + test
check: build test
# generate a keystore and .env for signing release APKs
setup-signing:
#!/usr/bin/env bash
set -euo pipefail
echo "=== WheelWitch Release Signing Setup ==="
echo ""
echo "This generates a keystore for signing release APKs."
echo "You can use it both for local signing and for GitHub Actions CI."
echo ""
read -r -p "Keystore password: " -s STORE_PASS
echo ""
read -r -p "Key alias [wheelwitch]: " KEY_ALIAS
KEY_ALIAS=${KEY_ALIAS:-wheelwitch}
read -r -p "Output path [./release.keystore]: " OUTPUT
OUTPUT=${OUTPUT:-./release.keystore}
read -r -p "Your name (CN): " CN
read -r -p "Organizational unit (OU) [Development]: " OU
OU=${OU:-Development}
read -r -p "Organization (O) [WheelWitch]: " O
O=${O:-WheelWitch}
read -r -p "City/Locality (L): " L
read -r -p "State (ST): " ST
read -r -p "Country code (C) [US]: " C
C=${C:-US}
keytool -genkey -v \
-keystore "$OUTPUT" \
-storetype pkcs12 \
-alias "$KEY_ALIAS" \
-keyalg RSA \
-keysize 4096 \
-sigalg SHA512withRSA \
-validity 10000 \
-storepass "$STORE_PASS" \
-keypass "$STORE_PASS" \
-dname "CN=$CN, OU=$OU, O=$O, L=$L, ST=$ST, C=$C"
echo ""
echo "=== Keystore created at $OUTPUT ==="
echo ""
echo "Add these secrets to your GitHub repository (Settings > Secrets and variables > Actions):"
echo ""
echo "---"
echo "Secret name: KEYSTORE_BASE64"
echo "Value:"
if command -v base64 &>/dev/null; then
base64 -w0 "$OUTPUT"
echo ""
else
echo "(run: base64 -w0 $OUTPUT)"
fi
echo "---"
echo "Secret name: KEYSTORE_PASSWORD"
echo "Value: $STORE_PASS"
echo "---"
echo "Secret name: KEY_ALIAS"
echo "Value: $KEY_ALIAS"
echo "---"
echo "Secret name: KEY_PASSWORD"
echo "Value: $STORE_PASS"
echo "---"
printf '%s\n' \
"KEYSTORE_PATH=$OUTPUT" \
"KEYSTORE_PASSWORD=$STORE_PASS" \
"KEY_ALIAS=$KEY_ALIAS" \
"KEY_PASSWORD=$STORE_PASS" > .env
echo ""
echo ".env file created — nix develop loads it automatically."
echo ""
echo "For release builds, run: just build-release"