summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2020-01-12 01:51:40 (GMT)
committerAdam Gross <grossag@vmware.com>2020-01-12 01:51:40 (GMT)
commitdf23cffb83106a243f762258aa645edc86f05779 (patch)
tree7b796d49a1b03472ce4dc0421a82c694b2e8a5ab
parentf0b50df9e6928a72f10c584229d54d0d465db5cf (diff)
downloadSCons-df23cffb83106a243f762258aa645edc86f05779.zip
SCons-df23cffb83106a243f762258aa645edc86f05779.tar.gz
SCons-df23cffb83106a243f762258aa645edc86f05779.tar.bz2
Address review feedback
-rwxr-xr-xsrc/CHANGES.txt4
-rw-r--r--src/engine/SCons/Action.xml21
-rw-r--r--test/Batch/CHANGED_SOURCES.py5
-rw-r--r--test/Depends/Depends.py6
-rw-r--r--test/ParseDepends.py5
-rw-r--r--test/Repository/link-object.py6
6 files changed, 27 insertions, 20 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index d2453ab..53f4d48 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -18,7 +18,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
From Adam Gross:
- Added support for scanning multiple entries in an action string if
- implicit command dependency scanning is enabled.
+ IMPLICIT_COMMAND_DEPENDENCIES is set to 2. This opts into more thorough
+ action scanning where every string in the command is scanned to determine
+ if it is a non-source and non-target path.
From Mathew Robinson:
- Improve performance of Subst by preventing unnecessary frame
diff --git a/src/engine/SCons/Action.xml b/src/engine/SCons/Action.xml
index 7a8194e..f10bf03 100644
--- a/src/engine/SCons/Action.xml
+++ b/src/engine/SCons/Action.xml
@@ -58,6 +58,27 @@ not be added to the targets
built with that construction environment.
</para>
+<para>
+If the construction variable
+&cv-IMPLICIT_COMMAND_DEPENDENCIES;
+is set to <literal>2</literal>, then
+all entries in all command strings will be
+scanned for relative or absolute paths. If
+any are present, they will be added as
+implicit dependencies to the targets built
+with that construction environment.
+not be added to the targets built with that
+construction environment. The first command
+in the action string and the first after any
+<literal>&&</literal> entries will be found
+by searching the <varname>PATH</varname>
+variable in the <varname>ENV</varname>
+environment used to execute the command.
+All other commands will only be found if they
+are absolute paths or valid paths relative
+to the working directory.
+</para>
+
<example_commands>
env = Environment(IMPLICIT_COMMAND_DEPENDENCIES = 0)
</example_commands>
diff --git a/test/Batch/CHANGED_SOURCES.py b/test/Batch/CHANGED_SOURCES.py
index b54bd2e..477869f 100644
--- a/test/Batch/CHANGED_SOURCES.py
+++ b/test/Batch/CHANGED_SOURCES.py
@@ -48,11 +48,8 @@ for infile in sys.argv[2:]:
sys.exit(0)
""")
-# Disable IMPLICIT_COMMAND_DEPENDENCIES because otherwise it renders them less
-# effective. They count on paths provided at the end of the command string only
-# being counted as dependencies if Depends() is used.
test.write('SConstruct', """
-env = Environment(IMPLICIT_COMMAND_DEPENDENCIES=False)
+env = Environment()
env['BATCH_BUILD'] = 'batch_build.py'
env['BATCHCOM'] = r'%(_python_)s $BATCH_BUILD ${TARGET.dir} $CHANGED_SOURCES'
bb = Action('$BATCHCOM', batch_key=True, targets='CHANGED_TARGETS')
diff --git a/test/Depends/Depends.py b/test/Depends/Depends.py
index 51737a7..3ed9e12 100644
--- a/test/Depends/Depends.py
+++ b/test/Depends/Depends.py
@@ -50,15 +50,11 @@ sys.exit(0)
SUBDIR_foo_dep = os.path.join('$SUBDIR', 'foo.dep')
SUBDIR_f3_out = os.path.join('$SUBDIR', 'f3.out')
-# Disable IMPLICIT_COMMAND_DEPENDENCIES because otherwise it renders them less
-# effective. They count on paths provided at the end of the command string only
-# being counted as dependencies if Depends() is used.
test.write('SConstruct', """
DefaultEnvironment(tools=[])
Foo = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES subdir/foo.dep')
Bar = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES subdir/bar.dep')
-env = Environment(tools=[], BUILDERS = { 'Foo' : Foo, 'Bar' : Bar }, SUBDIR='subdir',
- IMPLICIT_COMMAND_DEPENDENCIES=False)
+env = Environment(tools=[], BUILDERS = { 'Foo' : Foo, 'Bar' : Bar }, SUBDIR='subdir')
env.Depends(target = ['f1.out', 'f2.out'], dependency = r'%(SUBDIR_foo_dep)s')
env.Depends(target = r'%(SUBDIR_f3_out)s', dependency = 'subdir/bar.dep')
env.Foo(target = 'f1.out', source = 'f1.in')
diff --git a/test/ParseDepends.py b/test/ParseDepends.py
index aa15fc9..2de2105 100644
--- a/test/ParseDepends.py
+++ b/test/ParseDepends.py
@@ -40,13 +40,10 @@ with open(sys.argv[1], 'wb') as f, open(sys.argv[2], 'rb') as afp2, open(sys.arg
f.write(afp2.read() + afp3.read())
""")
-# Pass IMPLICIT_COMMAND_DEPENDENCIES=False because the test depends on us not
-# taking a dependency on the last file in the action string.
test.write('SConstruct', """
Foo = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES subdir/foo.dep')
Bar = Builder(action = r'%(_python_)s build.py $TARGET $SOURCES subdir/bar.dep')
-env = Environment(BUILDERS = { 'Foo' : Foo, 'Bar' : Bar }, SUBDIR='subdir',
- IMPLICIT_COMMAND_DEPENDENCIES=False)
+env = Environment(BUILDERS = { 'Foo' : Foo, 'Bar' : Bar }, SUBDIR='subdir')
env.ParseDepends('foo.d')
env.ParseDepends('bar.d')
env.Foo(target = 'f1.out', source = 'f1.in')
diff --git a/test/Repository/link-object.py b/test/Repository/link-object.py
index f5bf783..78add90 100644
--- a/test/Repository/link-object.py
+++ b/test/Repository/link-object.py
@@ -44,13 +44,7 @@ workpath_repository = test.workpath('repository')
repository_foo = test.workpath('repository', 'foo' + _exe)
work_foo = test.workpath('work', 'foo' + _exe)
-# Don't take implicit command dependencies because otherwise the program will
-# be unexpectedly recompiled the first time we use chdir="work". The reason is
-# that we take .obj files as implicit dependencies but when we move the current
-# directory, those .obj files are no longer around.
#
-# TODO: Should this test pass as-is without disabling implicit command
-# dependencies?
test.write(['repository', 'SConstruct'], """
Repository(r'%s')
env = Environment()