Add android.add_jars config option for bundling extra Java .jar files

(for example: OUYA-ODK/libs/*.jar)
This commit is contained in:
Bob the Hamster 2013-05-16 19:25:33 -07:00
parent 4ccdf18ec3
commit ff34b7b7b5
2 changed files with 19 additions and 0 deletions

View file

@ -69,6 +69,12 @@ fullscreen = 1
# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity
# (str) Semicolon separated list of Java .jar files to add to the libs so
# that pyjnius can access their classes. Don't add jars that you do not need,
# since extra jars can slow down the build process. Allows wildcards matching,
# for example: OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar;bar.jar;path/to/more/*.jar
# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
#android.branch = master

View file

@ -22,6 +22,7 @@ from buildozer.target import Target
from os import environ
from os.path import join, realpath, expanduser
from shutil import copyfile
from glob import glob
class TargetAndroid(Target):
@ -375,6 +376,18 @@ class TargetAndroid(Target):
for permission in permissions:
build_cmd += ' --permission {0}'.format(permission)
# add extra Java jar files
add_jars = config.getdefault('app', 'android.add_jars', '')
if add_jars:
for pattern in add_jars.split(';'):
pattern = expanduser(pattern.strip())
matches = glob(pattern)
if matches:
for jar in matches:
build_cmd += ' --add-jar "{}"'.format(jar)
else:
raise SystemError("Failed to find jar file: {}".format(pattern))
# add presplash
presplash = config.getdefault('app', 'presplash.filename', '')
if presplash: