D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18079 - rdmd does not discover all dependencies
Summary: rdmd does not discover all dependencies
Status: RESOLVED MOVED
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-14 16:25 UTC by Jonathan Marler
Modified: 2021-01-09 11:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan Marler 2017-12-14 16:25:16 UTC
Related to (https://issues.dlang.org/show_bug.cgi?id=8858).  That bug was created because dmd would not discover all the imported modules when compiling a single file.  However, this was closed as a "non issue" because the compiler is not "supposed" to discover all dependencies when compiling a single module.  If an application wants to discover all imported modules, then they can use the "-deps" flag to force the compiler to do so.

rdmd currently uses this "import discovery" to obtain a list of all the modules it needs to compile.  However, rdmd does not use the "-deps" flag when discovering dependencies which means that in some cases it will be missing modules to compile, i.e.

main.d
```
import foo;
void main() { printx(); }
```
foo.d
```
module foo;
void printx() { import std.stdio; import bar : x; writefln("x is %s", x); }
```
bar.d
```
module bar;
int x = 42;
```

> rdmd main.d

this could be fixed by modifying rdmd to use the "-deps" flag, however, this has a significant performance cost.  Another solution proposed is to integrate the "compile imports" feature (https://github.com/dlang/dmd/pull/7099) and modify rdmd to use that feature instead (https://github.com/dlang/tools/pull/271).
Comment 1 Jonathan Marler 2018-01-10 03:06:04 UTC
This bug should be fixed with this PR.

https://github.com/dlang/tools/pull/271
Comment 2 Jonathan Marler 2018-01-16 17:39:51 UTC
https://github.com/dlang/tools/pull/271
Comment 3 Jonathan Marler 2018-01-20 02:04:42 UTC
https://github.com/dlang/tools/pull/271 was reverted
Comment 4 Mathias LANG 2021-01-09 11:11:47 UTC
Moved to https://github.com/dlang/tools/issues/423