add support for package.type and AAR library builds

This commit is contained in:
Akinwale Ariwodola 2020-02-20 11:59:38 +01:00
parent 53b16c933f
commit 1ff55c4fca

View file

@ -784,6 +784,7 @@ class TargetAndroid(Target):
build_cmd += [("--activity-launch-mode", launch_mode)]
# build only in debug right now.
packagetype = config.get('app', 'package.type')
if self.build_mode == 'debug':
build_cmd += [("debug", )]
mode = 'debug'
@ -791,7 +792,7 @@ class TargetAndroid(Target):
else:
build_cmd += [("release", )]
mode_sign = "release"
mode = self.get_release_mode()
mode = mode_sign if packagetype == "library" else self.get_release_mode()
self.execute_build_package(build_cmd)
@ -813,11 +814,13 @@ class TargetAndroid(Target):
if is_gradle_build:
# on gradle build, the apk use the package name, and have no version
packagename = config.get('app', 'package.name')
apk = u'{packagename}-{mode}.apk'.format(
packagename=packagename, mode=mode)
apk_dir = join(dist_dir, "build", "outputs", "apk", mode_sign)
apk_dest = u'{packagename}-{version}-{mode}.apk'.format(
packagename=packagename, mode=mode, version=version)
pkgsuffix = 'aar' if packagetype == 'library' else 'apk'
apk = u'{packagename}-{mode}.{extension}'.format(
packagename=packagename, mode=mode, extension=pkgsuffix)
apk_dir = join(dist_dir, "build", "outputs", pkgsuffix,
('' if packagetype == 'library' else mode_sign))
apk_dest = u'{packagename}-{version}-{mode}.{extension}'.format(
packagename=packagename, mode=mode, version=version, extension=pkgsuffix)
else:
# on ant, the apk use the title, and have version