Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
138 lines (111 loc) · 4.27 KB
/
Copy pathjustfile
File metadata and controls
138 lines (111 loc) · 4.27 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
133
134
135
136
137
138
default:
@just --list
install: install-java install-toolchains install-ndk install-ktlint
install-java:
@echo "==> Install Temurin JDK 17"
@brew install --cask temurin@17
@./gradlew --version
install-toolchains:
@echo Install toolchains for uniffi
@cd ../core && just gemstone install-android-targets
install-ndk:
@cd ../core && just gemstone install-ndk
install-ktlint:
@echo "==> Install ktlint"
@brew install ktlint
# Formats the Kotlin you changed; ktlint spends ~2s walking the whole tree.
format:
#!/usr/bin/env bash
set -euo pipefail
files=$( { git diff --name-only --diff-filter=ACMR HEAD -- '*.kt'; git ls-files --others --exclude-standard -- '*.kt'; } | sed 's|^android/||' | sort -u )
[ -z "$files" ] && exit 0
echo "==> Running ktlint"
echo "$files" | xargs ktlint --format --relative >/dev/null
format-all:
@echo "==> Running ktlint on every file"
@ktlint --format --relative "**/*.kt" "!**/build/**" >/dev/null
clean:
#!/usr/bin/env bash
set -euo pipefail
find . ../core/gemstone/android -type d \( -name build -o -name .gradle -o -name .kotlin -o -name .cxx -o -name .externalNativeBuild \) -prune -exec rm -rf {} +
echo "Android build folders cleaned"
build:
@./gradlew assembleGoogleDebug
run: build
@just _run-adb emulator
run-device: build
@just _run-adb device
_run-adb TARGET:
#!/usr/bin/env bash
set -euo pipefail
PACKAGE="com.gemwallet.android"
if [ "{{TARGET}}" = "emulator" ]; then
DEVICE=$(adb devices | awk '$2=="device" && $1 ~ /^emulator-/ {print $1; exit}')
[ -z "$DEVICE" ] && { echo "No emulator found (try 'just start-emulator')"; exit 1; }
else
DEVICE=$(adb devices | awk '$2=="device" && $1 !~ /^emulator-/ {print $1; exit}')
[ -z "$DEVICE" ] && { echo "No physical device found"; exit 1; }
fi
APK=$(find app/build/outputs/apk/google/debug -name '*.apk' | head -1)
echo "==> Installing on $DEVICE..."
adb -s "$DEVICE" install -r "$APK"
echo "==> Launching app..."
adb -s "$DEVICE" shell am start -W -n "$PACKAGE/$PACKAGE.MainActivity"
echo "==> Streaming logs (Ctrl+C to stop)..."
PID=""
for _ in {1..60}; do
PID=$(adb -s "$DEVICE" shell pidof -s "$PACKAGE" | tr -d '\r' || true)
[ -n "$PID" ] && break
sleep 0.5
done
if [ -z "$PID" ]; then
echo "App process not found after launch; showing recent app errors"
adb -s "$DEVICE" logcat -d -t 500 | grep -E "$PACKAGE|AndroidRuntime|FATAL EXCEPTION" || true
exit 1
fi
trap 'echo; echo "==> Log streaming stopped."; exit 0' INT TERM
set +e
adb -s "$DEVICE" logcat --pid="$PID"
STATUS=$?
set -e
case "$STATUS" in
0|130|143)
echo
echo "==> Log streaming stopped."
exit 0
;;
*)
exit "$STATUS"
;;
esac
build-test:
@./gradlew assembleGoogleDebugAndroidTest
test:
@./gradlew --continue testGoogleDebugUnitTest testDebugUnitTest -PintegrationTests=skip
test-integration:
@./gradlew --continue testGoogleDebugUnitTest testDebugUnitTest -PintegrationTests=only
test-all:
@./gradlew --continue assembleGoogleDebug testGoogleDebugUnitTest testDebugUnitTest
lint:
@./gradlew lint -x :gemstone:lintDebug
provision-emulator:
@bash ./scripts/android_emulator.sh provision
start-emulator:
@bash ./scripts/android_emulator.sh setup
stop-emulator:
@bash ./scripts/android_emulator.sh shutdown
release:
@BUILD_MODE=release ./gradlew clean :app:bundleGoogleRelease --no-configuration-cache
release-apk:
@BUILD_MODE=release ./gradlew clean assembleUniversalRelease -PuseLegacyPackaging=true --no-configuration-cache
localize:
@cd ../core && cargo run --package generate --bin generate localize android ../localization/app ../android/ui/src/main/res
generate: generate-models
generate-models:
@echo "==> Generate models for Android"
@cd ../core && cargo run --package generate --bin generate android ../android/gemcore/src/main/kotlin/com/wallet/core
generate-stone:
@echo "==> Generate Gemstone bindings and native libraries for Android"
@./gradlew :gemstone:bindgenKotlin :gemstone:buildCargoNdk --rerun-tasks
bump TARGET="patch":
@cd .. && just bump {{TARGET}}