@@ -15,6 +15,10 @@ AABDIR = mobile/build/outputs/bundle
15
15
WEBUI_SRCDIR := aw-server-rust/aw-webui
16
16
WEBUI_DISTDIR := $(WEBUI_SRCDIR ) /dist
17
17
18
+ # NOTE: you have to download bundletool manually and set this path
19
+ # https://github.com/google/bundletool/releases
20
+ BUNDLETOOL := java -jar ~/Downloads/bundletool-all-1.15.5.jar
21
+
18
22
# Main targets
19
23
all : aw-server-rust metadata
20
24
build : all
@@ -26,6 +30,27 @@ build-bundle: dist/aw-android.aab
26
30
# builds a complete, signed apk, puts it in dist
27
31
build-apk : dist/aw-android.apk
28
32
33
+ # Attempts at working with bundletool to build device-specific APKs
34
+ # See: https://github.com/ActivityWatch/aw-android/issues/61
35
+ dist/aw-android.apks :
36
+ rm -rf dist/aw-android.apks
37
+ $(BUNDLETOOL ) \
38
+ build-apks --bundle=dist/aw-android.aab --output=dist/aw-android.apks
39
+
40
+ # Extracts device-specific APKs from the apks bundle
41
+ build-device-specific-apks :
42
+ # TODO: add arm(7), x86, x86_64
43
+ $(BUNDLETOOL ) \
44
+ extract-apks \
45
+ --apks=dist/aw-android.apks \
46
+ --output-dir=dist/splits/arm64 \
47
+ --device-spec=scripts/device-arm64.json
48
+
49
+ # Useful for inspecting the contents of the apks
50
+ unzip-apks : dist/aw-android.apks
51
+ rm -rf dist/apks
52
+ unzip -o dist/aw-android.apks -d dist/apks
53
+
29
54
# builds debug and test apks (unsigned)
30
55
build-apk-debug : $(APKDIR ) /debug/mobile-debug.apk $(APKDIR ) /androidTest/debug/mobile-debug-androidTest.apk
31
56
mkdir -p dist
0 commit comments