1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

Add support for gradle properties via gradleprops

This commit is contained in:
Daniel Martí 2015-08-24 15:54:05 -07:00
parent 5a0129d835
commit 06c94b3a44
3 changed files with 19 additions and 3 deletions

View File

@ -1028,6 +1028,13 @@ builds happen correctly.
List of Gradle tasks to be run before the assemble task in a Gradle project List of Gradle tasks to be run before the assemble task in a Gradle project
build. build.
@item gradleprops=<prop1>[,<prop2>,...]
List of Gradle properties to pass via the command line to Gradle. A property
can be of the form @code{foo} or of the form @code{key=value}.
For example: @code{gradleprops=enableFoo,someSetting=bar} will result in
@code{gradle -PenableFoo -PsomeSetting=bar}.
@item antcommands=<target1>[,<target2>,...] @item antcommands=<target1>[,<target2>,...]
Specify an alternate set of Ant commands (target) instead of the default Specify an alternate set of Ant commands (target) instead of the default
'release'. It can't be given any flags, such as the path to a build.xml. 'release'. It can't be given any flags, such as the path to a build.xml.

View File

@ -516,6 +516,9 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
adapt_gradle(libpath) adapt_gradle(libpath)
cmd = [config['gradle']] cmd = [config['gradle']]
if thisbuild['gradleprops']:
cmd += ['-P'+kv for kv in thisbuild['gradleprops']]
for task in gradletasks: for task in gradletasks:
parts = task.split(':') parts = task.split(':')
parts[-1] = 'clean' + capitalize_intact(parts[-1]) parts[-1] = 'clean' + capitalize_intact(parts[-1])
@ -711,9 +714,13 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
with open(os.path.join(root_dir, 'build.gradle'), "a") as f: with open(os.path.join(root_dir, 'build.gradle'), "a") as f:
f.write("\nandroid { lintOptions { checkReleaseBuilds false } }\n") f.write("\nandroid { lintOptions { checkReleaseBuilds false } }\n")
commands = [config['gradle']] + gradletasks cmd = [config['gradle']]
if thisbuild['gradleprops']:
cmd += ['-P'+kv for kv in thisbuild['gradleprops']]
p = FDroidPopen(commands, cwd=root_dir) cmd += gradletasks
p = FDroidPopen(cmd, cwd=root_dir)
elif thisbuild['type'] == 'ant': elif thisbuild['type'] == 'ant':
logging.info("Building Ant project...") logging.info("Building Ant project...")

View File

@ -105,6 +105,7 @@ flag_defaults = OrderedDict([
('buildjni', []), ('buildjni', []),
('ndk', 'r10e'), # defaults to latest ('ndk', 'r10e'), # defaults to latest
('preassemble', []), ('preassemble', []),
('gradleprops', []),
('antcommands', None), ('antcommands', None),
('novcheck', False), ('novcheck', False),
]) ])
@ -522,7 +523,8 @@ def metafieldtype(name):
def flagtype(name): def flagtype(name):
if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni', 'preassemble', if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni', 'preassemble',
'update', 'scanignore', 'scandelete', 'gradle', 'antcommands']: 'update', 'scanignore', 'scandelete', 'gradle', 'antcommands',
'gradleprops']:
return 'list' return 'list'
if name in ['init', 'prebuild', 'build']: if name in ['init', 'prebuild', 'build']:
return 'script' return 'script'