[Scons-users] Prefixing a command without messing up dependencies

Greg Ward greg at gerg.ca
Tue Jul 17 13:57:50 EDT 2012


Hi all --

our build normally runs a lot of

javac ... <sources>

commands, and SCons correctly determines that the targets depend on
javac as well as <sources>. However, javac emits lots of stupid
warnings that are impossible to disable. I wrote a script to handle
this, but it doesn't work like this:

javac ... <sources> 2>&1 | filterJavac

because I want to keep stdout and stderr distinct. So instead it works
like this:

filterJavac [options] -- javac ... <sources>

where filterJavac runs javac as a subprocess and filters its stdout
and stderr intelligently. Works great... except that now SCons thinks
my compiler output depends on filterJavac, not on javac. I'd like to
be able to toggle use of filterJavac with a command-line option, but
that triggers lots of unnecessary rebuilds: "javac is no longer a
dependency" and "filterJavac is a new dependency". Argh.

Suggestions? I think I could easily make those targets all depend on
javac, but there's still the problem of an unwanted dependency on
filterJavac. Is there a way to overrule the usual "depend on argv[0]"
trick?

Greg


More information about the Scons-users mailing list