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

Merge branch 'master' into verbose-rewrite

Conflicts:
	fdroidserver/common.py
This commit is contained in:
Daniel Martí 2013-11-03 14:00:09 +01:00
commit 65e708908e
3 changed files with 39 additions and 18 deletions

View File

@ -805,20 +805,19 @@ thus using it in any other case is not wise.
@item update=xxx @item update=xxx
By default, 'android update project' is used to generate or update the By default, 'android update project' is used to generate or update the
build.xml file. Specifying update=no bypasses that. project and all its referenced projects. Specifying update=no bypasses that.
Specifiying update=force forces rebuilding of the build.xml file at the Specifiying update=force forces rebuilding of the build.xml file at the
same time - this is frequently needed with r14 of the Android platform same time - this is frequently needed with r14 of the Android platform
tools. Be aware of any customisations in build.xml when using tools. Be aware of any customisations in build.xml when using
update=force. update=force.
Default value is '@code{auto}', which uses the paths used in the
project.properties file to find out what project paths to update.
Otherwise, value can be a semicolon-separated list of directories in Otherwise, value can be a semicolon-separated list of directories in
which to run 'android update project' relative to the main which to run 'android update project' relative to the main
application directory (which may include '@code{subdir}' parameter). application directory (which may include '@code{subdir}' parameter).
Default value is '@code{.}', and passing non-default value may be
useful for multi-component projects. Note that @code{--subprojects}
switch is automatically passed to 'android update project', so using
explicit list may be needed only for peculiar source layouts.
@item encoding=xxxx @item encoding=xxxx
Adds a java.encoding property to local.properties with the given Adds a java.encoding property to local.properties with the given

View File

@ -455,8 +455,12 @@ def main():
common.write_metadata(metafile, app) common.write_metadata(metafile, app)
if options.commit and logmsg: if options.commit and logmsg:
print "Commiting update for " + metafile print "Commiting update for " + metafile
if subprocess.call(["git", "commit", "-m", gitcmd = ["git", "commit", "-m",
logmsg, "--", metafile]) != 0: logmsg]
if 'auto_author' in config:
gitcmd.extend(['--author', config['auto_author']])
gitcmd.extend(["--", metafile])
if subprocess.call(gitcmd) != 0:
print "Git commit failed" print "Git commit failed"
sys.exit(1) sys.exit(1)

View File

@ -1379,15 +1379,31 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
(app['id'], build['version']), p.stdout, p.stderr) (app['id'], build['version']), p.stdout, p.stderr)
# Generate (or update) the ant build file, build.xml... # Generate (or update) the ant build file, build.xml...
updatemode = build.get('update', '.') updatemode = build.get('update', 'auto')
if (updatemode != 'no' and if (updatemode != 'no'
'maven' not in build and 'gradle' not in build): and build.get('maven', 'no') == 'no'
and build.get('gradle', 'no') == 'no'):
parms = [os.path.join(sdk_path, 'tools', 'android'), parms = [os.path.join(sdk_path, 'tools', 'android'),
'update', 'project', '-p', '.'] 'update', 'project']
if 'target' in build: if 'target' in build:
parms.append('-t') parms.append('-t')
parms.append(build['target']) parms.append(build['target'])
update_dirs = [d.strip() for d in updatemode.split(';')] update_dirs = None
if updatemode == 'auto':
update_dirs = ['.']
with open(os.path.join(root_dir, 'project.properties')) as f:
for line in f.readlines():
if not line.startswith('android.library.reference.'):
continue
path = line.split('=')[1].strip()
relpath = os.path.join(root_dir, path)
if not os.path.isdir(relpath):
continue
if options.verbose:
print "Found subproject %s..." % path
update_dirs.append(path)
else:
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':
@ -1398,24 +1414,26 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
os.remove(buildxml) os.remove(buildxml)
for d in update_dirs: for d in update_dirs:
cwd = os.path.join(root_dir, d)
# Remove gen and bin dirs in libraries # Remove gen and bin dirs in libraries
# rid of them... # rid of them...
for baddir in [ for baddir in [
'gen', 'bin', 'obj', # ant 'gen', 'bin', 'obj', # ant
'libs/armeabi-v7a', 'libs/armeabi', # jni 'libs/armeabi-v7a', 'libs/armeabi', # jni
'libs/mips', 'libs/x86']: 'libs/mips', 'libs/x86']:
badpath = os.path.join(cwd, baddir) badpath = os.path.join(root_dir, d, baddir)
if os.path.exists(badpath): if os.path.exists(badpath):
print "Removing '%s'" % badpath print "Removing '%s'" % badpath
shutil.rmtree(badpath) shutil.rmtree(badpath)
dparms = parms + ['-p', d]
if options.verbose: if options.verbose:
print "Update of '%s': exec '%s' in '%s'"%\ if d == '.':
(d," ".join(parms),cwd) print "Updating main project..."
p = FDroidPopen(parms, cwd=cwd) else:
print "Updating subproject %s..." % d
p = FDroidPopen(dparms, cwd=root_dir)
# 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' error) # 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' error)
if p.returncode != 0 or (p.stderr != "" and p.stderr.startswith("Error: ")): if p.returncode != 0 or (p.stderr != "" and p.stderr.startswith("Error: ")):
raise BuildException("Failed to update project at %s" % cwd, raise BuildException("Failed to update project at %s" % d,
p.stdout, p.stderr) p.stdout, p.stderr)
# If the app has ant set up to sign the release, we need to switch # If the app has ant set up to sign the release, we need to switch