1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-03 17:50:11 +02:00

Implement --install for gradle, add compilesdk=

This commit is contained in:
Daniel Martí 2013-08-13 15:20:11 +02:00
parent cf47e151f7
commit bc27ebcb82
2 changed files with 29 additions and 1 deletions

View File

@ -772,6 +772,14 @@ already exist, but not a good idea if it's heavily customised. If you get an
error about invalid target, first try @code{init=rm -rf bin/}; otherwise this
parameter should do the trick.
Please note that gradle builds should be using compilesdk=.
@item compilesdk=<level>
Practically accomplishes the same that target= does when used in ant and maven
projects. compilesdk= is used rather than target= so as to not cause any more
confusion. It only takes effect on gradle builds in the build.gradle file,
thus using it in any other case is not wise.
@item update=xxx
By default, 'android update project' is used to generate or update the
build.xml file. Specifying update=no bypasses that.

View File

@ -417,7 +417,27 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
elif 'gradle' in thisbuild:
flavour = thisbuild['gradle']
p = subprocess.Popen([gradle, 'assemble'+flavour+'Release'], cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if 'compilesdk' in thisbuild:
level = thisbuild["compilesdk"].split('-')[1]
subprocess.call(['sed', '-i',
's@compileSdkVersion[ ]*[0-9]*@compileSdkVersion '+level+'@g',
'build.gradle'], cwd=root_dir)
subprocess.call(['sed', '-i',
's@buildToolsVersion[ ]*["\'][0-9\.]*["\']@buildToolsVersion "'+build_tools+'"@g',
'build.gradle'], cwd=root_dir)
subprocess.call(['sed', '-i',
's@com.android.tools.build:gradle:[0-9\.\+]*@com.android.tools.build:gradle:'+target+'@g',
'build.gradle'], cwd=root_dir)
if install:
commands = [gradle, 'assemble'+flavour+'Debug', 'install'+flavour+'Debug']
else:
commands = [gradle, 'assemble'+flavour+'Release']
p = subprocess.Popen(commands, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
if install:
antcommands = ['debug','install']