www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - fix for enumerating local import dependencies, resolving all rdmd

Currently rdmd is broken because of (Issue 8856, Issue 8858, Issue 7016),
ie local import does not create -deps dependency, which results in link
errors.
This makes people use global imports as opposed to local ones, which is
less clean.

I wrote a recursive dependency analyzer and plugged it in a modified rdmd,
and it does indeed work in all cases I tried (for example eg, see failing
case for rdmd here: Issue 8856).
The dependency analyzer works by calling dmd -v recursively using a breadth
first search strategy, until no more modules are added to the growing
dependency list (it can typically take 3 or 4 iterations). It makes use of
the new std.process to get dmd -v's output via stdout instead of files and
is reasonably fast.

However, this is sounds like an un-necessary hack and wastes compile time
by invoking dmd multiple times instead of twice (dmd -v -c -o- main.d
followed by dmd all_deps.d) or even, ideally, once if that would be
possible.

quoting from Issue 8856:
* The root problem is that semantic isn't run on the dependencies. It's in
Import::semantic where the import is printed.
* semantic3 for imported functions is only run during the inline pass.

can this be fixed? possible with a dmd compiler flag : dmd -recursive_deps ?
Jul 11 2013