[Scons-users] scons checking targets actually built?

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Fri Apr 19 12:11:20 EDT 2013


That's an interesting thought. Having said which, I have some stuff in my build that is marked as 'always build' for which it would be a really bad thing if I'd got the target wrong. I'll have a think about that, because one would actually be sensible to build with a ValueType dependency

----- Original Message -----
From: scons-users at scons.org
To: scons-users at scons.org
At: Apr 19 2013 16:29:53

On 04/19/2013 09:13 AM, robert zeigler wrote:

> Perhaps it could be something configured on a per-environment basis?

> I'm willing to do the work and submit the patch, but would appreciate

> some guidance. I'm still really just getting my feet wet with scons.


If you're actually thinking about doing this, I have a
brainstorming-type suggestion. It's brainstorming, so I'm not sure I
like it, but I thought I'd throw it out there.

When creating a rule that SHOULD not produce an output file, you really
ought to be doing something like
test_runner = env.Command('check', ['run_tests'], 'run_tests')
env.AlwaysBuild(test_runner)
(I don't want to quibble over how the name 'run_tests' is generated or
if it needs to be explicitly in the sources list (it may not, I dunno
without testing), etc. The point is that there's the AlwaysBuild line
present.)

In Make, you'd want something like
check: run_tests
./run_tests
.PHONY: check
where you really ought to have the .PHONY line to mark it as a pseudo
target. (Disclaimer: I'm not sure this is AS important in SCons as it is
in Make because of SCons's MD5 decider, but it still seems like a good
idea.)


One potential thing you could do instead of adding a configuration
option is, as a heuristic, use the presence of the AlwaysBuild() call.
In other words:
- If SCons is trying to build a target that's been marked AlwaysBuild
and no file is produced, do nothing
- If SCons is trying to build a target that has NOT been marked
AlwaysBuild and no file is produced, output a warning.
In other words, I'm using the AlwaysBuild function (which should be
there anyway IMO) as your configuration option.

By making the diagnostic in the second case into a warning, it won't
actually *break* existing builds. But you could also make it an error,
or switchable by the command line option.

Evan

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users



More information about the Scons-users mailing list