mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(tools): add -j/--jobs option to idf.py
Add a global -j/--jobs option to idf.py that sets the number of parallel build jobs passed to the underlying build tool. Previously parallelism was only configurable via the IDF_PY_BUILD_JOBS environment variable, and only for the Ninja generator. The option applies to both Ninja and Make and defaults to IDF_PY_BUILD_JOBS when not given, so the environment variable keeps working as before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
055ba9d3f9
commit
db6b310447
@@ -667,18 +667,13 @@ def run_target(
|
||||
|
||||
generator_cmd = list(GENERATORS[args.generator]['command'])
|
||||
|
||||
if args.generator == 'Ninja':
|
||||
parallel_level = os.environ.get('IDF_PY_BUILD_JOBS')
|
||||
if parallel_level:
|
||||
try:
|
||||
jobs = int(parallel_level)
|
||||
except ValueError as e:
|
||||
raise FatalError('Environment variable IDF_PY_BUILD_JOBS must be a positive integer') from e
|
||||
# Parallel jobs from -j/--jobs (or IDF_PY_BUILD_JOBS), falling back to the generator's default.
|
||||
jobs = getattr(args, 'jobs', None)
|
||||
if jobs is None:
|
||||
jobs = GENERATORS[args.generator].get('default_jobs')
|
||||
|
||||
if jobs <= 0:
|
||||
raise FatalError('Environment variable IDF_PY_BUILD_JOBS must be a positive integer')
|
||||
|
||||
generator_cmd += ['-j', str(jobs)]
|
||||
if jobs is not None:
|
||||
generator_cmd += ['-j', str(jobs)]
|
||||
|
||||
if args.verbose:
|
||||
generator_cmd += [GENERATORS[args.generator]['verbose_flag']]
|
||||
|
||||
Reference in New Issue
Block a user