Add option for parallel builds 80/106680/1
authorhyokeun <hyokeun.jeon@samsung.com>
Thu, 22 Dec 2016 10:59:02 +0000 (19:59 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Thu, 22 Dec 2016 10:59:02 +0000 (19:59 +0900)
Change-Id: If5a678018ff435b8e145e3740023aca7ea01a2af

abs

diff --git a/abs b/abs
index 734d2d2..8c8c6c8 100755 (executable)
--- a/abs
+++ b/abs
@@ -338,7 +338,7 @@ class Sdk(object):
         myZipFile.close()
         return rsrc_zip
 
-    def build_native(self, source, rootstrap=None, arch=None, conf='Debug'):
+    def build_native(self, source, rootstrap=None, arch=None, conf='Debug', jobs=None):
         """SDK CLI build command"""
 
         _rootstrap = self.check_rootstrap(rootstrap)
@@ -363,7 +363,10 @@ class Sdk(object):
             elif arch == 'arm': rootstrap = rootstrap.replace('emulator', 'device')
 
         for x in source.project_list:
-            out = self._run('build-native', ['-r', rootstrap, '-a', self.arch, '-C', conf, '-c', 'gcc', '--' , x['path']], checker=True)
+            b_args = ['-r', rootstrap, '-a', self.arch, '-C', conf, '-c', 'gcc']
+            if jobs is not None: b_args.extend(['-j', jobs])
+            b_args.extend(['--', x['path']])
+            out = self._run('build-native', b_args, checker=True)
             logpath = os.path.join(source.output_dir, \
                                   'build_%s_%s' % (rootstrap, os.path.basename(x['path'])))
             if not os.path.isdir(source.output_dir):
@@ -597,6 +600,8 @@ def argument_parsing(argv):
                         help='(ex, ABS) Certificate profile name')
     build.add_argument('-c', '--conf', action='store',default='Release', dest='conf', \
                         help='(ex, Debug|Release) Build Configuration')
+    build.add_argument('-j', '--jobs', action='store', dest='jobs', \
+                        help='(number of jobs) The number of parallel builds')
     build.add_argument('--sdkpath', action='store', dest='sdkpath', \
                         help='Specify Tizen SDK installation root (one time init).' \
                              ' ex) /home/yours/tizen-sdk/')
@@ -609,7 +614,7 @@ def build_main(args):
     my_source = Source(src=args.workspace)
     my_sdk = Sdk(sdkpath=args.sdkpath)
     my_sdk.clean(my_source)
-    my_sdk.build_native(my_source, rootstrap=args.rootstrap, arch=args.arch, conf=args.conf)
+    my_sdk.build_native(my_source, rootstrap=args.rootstrap, arch=args.arch, conf=args.conf, jobs=args.jobs)
     if args.conf == 'Debug' :
         my_sdk.package_new(my_source, pkg_type=args.type, cert=args.cert, conf=args.conf)
         my_sdk.package_new(my_source, pkg_type=args.type, cert=args.cert, conf=args.conf, manual_strip=True)