Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
September 08, 2016 Get all files imported by a D source file | ||||
---|---|---|---|---|
| ||||
Hi, I wonder if there's standardized way to gather which files are imported by a source file. I know I can run "dmd -v" and look for lines start with "import", but I don't know if this is the best way to do it. |
September 08, 2016 Re: Get all files imported by a D source file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | On 2016-09-08 07:39, Yuxuan Shui wrote: > Hi, > > I wonder if there's standardized way to gather which files are imported > by a source file. I know I can run "dmd -v" and look for lines start > with "import", but I don't know if this is the best way to do it. You can use the "-deps" flag. -- /Jacob Carlborg |
September 08, 2016 Re: Get all files imported by a D source file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Thursday, 8 September 2016 at 06:33:00 UTC, Jacob Carlborg wrote:
> On 2016-09-08 07:39, Yuxuan Shui wrote:
>> Hi,
>>
>> I wonder if there's standardized way to gather which files are imported
>> by a source file. I know I can run "dmd -v" and look for lines start
>> with "import", but I don't know if this is the best way to do it.
>
> You can use the "-deps" flag.
-deps is even noisier than just -v...
|
September 09, 2016 Re: Get all files imported by a D source file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | On 2016-09-08 09:20, Yuxuan Shui wrote: > -deps is even noisier than just -v... This is what the -deps flag is intended for: -deps print module dependencies (imports/file/version/debug/lib) There's also the -deps=<filename> flag, kind of similar: -deps=filename write module dependencies to filename (only imports) -- /Jacob Carlborg |
September 09, 2016 Re: Get all files imported by a D source file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | On Thursday, 8 September 2016 at 07:20:52 UTC, Yuxuan Shui wrote: > On Thursday, 8 September 2016 at 06:33:00 UTC, Jacob Carlborg wrote: >> On 2016-09-08 07:39, Yuxuan Shui wrote: >>> Hi, >>> >>> I wonder if there's standardized way to gather which files are imported >>> by a source file. I know I can run "dmd -v" and look for lines start >>> with "import", but I don't know if this is the best way to do it. >> >> You can use the "-deps" flag. > > -deps is even noisier than just -v... It's pretty noisy alright, but it's also pretty easy to read... It also shows just how coupled phobos is. I'm importing one single function (std.stdio.writefln), and all the dependencies are imported: http://pastebin.com/DSC4JhBD |
September 09, 2016 Re: Get all files imported by a D source file | ||||
---|---|---|---|---|
| ||||
Posted in reply to wobbles | On Friday, 9 September 2016 at 10:03:01 UTC, wobbles wrote:
> On Thursday, 8 September 2016 at 07:20:52 UTC, Yuxuan Shui wrote:
>> On Thursday, 8 September 2016 at 06:33:00 UTC, Jacob Carlborg wrote:
>>> On 2016-09-08 07:39, Yuxuan Shui wrote:
>>>> Hi,
>>>>
>>>> I wonder if there's standardized way to gather which files are imported
>>>> by a source file. I know I can run "dmd -v" and look for lines start
>>>> with "import", but I don't know if this is the best way to do it.
>>>
>>> You can use the "-deps" flag.
>>
>> -deps is even noisier than just -v...
>
> It's pretty noisy alright, but it's also pretty easy to read...
>
> It also shows just how coupled phobos is.
> I'm importing one single function (std.stdio.writefln), and all the dependencies are imported:
> http://pastebin.com/DSC4JhBD
Also the output format seems to change between versions (or between compilers, I don't know).
Because dmd 2.071 prefix lines with "depsImport", while ldc (based on dmd 2.070.2) doesn't.
|
September 12, 2016 Re: Get all files imported by a D source file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yuxuan Shui | On 2016-09-09 18:10, Yuxuan Shui wrote: > Also the output format seems to change between versions (or between > compilers, I don't know). > > Because dmd 2.071 prefix lines with "depsImport", while ldc (based on > dmd 2.070.2) doesn't. The -deps and -deps=<filename> will give you different output. See "dmd --help". -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation