From 6136f589c16cef3595a4f263b42cf1e398d05ba2 Mon Sep 17 00:00:00 2001 From: Chirayu Desai Date: Wed, 31 Jul 2019 22:03:50 +0530 Subject: [PATCH] Android.mk: Download prebuilt apk instead of building it * 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. --- .gitignore | 5 +++- app/src/main/Android.mk => Android.mk | 23 ++++++++----------- download.sh | 14 +++++++++++ ... => permissions_com.stevesoltys.backup.xml | 0 ...ml => whitelist_com.stevesoltys.backup.xml | 0 5 files changed, 27 insertions(+), 15 deletions(-) rename app/src/main/Android.mk => Android.mk (50%) create mode 100755 download.sh rename app/src/main/permissions_com.stevesoltys.backup.xml => permissions_com.stevesoltys.backup.xml (100%) rename app/src/main/whitelist_com.stevesoltys.backup.xml => whitelist_com.stevesoltys.backup.xml (100%) diff --git a/.gitignore b/.gitignore index 57157126..8e59b12e 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,7 @@ gradle-app.setting .DS_Store ## Android -gen/ \ No newline at end of file +gen/ + +## Prebuilt +Backup.apk diff --git a/app/src/main/Android.mk b/Android.mk similarity index 50% rename from app/src/main/Android.mk rename to Android.mk index 28df4ae6..4b009874 100644 --- a/app/src/main/Android.mk +++ b/Android.mk @@ -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) \ No newline at end of file diff --git a/download.sh b/download.sh new file mode 100755 index 00000000..f10ce295 --- /dev/null +++ b/download.sh @@ -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 \ No newline at end of file diff --git a/app/src/main/permissions_com.stevesoltys.backup.xml b/permissions_com.stevesoltys.backup.xml similarity index 100% rename from app/src/main/permissions_com.stevesoltys.backup.xml rename to permissions_com.stevesoltys.backup.xml diff --git a/app/src/main/whitelist_com.stevesoltys.backup.xml b/whitelist_com.stevesoltys.backup.xml similarity index 100% rename from app/src/main/whitelist_com.stevesoltys.backup.xml rename to whitelist_com.stevesoltys.backup.xml