Find file
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (30 sloc) 1.16 KB
config.raw_apk = 'bin/WifiLock.apk'
# vars expected from .fabric:
# keystore, keyalias, storepass (optional)
load('.fabric')
def build():
# Right now we require $apk to exist.
# TODO: Lern how to use aapt to build without Eclipse!
# determine the version number
import subprocess, re
manifest = subprocess.Popen(
["aapt", "dump", "xmltree", config.raw_apk, "AndroidManifest.xml"],
stdout=subprocess.PIPE).communicate()[0]
version = re.search(r'^\s*A: android:versionName\([^)]+\)="([^"]+)" \(Raw: "[^"]+"\)\s*$', manifest, re.M).groups()[0]
# add version number to file name
import os
base, ext = os.path.splitext(config.raw_apk)
config.target_apk = '%s-%s%s' % (base, version, ext)
local('cp $(raw_apk) $(target_apk)')
@depends(build)
def sign():
local('jarsigner -verbose -storepass $(storepass) -keystore $(keystore) $(target_apk) $(keyalias)')
local('jarsigner -verify $(target_apk)')
@depends(sign)
def make():
# Create a release .apk version.
# Right now "sign" already does all the work.
pass
@depends(make)
def deploy():
pass