Merge commit 'refs/merge-requests/84' of git://gitorious.org/f-droid/fdroidserver into merge-requests/84

This commit is contained in:
Ciaran Gultnieks 2012-03-10 20:01:02 +00:00
commit 8c3ee8ca08
3 changed files with 41 additions and 17 deletions

View file

@ -149,10 +149,18 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, extlib_dir, tmp_dir,
tarball.close() tarball.close()
# Build native stuff if required... # Build native stuff if required...
if thisbuild.get('buildjni', 'no') == 'yes': if thisbuild.get('buildjni') not in (None, 'no'):
jni_components = thisbuild.get('buildjni')
if jni_components == 'yes':
jni_components = ['']
else:
jni_components = jni_components.split(';')
ndkbuild = os.path.join(ndk_path, "ndk-build") ndkbuild = os.path.join(ndk_path, "ndk-build")
p = subprocess.Popen([ndkbuild], cwd=root_dir, for d in jni_components:
stdout=subprocess.PIPE) if options.verbose:
print "Running ndk-build in " + root_dir + '/' + d
p = subprocess.Popen([ndkbuild], cwd=root_dir + '/' + d,
stdout=subprocess.PIPE)
output = p.communicate()[0] output = p.communicate()[0]
if p.returncode != 0: if p.returncode != 0:
print output print output
@ -327,9 +335,11 @@ def parse_commandline():
return options, args return options, args
options = None
def main(): def main():
global options
# Read configuration... # Read configuration...
execfile('config.py', globals()) execfile('config.py', globals())
options, args = parse_commandline() options, args = parse_commandline()

View file

@ -713,7 +713,7 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
raise BuildException("Error running init command") raise BuildException("Error running init command")
# Generate (or update) the ant build file, build.xml... # Generate (or update) the ant build file, build.xml...
if (build.get('update', 'yes') != 'no' and if (build.get('update', '.') != 'no' and
not build.has_key('maven')): not build.has_key('maven')):
parms = [os.path.join(sdk_path, 'tools', 'android'), parms = [os.path.join(sdk_path, 'tools', 'android'),
'update', 'project', '-p', '.'] 'update', 'project', '-p', '.']
@ -721,14 +721,17 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
if build.has_key('target'): if build.has_key('target'):
parms.append('-t') parms.append('-t')
parms.append(build['target']) parms.append(build['target'])
update_dirs = build.get('update', '.').split(';')
# Force build.xml update if necessary... # Force build.xml update if necessary...
if build.get('update', 'yes') == 'force' or build.has_key('target'): if build.get('update', '.') == 'force' or build.has_key('target'):
update_dirs = ['.']
buildxml = os.path.join(root_dir, 'build.xml') buildxml = os.path.join(root_dir, 'build.xml')
if os.path.exists(buildxml): if os.path.exists(buildxml):
print 'Force-removing old build.xml' print 'Force-removing old build.xml'
os.remove(buildxml) os.remove(buildxml)
if subprocess.call(parms, cwd=root_dir) != 0: for d in update_dirs:
raise BuildException("Failed to update project") if subprocess.call(parms, cwd=root_dir + '/' + d) != 0:
raise BuildException("Failed to update project")
# 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
# that off, because we want the unsigned apk... # that off, because we want the unsigned apk...
@ -1000,7 +1003,7 @@ def scan_source(build_dir, root_dir, thisbuild):
# Presence of a jni directory without buildjni=yes might # Presence of a jni directory without buildjni=yes might
# indicate a problem... # indicate a problem...
if (os.path.exists(os.path.join(root_dir, 'jni')) and if (os.path.exists(os.path.join(root_dir, 'jni')) and
thisbuild.get('buildjni', 'no') == 'no'): thisbuild.get('buildjni') is None):
msg = 'Found jni directory, but buildjni is not enabled' msg = 'Found jni directory, but buildjni is not enabled'
problems.append(msg) problems.append(msg)

View file

@ -614,23 +614,34 @@ build.xml file. 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. tools. Be aware of any customisations in build.xml when using
update=force.
Be aware of any customisations in build.xml when using update=force. Otherwise, value can be a semicol-separated list of directories in
which to run 'android update project' relative to the main
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 initfun=yes @item initfun=yes
Enables a selection of mad hacks to make com.funambol.android build. Enables a selection of mad hacks to make com.funambol.android build.
Probably not useful for any other application. Probably not useful for any other application.
@item buildjni=[no|yes|force] @item buildjni=[yes|no|<dir list>]
Enables building of native code via the ndk-build script before doing Enables building of native code via the ndk-build script before doing
the main ant build. The default is @code{no}. the main ant build. The value may be a list of directories relative
to the main application directory in which to run ndk-build, or 'yes'
which corresponds to '.' . Using explicit list may be useful to build
multi-component projects.
The build and scan processes will complain (refuse to build) if this is set The build and scan processes will complain (refuse to build) if this
to @code{no}, but there is a @code{jni} directory present. If the native code parameter is not defined, but there is a @code{jni} directory present.
is being built by other means, you can specify @code{manual} here to avoid If the native code is being built by other means, you can specify
that. However, if the native code is actually not required, remove the @code{no} here to avoid that. However, if the native code is actually
directory instead. not required, remove the directory instead (using @code{prebuild} for
example).
@item submodules=yes @item submodules=yes
Use if the project (git only) has submodules - causes git submodule Use if the project (git only) has submodules - causes git submodule