mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 23:10:29 +03:00
Adapt all build.gradle files to be found. Add preassemble=
This commit is contained in:
parent
8578747ae3
commit
b5ae1f2c85
1 changed files with 25 additions and 9 deletions
|
|
@ -325,6 +325,16 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
|
||||||
print "Suspending build server"
|
print "Suspending build server"
|
||||||
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
||||||
|
|
||||||
|
def adapt_gradle(path, verbose):
|
||||||
|
if verbose:
|
||||||
|
print "Adapting build.gradle at %s" % path
|
||||||
|
|
||||||
|
subprocess.call(['sed', '-i',
|
||||||
|
's@buildToolsVersion[ ]*["\\\'][0-9\.]*["\\\']@buildToolsVersion "'+build_tools+'"@g', path])
|
||||||
|
|
||||||
|
subprocess.call(['sed', '-i',
|
||||||
|
's@com.android.tools.build:gradle:[0-9\.\+]*@com.android.tools.build:gradle:'+gradle_plugin+'@g', path])
|
||||||
|
|
||||||
|
|
||||||
def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, install, force, verbose, onserver):
|
def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, install, force, verbose, onserver):
|
||||||
"""Do a build locally."""
|
"""Do a build locally."""
|
||||||
|
|
@ -426,21 +436,27 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
's@compileSdkVersion[ ]*[0-9]*@compileSdkVersion '+level+'@g',
|
's@compileSdkVersion[ ]*[0-9]*@compileSdkVersion '+level+'@g',
|
||||||
'build.gradle'], cwd=root_dir)
|
'build.gradle'], cwd=root_dir)
|
||||||
|
|
||||||
subprocess.call(['sed', '-i',
|
for root, dirs, files in os.walk(root_dir):
|
||||||
's@buildToolsVersion[ ]*["\'][0-9\.]*["\']@buildToolsVersion "'+build_tools+'"@g',
|
root = os.path.relpath(root, root_dir)
|
||||||
'build.gradle'], cwd=root_dir)
|
for f in files:
|
||||||
|
if f == 'build.gradle':
|
||||||
subprocess.call(['sed', '-i',
|
adapt_gradle(os.path.join(root_dir, root, f), verbose)
|
||||||
's@com.android.tools.build:gradle:[0-9\.\+]*@com.android.tools.build:gradle:'+gradle_plugin+'@g',
|
continue
|
||||||
'build.gradle'], cwd=root_dir)
|
|
||||||
|
|
||||||
if flavour in ['main', 'yes', '']:
|
if flavour in ['main', 'yes', '']:
|
||||||
flavour = ''
|
flavour = ''
|
||||||
|
|
||||||
|
commands = [gradle]
|
||||||
|
if 'preassemble' in thisbuild:
|
||||||
|
for task in thisbuild['preassemble'].split():
|
||||||
|
commands.append(task)
|
||||||
if install:
|
if install:
|
||||||
commands = [gradle, 'assemble'+flavour+'Debug', 'install'+flavour+'Debug']
|
commands += ['assemble'+flavour+'Debug', 'install'+flavour+'Debug']
|
||||||
else:
|
else:
|
||||||
commands = [gradle, 'assemble'+flavour+'Release']
|
commands += ['assemble'+flavour+'Release']
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
print "Running %s on %s" % (" ".join(commands), root_dir)
|
||||||
|
|
||||||
p = subprocess.Popen(commands, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(commands, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue