mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 15:30:28 +03:00
Speed up ndk-builds by using all cores
This commit is contained in:
parent
a4ab105234
commit
e13b483d99
1 changed files with 4 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import json
|
||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
from optparse import OptionParser, OptionError
|
from optparse import OptionParser, OptionError
|
||||||
import logging
|
import logging
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
import common, metadata
|
import common, metadata
|
||||||
from common import BuildException, VCSException, FDroidPopen, SilentPopen
|
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')
|
jni_components = thisbuild.get('buildjni')
|
||||||
if jni_components == ['yes']:
|
if jni_components == ['yes']:
|
||||||
jni_components = ['']
|
jni_components = ['']
|
||||||
|
jobs = multiprocessing.cpu_count()
|
||||||
ndkbuild = os.path.join(config['ndk_path'], "ndk-build")
|
ndkbuild = os.path.join(config['ndk_path'], "ndk-build")
|
||||||
|
cmd = [ndkbuild, "-j"+str(jobs)]
|
||||||
for d in jni_components:
|
for d in jni_components:
|
||||||
logging.info("Building native code in '%s'" % d)
|
logging.info("Building native code in '%s'" % d)
|
||||||
manifest = root_dir + '/' + d + '/AndroidManifest.xml'
|
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)
|
open(manifest, 'w').write(manifest_text)
|
||||||
# In case the AM.xml read was big, free the memory
|
# In case the AM.xml read was big, free the memory
|
||||||
del manifest_text
|
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:
|
if p.returncode != 0:
|
||||||
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']), p.stdout)
|
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']), p.stdout)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue