From ff1236873c4bd59d5c8b7cd5c90d331de99a48be Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sun, 14 Jul 2002 18:48:56 +0000 Subject: [PATCH] Add --implicit-deps-changed. (Anthony Roach) git-svn-id: http://scons.tigris.org/svn/scons/trunk@413 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- doc/man/scons.1 | 6 ++++++ src/CHANGES.txt | 2 +- src/engine/SCons/Node/__init__.py | 6 +++++- src/engine/SCons/Script/__init__.py | 9 +++++++++ test/option--implicit-cache.py | 31 +++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 8761335c..d32b7ff1 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -399,6 +399,12 @@ to miss changes in the implicit dependencies in cases where a new implicit dependency is added earlier in the implicit dependency search path (e.g. CPPPATH) than a current implicit dependency with the same name. +.TP +--implicit-deps-changed +Force SCons to ignore the cached implicit dependencies. This causes the +implicit dependencies to be rescanned and recached. This implies +.BR --implicit-cache . + .TP --implicit-deps-unchanged Force SCons to ignore changes in the implicit dependencies. diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6b0c79c9..cb26c915 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -135,7 +135,7 @@ RELEASE 0.08 - suffix computation, code cleanup in MultiStepBuilder.__call__(), and replicating some logic in scons_subst(). - - Add a --implicit-deps-unchanged option. + - Add --implicit-deps-changed and --implicit-deps-unchanged options. - Add a GetLaunchDir() function. diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index bc0539e3..90cd122e 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -60,6 +60,10 @@ implicit_cache = 0 # controls whether implicit dep changes are ignored: implicit_deps_unchanged = 0 +# controls whether the cached implicit deps are ignored: +implicit_deps_changed = 0 + + class Node: """The base Node class, for entities that we know how to build, or use to build other Nodes. @@ -200,7 +204,7 @@ class Node: if not self.builder: return - if implicit_cache: + if implicit_cache and not implicit_deps_changed: implicit = self.get_stored_implicit() if implicit is not None: implicit = map(self.builder.source_factory, implicit) diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 1d53fed7..66b4fd76 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -550,6 +550,15 @@ def options_init(): long = ['implicit-cache'], help = "Cache implicit dependencies") + def opt_implicit_deps_changed(opt, arg): + import SCons.Node + SCons.Node.implicit_cache = 1 + SCons.Node.implicit_deps_changed = 1 + + Option(func = opt_implicit_deps_changed, + long = ['implicit-deps-changed'], + help = "Ignore the cached implicit deps.") + def opt_implicit_deps_unchanged(opt, arg): import SCons.Node SCons.Node.implicit_cache = 1 diff --git a/test/option--implicit-cache.py b/test/option--implicit-cache.py index d6ca15cf..4e5cf1e5 100644 --- a/test/option--implicit-cache.py +++ b/test/option--implicit-cache.py @@ -297,4 +297,35 @@ assert string.find(test.stdout(), 'is up to date') != -1, test.stdout() test.run(arguments = variant_prog) assert string.find(test.stdout(), 'is up to date') == -1, test.stdout() +# Test forcing rescanning: +test.write(['include', 'foo.h'], +r""" +#define FOO_STRING "include/foo.h 3\n" +#include "bar.h" +""") + +test.run(arguments = "--implicit-cache " + args) + +test.write(['include', 'foo.h'], +r""" +#define FOO_STRING "include/foo.h 3\n" +#include "baz.h" +#include "bar.h" +""") + +test.run(arguments = "--implicit-deps-unchanged " + variant_prog) +assert string.find(test.stdout(), 'is up to date') == -1, test.stdout() + +test.write(['include', 'baz.h'], +r""" +#define BAZ_STRING "include/baz.h 2\n" +""") + +test.run(arguments = "--implicit-deps-unchanged " + variant_prog) +assert string.find(test.stdout(), 'is up to date') != -1, test.stdout() + +test.run(arguments = "--implicit-deps-changed " + variant_prog) +assert string.find(test.stdout(), 'is up to date') == -1, test.stdout() + + test.pass_test() -- 2.26.2