Skip to content

Commit

Permalink
build: added some wip Makefile targets using bundletool
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 15, 2023
1 parent 536a7dd commit 2bbdaa7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ AABDIR = mobile/build/outputs/bundle
WEBUI_SRCDIR := aw-server-rust/aw-webui
WEBUI_DISTDIR := $(WEBUI_SRCDIR)/dist

# NOTE: you have to download bundletool manually and set this path
# https://github.com/google/bundletool/releases
BUNDLETOOL := java -jar ~/Downloads/bundletool-all-1.15.5.jar

# Main targets
all: aw-server-rust metadata
build: all
Expand All @@ -26,6 +30,27 @@ build-bundle: dist/aw-android.aab
# builds a complete, signed apk, puts it in dist
build-apk: dist/aw-android.apk

# Attempts at working with bundletool to build device-specific APKs
# See: https://github.com/ActivityWatch/aw-android/issues/61
dist/aw-android.apks:
rm -rf dist/aw-android.apks
$(BUNDLETOOL) \
build-apks --bundle=dist/aw-android.aab --output=dist/aw-android.apks

# Extracts device-specific APKs from the apks bundle
build-device-specific-apks:
# TODO: add arm(7), x86, x86_64
$(BUNDLETOOL) \
extract-apks \
--apks=dist/aw-android.apks \
--output-dir=dist/splits/arm64 \
--device-spec=scripts/device-arm64.json

# Useful for inspecting the contents of the apks
unzip-apks: dist/aw-android.apks
rm -rf dist/apks
unzip -o dist/aw-android.apks -d dist/apks

# builds debug and test apks (unsigned)
build-apk-debug: $(APKDIR)/debug/mobile-debug.apk $(APKDIR)/androidTest/debug/mobile-debug-androidTest.apk
mkdir -p dist
Expand Down
6 changes: 6 additions & 0 deletions scripts/device-arm64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"supportedAbis": ["arm64-v8a"],
"supportedLocales": ["en"],
"screenDensity": 640,
"sdkVersion": 27
}

0 comments on commit 2bbdaa7

Please sign in to comment.