mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 11:00:10 +01:00
handle gradle-plugin 3.0 output apk location
This commit adds support for new gradle plugin 3.0 output directories. The new structure looks like this: build/outputs/apk/<flavour1><Flavour2>/release/*.apk Note the capitalization on the different flavour components. So if we build a specific flavour combination we add this combination to the path where we look for an output .apk. Closes #363 Based on !320 by: Michel Le Bihan <michel@lebihan.pl> Signed-off-by: Marcus Hoffmann <bubuiic@aol.com>
This commit is contained in:
parent
794e4436b4
commit
b114b44020
@ -275,14 +275,13 @@ def force_gradle_build_tools(build_dir, build_tools):
|
||||
path)
|
||||
|
||||
|
||||
def capitalize_intact(string):
|
||||
"""Like str.capitalize(), but leave the rest of the string intact without
|
||||
switching it to lowercase."""
|
||||
def transform_first_char(string, method):
|
||||
"""Uses method() on the first character of string."""
|
||||
if len(string) == 0:
|
||||
return string
|
||||
if len(string) == 1:
|
||||
return string.upper()
|
||||
return string[0].upper() + string[1:]
|
||||
return method(string)
|
||||
return method(string[0]) + string[1:]
|
||||
|
||||
|
||||
def has_native_code(apkobj):
|
||||
@ -444,7 +443,7 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext
|
||||
if flavours == ['yes']:
|
||||
flavours = []
|
||||
|
||||
flavours_cmd = ''.join([capitalize_intact(flav) for flav in flavours])
|
||||
flavours_cmd = ''.join([transform_first_char(flav, str.upper) for flav in flavours])
|
||||
|
||||
gradletasks += ['assemble' + flavours_cmd + 'Release']
|
||||
|
||||
@ -803,11 +802,14 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext
|
||||
|
||||
elif omethod == 'gradle':
|
||||
src = None
|
||||
for apks_dir in [
|
||||
os.path.join(root_dir, 'build', 'outputs', 'apk', 'release'),
|
||||
os.path.join(root_dir, 'build', 'outputs', 'apk'),
|
||||
os.path.join(root_dir, 'build', 'apk'),
|
||||
]:
|
||||
apk_dirs = [
|
||||
os.path.join(root_dir, 'build', 'outputs', 'apk', 'release'),
|
||||
os.path.join(root_dir, 'build', 'outputs', 'apk'),
|
||||
os.path.join(root_dir, 'build', 'apk'),
|
||||
]
|
||||
if flavours_cmd:
|
||||
apk_dirs.append(os.path.join(root_dir, 'build', 'outputs', 'apk', transform_first_char(flavours_cmd, str.lower), 'release'))
|
||||
for apks_dir in apk_dirs:
|
||||
for apkglob in ['*-release-unsigned.apk', '*-unsigned.apk', '*.apk']:
|
||||
apks = glob.glob(os.path.join(apks_dir, apkglob))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user