Source release 14.2.0
This commit is contained in:
42
build.py
42
build.py
@@ -6,6 +6,7 @@
|
||||
|
||||
import argparse
|
||||
import imp
|
||||
import math
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -37,17 +38,36 @@ def VerboseSubprocess(args):
|
||||
return subprocess.call(args)
|
||||
|
||||
|
||||
def RunMake(unused_output_path, build_config):
|
||||
def RunMake(unused_output_path, build_config, job_limit):
|
||||
os.environ['BUILDTYPE'] = build_config
|
||||
return VerboseSubprocess(['make', '-C', cdm_top])
|
||||
|
||||
if job_limit is not None:
|
||||
if math.isinf(job_limit):
|
||||
job_args = ['-j']
|
||||
else:
|
||||
job_args = ['-j', str(job_limit)]
|
||||
else:
|
||||
job_args = []
|
||||
|
||||
return VerboseSubprocess(['make', '-C', cdm_top] + job_args)
|
||||
|
||||
|
||||
def RunNinja(output_path, build_config):
|
||||
def RunNinja(output_path, build_config, job_limit):
|
||||
build_path = os.path.join(output_path, build_config)
|
||||
return VerboseSubprocess(['ninja', '-C', build_path])
|
||||
|
||||
if job_limit is not None:
|
||||
if math.isinf(job_limit):
|
||||
print 'Ninja cannot run an infinite number of jobs.'
|
||||
print 'Running at most 1000 jobs.'
|
||||
job_limit = 1000
|
||||
job_args = ['-j', str(job_limit)]
|
||||
else:
|
||||
job_args = []
|
||||
|
||||
return VerboseSubprocess(['ninja', '-C', build_path] + job_args)
|
||||
|
||||
|
||||
def RunUnknown(unused_output_path, unused_build_config):
|
||||
def RunUnknown(unused_output_path, unused_build_config, unused_job_limit):
|
||||
print 'Cannot automatically build with this generator.'
|
||||
print 'Please start the build manually.'
|
||||
return 0
|
||||
@@ -125,11 +145,19 @@ def main(args):
|
||||
parser.add_argument('-g', '--generator', default=default_generator,
|
||||
help='Which build system to use (make, ninja, ...). '
|
||||
'Defaults to ninja when available, make otherwise.')
|
||||
parser.add_argument('-j', '--jobs', nargs='?', const=float('inf'), type=int,
|
||||
help='When building, run up to this many jobs in '
|
||||
'parallel. The default is the default for your chosen '
|
||||
'generator. If this flag is specified without a value, '
|
||||
'jobs will spawn without limit.')
|
||||
parser.add_argument('-D', action='append', default=[],
|
||||
help='Pass variable definitions to gyp.')
|
||||
parser.add_argument('-ft', '--fuzz_tests', default=False,
|
||||
action='store_true',
|
||||
help='Set this flag if you want to build fuzz tests.')
|
||||
parser.add_argument('--shaka_adapter', default=False,
|
||||
action='store_true',
|
||||
help='Also build the Shaka Embedded adapter.')
|
||||
|
||||
options = parser.parse_args(args)
|
||||
|
||||
@@ -142,6 +170,8 @@ def main(args):
|
||||
'%s/oemcrypto/test/fuzz_tests/oemcrypto_fuzztests.gyp' % cdm_top)
|
||||
else:
|
||||
gyp_args.append('%s/cdm/cdm_unittests.gyp' % cdm_top)
|
||||
if options.shaka_adapter:
|
||||
gyp_args.append('%s/shaka_adapter/shaka_adapter.gyp' % cdm_top)
|
||||
for var in options.D:
|
||||
gyp_args.append('-D' + var)
|
||||
|
||||
@@ -157,7 +187,7 @@ def main(args):
|
||||
# ignores the generator flag output_dir (as of 2014-05-28 with ninja).
|
||||
# So instead of using --build, we simply invoke the build system ourselves.
|
||||
builder = GetBuilder(options.generator)
|
||||
return builder(output_path, options.build_config)
|
||||
return builder(output_path, options.build_config, options.jobs)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user