Skip to content

Commit

Permalink
Android.mk: Download prebuilt apk instead of building it
Browse files Browse the repository at this point in the history
* With the upcoming changes, and the increasing number of external
  libraries being used, plus the usage of Kotlin, it's getting harder
  and harder to build this with the AOSP build system.
* It's best to leverage the existing gradle build system instead,
  and use the apk that builds.
* Add a script which downloads the apk matching the tag if a tag is
  checked out, otherwise downloads the latest.
  • Loading branch information
chirayudesai committed Jul 31, 2019
1 parent d41ad38 commit 6136f58
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ gradle-app.setting
.DS_Store

## Android
gen/
gen/

## Prebuilt
Backup.apk
23 changes: 9 additions & 14 deletions app/src/main/Android.mk → Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@ LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
commons-io:../../libs/commons-io-2.6.jar
include $(BUILD_MULTI_PREBUILT)

include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := Backup
LOCAL_MODULE_TAGS := optional
LOCAL_REQUIRED_MODULES := permissions_com.stevesoltys.backup.xml whitelist_com.stevesoltys.backup.xml
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PRIVATE_PLATFORM_APIS := true
backup_root := $(LOCAL_PATH)

$(backup_root)/Backup.apk:
cd $(backup_root) && ./download.sh

LOCAL_MODULE := Backup
LOCAL_SRC_FILES := Backup.apk
LOCAL_CERTIFICATE := platform
LOCAL_STATIC_JAVA_LIBRARIES := commons-io
LOCAL_SRC_FILES := $(call all-java-files-under, java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
include $(BUILD_PACKAGE)
LOCAL_MODULE_CLASS := APPS
include $(BUILD_PREBUILT)
14 changes: 14 additions & 0 deletions download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# Script to download apk from github releases

BASE_URL="https://github.com/stevesoltys/backup/releases"
APK="app-release-unsigned.apk"
VERSION="latest/download"
TAG=$(git tag -l --points-at HEAD)

if [ ! -z ${TAG} ]; then
VERSION="download/${TAG}"
fi

curl -L ${BASE_URL}/${VERSION}/${APK} > Backup.apk
File renamed without changes.
File renamed without changes.

0 comments on commit 6136f58

Please sign in to comment.