Skip to content

Commit

Permalink
Add ninja_jobs to non-GN targets
Browse files Browse the repository at this point in the history
  • Loading branch information
XToripuru committed Oct 8, 2024
1 parent b0eb35c commit 42a03c0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
8 changes: 6 additions & 2 deletions scripts/build/builders/ameba.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ def generate(self):
title='Generating ' + self.identifier)

def _build(self):
self._Execute(['ninja', '-C', self.output_dir],
title='Building ' + self.identifier)
cmd = ['ninja', '-C', self.output_dir]

if self.ninja_jobs is not None:
cmd.append('-j' + str(self.ninja_jobs))

self._Execute(cmd, title='Building ' + self.identifier)

def build_outputs(self):
yield BuilderOutput(
Expand Down
7 changes: 6 additions & 1 deletion scripts/build/builders/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,13 @@ def _build(self):
title="Building APP " + self.identifier,
)
else:
cmd = ["ninja", "-C", self.output_dir]

if self.ninja_jobs is not None:
cmd.append('-j' + str(self.ninja_jobs))

self._Execute(
["ninja", "-C", self.output_dir],
cmd,
title="Building JNI " + self.identifier,
)

Expand Down
9 changes: 8 additions & 1 deletion scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,14 @@ def generate(self):

def PreBuildCommand(self):
if self.app == HostApp.TESTS and self.use_coverage:
self._Execute(['ninja', '-C', self.output_dir, 'default'], title="Build-only")
cmd = ['ninja', '-C', self.output_dir]

if self.ninja_jobs is not None:
cmd.append('-j' + str(self.ninja_jobs))

cmd.append('default')

self._Execute(cmd, title="Build-only")
self._Execute(['lcov', '--initial', '--capture', '--directory', os.path.join(self.output_dir, 'obj'),
'--exclude', os.path.join(self.chip_dir, '**/tests/*'),
'--exclude', os.path.join(self.chip_dir, 'zzz_generated/*'),
Expand Down
8 changes: 6 additions & 2 deletions scripts/build/builders/nrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@ def generate(self):
def _build(self):
logging.info('Compiling NrfConnect at %s', self.output_dir)

self._Execute(['ninja', '-C', self.output_dir],
title='Building ' + self.identifier)
cmd = ['ninja', '-C', self.output_dir]

if self.ninja_jobs is not None:
cmd.append('-j' + str(self.ninja_jobs))

self._Execute(cmd, title='Building ' + self.identifier)

if self.app == NrfApp.UNIT_TESTS:
# Note: running zephyr/zephyr.elf has the same result except it creates
Expand Down
3 changes: 3 additions & 0 deletions scripts/build/builders/telink.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ def _build(self):

cmd = self.get_cmd_prefixes() + ("ninja -C %s" % self.output_dir)

if self.ninja_jobs is not None:
cmd += " -j%s" % str(self.ninja_jobs)

self._Execute(['bash', '-c', cmd], title='Building ' + self.identifier)

def build_outputs(self):
Expand Down

0 comments on commit 42a03c0

Please sign in to comment.