DMD front-end can be used as a library with Dub

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 29 04:59:23 PDT 2016


On 29/08/2016 11:54 PM, Alexander Breckel wrote:
> On Monday, 29 August 2016 at 11:31:58 UTC, Seb wrote:
>> On Monday, 29 August 2016 at 10:42:23 UTC, Alexander Breckel wrote:
>>> I just tried to use the DMD frontend as a Dub package in my own
>>> project to parse and analyze D files and it ... just worked. The
>>> dub.json for dmd is fairly small and doesn't require any changes to
>>> the code. This might be common knowledge, but I was completely
>>> unprepared for this :)
>>>
>>> [...]
>>
>> Nice :)
>> How about submitting this as PR?
>> Then you get updates for free and more people can work on tweaking the
>> DUB file.
>
> I'm afraid this is not yet ready for upstream. Dmd would first have to
> move all ddmd files into src/ddmd/ to have a clean package namespace.
> And someone smarter than me should probably adjust the dub.json to
> somehow emphasize that the library contains only the front-end.

With the help of sourceFiles you should be fine.
You will also want sourcePaths to be set to [""] to ensure it doesn't 
have anything e.g. src in it.

I would recommend you have dub pregenerate some import files and add 
them via importPaths.


More information about the Digitalmars-d mailing list