blob: 12ce435482df1edf8cb7adcebf3ed16f176ad1e3 [file] [log] [blame]
.PHONEY: .o
APPPATH=./app/build/outputs/apk/release
BUILDAPK=app-release.apk
SIGNAPK=posa711dali.apk
GRADLE=./gradlew
ZIP=zip
SALT_KEY=.sign_salt
SIGN_FILE=hash256.sign
OS=$(shell uname)
ifneq (,$(findstring MINGW,$(OS)))
GRADLE=gradlew.bat
else
GRADLE=./gradlew
endif
VERSION=$(shell git describe --abbrev=4 --dirty --always --tags)
apk:
@echo "build app apk!"
$(GRADLE) app:assembleRelease
@echo "build android sign apk"
java -jar signapk.jar platform.x509.pem platform.pk8 $(APPPATH)/$(BUILDAPK) $(APPPATH)/$(SIGNAPK)
@echo "build upgrade app zip"
cat $(APPPATH)/$(SIGNAPK) $(SALT_KEY) | sha256sum - | cut -d' ' -f 1 | tr -d '\n' > $(APPPATH)/$(SIGN_FILE)
cd $(APPPATH) && $(ZIP) posa711-$(VERSION).zip $(SIGN_FILE) $(SIGNAPK)
clean:
@echo "remove build cache apk!"
cd $(APPPATH) && rm -rf *.apk *.json *.sign
@echo "remove build cache file success"