www.digitalmars.com         C & C++   DMDScript  

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

--e89a8ff242a3007c2304e14a8cab
Content-Type: text/plain; charset=ISO-8859-1

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 ?

--e89a8ff242a3007c2304e14a8cab
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Currently rdmd is broken because of (Issue 8856,=A0Issue 8858,=A0Issue=
 7016), ie local import does not create -deps dependency, which results in =
link errors.</div><div>This makes people use global imports as opposed to l=
ocal ones, which is less clean.</div>
<div><br></div><div>I wrote a recursive dependency analyzer and plugged it =
in a modified rdmd, and it does indeed work in all cases I tried (for examp=
le eg, see failing case for rdmd here: Issue 8856).</div><div>The dependenc=
y 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.proce=
ss to get dmd -v&#39;s output via stdout instead of files and is reasonably=
 fast.</div>
<div><br></div><div>However, this is sounds like an un-necessary hack and w=
astes 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 wo=
uld be possible.</div>
<div><br></div><div>quoting from Issue 8856:</div><div>* The root problem i=
s that semantic isn&#39;t run on the dependencies. It&#39;s in Import::sema=
ntic where the import is printed.</div><div>* semantic3 for imported functi=
ons is only run during the inline pass.</div>
<div><br></div><div>can this be fixed? possible with a dmd compiler flag : =
dmd -recursive_deps ?</div>

--e89a8ff242a3007c2304e14a8cab--
Jul 11 2013