gradle: start supporting gradle-based build (sdl2_gradle)

This commit is contained in:
Mathieu Virbel 2017-05-06 18:02:19 +02:00
parent 7b2a2712db
commit bb643ce15b
2 changed files with 27 additions and 12 deletions

View file

@ -763,6 +763,17 @@ class TargetAndroid(Target):
pass pass
# XXX found how the apk name is really built from the title # XXX found how the apk name is really built from the title
if exists(join(dist_dir, "build.gradle")):
# 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")
apk_dest = u'{packagename}-{version}-{mode}.apk'.format(
packagename=packagename, mode=mode, version=version)
else:
# on ant, the apk use the title, and have version
bl = u'\'" ,' bl = u'\'" ,'
apptitle = config.get('app', 'title') apptitle = config.get('app', 'title')
if hasattr(apptitle, 'decode'): if hasattr(apptitle, 'decode'):
@ -772,14 +783,16 @@ class TargetAndroid(Target):
title=apktitle, title=apktitle,
version=version, version=version,
mode=mode) mode=mode)
apk_dir = join(dist_dir, "bin")
apk_dest = apk
# copy to our place # copy to our place
copyfile(join(dist_dir, 'bin', apk), join(self.buildozer.bin_dir, apk)) copyfile(join(apk_dir, apk), join(self.buildozer.bin_dir, apk_dest))
self.buildozer.info('Android packaging done!') self.buildozer.info('Android packaging done!')
self.buildozer.info( self.buildozer.info(
u'APK {0} available in the bin directory'.format(apk)) u'APK {0} available in the bin directory'.format(apk_dest))
self.buildozer.state['android:latestapk'] = apk self.buildozer.state['android:latestapk'] = apk_dest
self.buildozer.state['android:latestmode'] = self.build_mode self.buildozer.state['android:latestmode'] = self.build_mode
def _update_libraries_references(self, dist_dir): def _update_libraries_references(self, dist_dir):

View file

@ -98,6 +98,8 @@ class TargetAndroidNew(TargetAndroid):
elif option == "--sdk": elif option == "--sdk":
cmd.append("--android_api") cmd.append("--android_api")
cmd.extend(values) cmd.extend(values)
cmd.append("--sdk")
cmd.extend(values)
else: else:
cmd.extend(args) cmd.extend(args)