Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Fix typos in preface, Chapter 6, Chapter 9 and Chapter 10 of User Guide
- Fix broken links in Chapter 1 of User Guide

From Paul Movall:
- Fix --no-exec when using ninja tool

From Keith F. Prussing:
- Add RequiredPackage to the LaTeX scanner for recursive scanning of
custom LaTeX packages.
Expand Down
2 changes: 2 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ FIXES

- Fix CPPDEFINES test using pkg-config, which was failing on GH Actions.

- Fix -n / --no-exec support when using ninja tool

IMPROVEMENTS
------------

Expand Down
3 changes: 2 additions & 1 deletion SCons/Tool/ninja_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def ninja_builder(env, target, source):

if str(env.get("NINJA_DISABLE_AUTO_RUN")).lower() not in ['1', 'true']:
num_jobs = env.get('NINJA_MAX_JOBS', env.GetOption("num_jobs"))
cmd += ['-j' + str(num_jobs)] + env.get('NINJA_CMD_ARGS', '').split() + NINJA_CMDLINE_TARGETS
ninja_default_cmd_args = '-n' if env.GetOption("no_exec") else ''
cmd += ['-j' + str(num_jobs)] + env.get('NINJA_CMD_ARGS', ninja_default_cmd_args).split() + NINJA_CMDLINE_TARGETS
print(f"ninja will be run with command line targets: {' '.join(NINJA_CMDLINE_TARGETS)}")
print("Executing:", str(' '.join(cmd)))

Expand Down
69 changes: 69 additions & 0 deletions test/ninja/dry_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env python
#
# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

import os

import TestSCons
from TestCmd import IS_WINDOWS

test = TestSCons.TestSCons()

try:
import ninja
except ImportError:
test.skip_test("Could not find module in python")

_python_ = TestSCons._python_
_exe = TestSCons._exe

ninja_bin = TestSCons.NINJA_BINARY

test.dir_fixture('ninja-fixture')

test.file_fixture('ninja_test_sconscripts/sconstruct_generate_and_build_cxx',
'SConstruct')

# generate simple build
test.run()
test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
test.must_contain_all(test.stdout(), 'Executing:')
test.must_contain_all(test.stdout(), 'ninja%(_exe)s -f' % locals())
test.run(program=test.workpath('test2' + _exe), stdout="print_function")

# clean build and ninja files
test.run(arguments='-c', stdout=None)
test.must_contain_all_lines(test.stdout(), [
'Removed test2.o',
'Removed test2',
'Removed build.ninja'])
test.must_not_exist([test.workpath('test2' + _exe), test.workpath('build.ninja')])

# run in no-exec / dry-run mode, which should generate the ninja build files but
# not execute any portion of the build including ninja
test.run(arguments='--no-exec', stdout=None)
test.must_contain_all_lines(test.stdout(), ['Generating: build.ninja'])
test.must_exist(test.workpath('build.ninja'))
test.must_not_exist(test.workpath('test2' + _exe))

test.pass_test()
Loading