I finally have dependency checking right; I don’t know how I missed ant’s depend task before, but I’m using it now. I’m still a little surprised that the tutorials that I looked at didn’t point it out, and that it’s an optional task; on the other hand, there are enough C and C++ build systems with incorrect dependencies that I suppose the rest of the world doesn’t take this as seriously as I do. (Hint: gcc -MD -MP is your friend.)

There’s still one thing I don’t understand: the depend task’s ‘closure’ attribute. It defaults to false; if turned on, and if A depends on B which depends on C and C changes, then A gets rebuilt. (In addition to B, of course.) I don’t understand why this is necessary, though: thinking about this in C++ terms, it sounds like B’s implementation depends on C, but A doesn’t either directly depend on C or depend on those parts of B’s interface which mention C (if any). In that case, why would we need to recompile A? So there’s something that I’m missing here. I’m leaving it turned off for now; if that causes problems, I’m pretty sure my tests will let me know, at which point I’ll learn why you want to turn it on.

Post Revisions:

There are no revisions for this post.