Analyze a D file for imports
Atila Neves via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 30 07:49:10 PDT 2015
On Tuesday, 30 June 2015 at 13:21:18 UTC, anonymous wrote:
> On Tuesday, 30 June 2015 at 04:02:00 UTC, Maaaks wrote:
>> I want to make a simple build utility that will rebuild only
>> those files which changed since last build and those files
>> that depend on them.
>>
>> Which is the easiest and yet reliable way to parse a D source
>> and find all imports in it (and file import()s as well)?
>
> Here's a pull request to make rdmd do that:
> https://github.com/D-Programming-Language/tools/pull/170
>
> It uses regex over `dmd -deps`.
>
> Be aware of the challenges:
> Compiling source files separately is slower than passing them
> all at once to the compiler. This is why for rdmd the idea is
> run dmd once on all source files that need updating. Alas, dmd
> behaves a little quirky then with regards to where template
> instantiations go [1]. This is currently blocking the PR.
>
> [1]
> https://github.com/D-Programming-Language/tools/pull/170#issuecomment-112526734
rdmd doesn't run on files that need updating; it always compiles
everything, it has no concept of needs updating. What it _does_
do is figure out what "everything" means.
Atila
More information about the Digitalmars-d
mailing list