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

Update ant projects more elegantly

This commit is contained in:
Daniel Martí 2014-02-11 16:26:06 +01:00
parent 86aa3d1530
commit ff8fa2305e

View File

@ -922,18 +922,20 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
if basesrclib: if basesrclib:
srclibpaths.append(basesrclib) srclibpaths.append(basesrclib)
# Generate (or update) the ant build file, build.xml... # Generate (or update) the ant build file, build.xml...
if updatemode != 'no' and build['type'] == 'ant': if updatemode != 'no' and build['type'] == 'ant':
parms = [os.path.join(config['sdk_path'], 'tools', 'android'), parms = [os.path.join(config['sdk_path'], 'tools', 'android'), 'update']
'update', 'project'] lparms = parms + ['lib-project']
parms = parms + ['project']
if 'target' in build and build['target']: if 'target' in build and build['target']:
parms += ['-t', build['target']] parms += ['-t', build['target']]
update_dirs = None lparms += ['-t', build['target']]
if updatemode == 'auto': if updatemode == 'auto':
update_dirs = ant_subprojects(root_dir) + ['.'] update_dirs = ant_subprojects(root_dir) + ['.']
else: else:
update_dirs = [d.strip() for d in updatemode.split(';')] update_dirs = [d.strip() for d in updatemode.split(';')]
# Force build.xml update if necessary # Force build.xml update if necessary
if updatemode == 'force' or 'target' in build: if updatemode == 'force' or 'target' in build:
if updatemode == 'force': if updatemode == 'force':
@ -945,18 +947,18 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
for d in update_dirs: for d in update_dirs:
subdir = os.path.join(root_dir, d) subdir = os.path.join(root_dir, d)
dparms = parms + ['-p', d]
if d == '.': if d == '.':
logging.info("Updating main project") logging.info("Updating main project")
cmd = parms + ['-p', d]
else: else:
logging.info("Updating subproject %s" % d) logging.info("Updating subproject %s" % d)
p = FDroidPopen(dparms, cwd=root_dir) cmd = lparms + ['-p', d]
p = FDroidPopen(cmd, cwd=root_dir)
# Check to see whether an error was returned without a proper exit # Check to see whether an error was returned without a proper exit
# code (this is the case for the 'no target set or target invalid' # code (this is the case for the 'no target set or target invalid'
# error) # error)
if p.returncode != 0 or p.stdout.startswith("Error: "): if p.returncode != 0 or p.stdout.startswith("Error: "):
raise BuildException("Failed to update project at %s" % d, raise BuildException("Failed to update project at %s" % d, p.stdout)
p.stdout)
# Clean update dirs via ant # Clean update dirs via ant
if d == '.': if d == '.':
logging.info("Cleaning main project") logging.info("Cleaning main project")