From: Daniel Martí Date: Sun, 23 Feb 2014 22:33:19 +0000 (+0100) Subject: Speed up ndk-builds by using all cores X-Git-Tag: 0.2~226 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e13b483d99ff4dd225f5b36a937003b78facb081;p=fdroidserver.git Speed up ndk-builds by using all cores --- diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 5702ee7d..1ca5dc21 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -30,6 +30,7 @@ import json from ConfigParser import ConfigParser from optparse import OptionParser, OptionError import logging +import multiprocessing import common, metadata from common import BuildException, VCSException, FDroidPopen, SilentPopen @@ -471,7 +472,9 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d jni_components = thisbuild.get('buildjni') if jni_components == ['yes']: jni_components = [''] + jobs = multiprocessing.cpu_count() ndkbuild = os.path.join(config['ndk_path'], "ndk-build") + cmd = [ndkbuild, "-j"+str(jobs)] for d in jni_components: logging.info("Building native code in '%s'" % d) manifest = root_dir + '/' + d + '/AndroidManifest.xml' @@ -485,7 +488,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d open(manifest, 'w').write(manifest_text) # In case the AM.xml read was big, free the memory del manifest_text - p = FDroidPopen([ndkbuild], cwd=os.path.join(root_dir,d)) + p = FDroidPopen(cmd, cwd=os.path.join(root_dir,d)) if p.returncode != 0: raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']), p.stdout)