add support for gradle dependencies and aar
This commit is contained in:
parent
bb643ce15b
commit
a9de15a905
3 changed files with 27 additions and 5 deletions
|
@ -144,6 +144,14 @@ fullscreen = 0
|
|||
# directory containing the files)
|
||||
#android.add_src =
|
||||
|
||||
# (list) Android AAR archives to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
#android.add_aars =
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
#android.gradle_dependencies =
|
||||
|
||||
# (str) python-for-android branch to use, if not master, useful to try
|
||||
# not yet merged features.
|
||||
#android.branch = master
|
||||
|
|
|
@ -845,7 +845,10 @@ class TargetAndroid(Target):
|
|||
|
||||
def _add_java_src(self, dist_dir):
|
||||
java_src = self.buildozer.config.getlist('app', 'android.add_src', [])
|
||||
src_dir = join(dist_dir, 'src')
|
||||
if exists(join(dist_dir, "build.gradle")):
|
||||
src_dir = join(dist_dir, "src", "main", "java")
|
||||
else:
|
||||
src_dir = join(dist_dir, 'src')
|
||||
for pattern in java_src:
|
||||
for fn in glob(expanduser(pattern.strip())):
|
||||
last_component = basename(fn)
|
||||
|
|
|
@ -4,9 +4,8 @@ Android target, based on python-for-android project (new toolchain)
|
|||
'''
|
||||
import sys
|
||||
|
||||
import buildozer
|
||||
from buildozer.targets.android import TargetAndroid
|
||||
from buildozer import USE_COLOR
|
||||
from buildozer.targets.android import TargetAndroid
|
||||
from os.path import join, expanduser, realpath
|
||||
|
||||
|
||||
|
@ -17,8 +16,8 @@ class TargetAndroidNew(TargetAndroid):
|
|||
p4a_apk_cmd = "apk --debug --bootstrap="
|
||||
extra_p4a_args = ''
|
||||
|
||||
def __init__(self, buildozer):
|
||||
super(TargetAndroidNew, self).__init__(buildozer)
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TargetAndroidNew, self).__init__(*args, **kwargs)
|
||||
self._build_dir = join(self.buildozer.platform_dir, 'build')
|
||||
executable = sys.executable or 'python'
|
||||
self._p4a_cmd = '{} -m pythonforandroid.toolchain '.format(executable)
|
||||
|
@ -134,6 +133,18 @@ class TargetAndroidNew(TargetAndroid):
|
|||
cmd.append('--blacklist')
|
||||
cmd.append(realpath(blacklist_src))
|
||||
|
||||
# support for aars
|
||||
aars = self.buildozer.config.getlist('app', 'android.add_aars', [])
|
||||
for aar in aars:
|
||||
cmd.append('--add-aar')
|
||||
cmd.append(realpath(aar))
|
||||
|
||||
# support for gradle dependencies
|
||||
gradle_dependencies = self.buildozer.config.getlist('app', 'android.gradle_dependencies', [])
|
||||
for gradle_dependency in gradle_dependencies:
|
||||
cmd.append('--depend')
|
||||
cmd.append(gradle_dependency)
|
||||
|
||||
cmd.append('--arch')
|
||||
cmd.append(self.buildozer.config.getdefault('app', 'android.arch', "armeabi-v7a"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue