Thread overview
Re: exclude current directory from search path in dmd ?
Jun 08, 2015
Timothee Cour
Jun 08, 2015
Adam D. Ruppe
Jun 09, 2015
Timothee Cour
Jun 09, 2015
Kyoji Klyden
Jun 17, 2015
Liran Zvibel
Jul 20, 2015
Timothee Cour
Jul 20, 2015
Timothee Cour
Jul 20, 2015
ZombineDev
Jul 20, 2015
Timothee Cour
June 08, 2015
ping?

On Sun, Mar 15, 2015 at 10:26 PM, Timothee Cour <thelastmammoth@gmail.com> wrote:

> Is there a way to exclude current directory from search path in dmd, so that the search path is only given by '-I' arguments (+ones from dmd.conf)?
>
> use case:
>
> files:
> /base/foo.d
> /base/bar/foo.d
> /base/bar/main.d #contains: import foo.d
>
> cd /base/bar
> dmd -I/base main.d
> => I want 'import  foo.d' to point to /base/foo.d, not /base/bar/foo.d,
> but this is not the case since -I. is implicit in search path
>
>


June 08, 2015
The easiest way is to not use search paths, and instead pass all the modules you want compiled to the compiler directly. Then it will look for the module name declaration instead of the directory/filename layout.
June 09, 2015
On Mon, Jun 8, 2015 at 12:08 AM, Adam D. Ruppe via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:

> The easiest way is to not use search paths, and instead pass all the modules you want compiled to the compiler directly. Then it will look for the module name declaration instead of the directory/filename layout.
>

Could you be more specific, perhaps with a command line example?
If I understand correctly, what you suggest doesn't bode well with separate
compilation.

Really, I think the easiest would be a flag to disable including current directory implicitly in search path


June 09, 2015
On Tuesday, 9 June 2015 at 00:22:09 UTC, Timothee Cour wrote:
> On Mon, Jun 8, 2015 at 12:08 AM, Adam D. Ruppe via Digitalmars-d-learn <
> digitalmars-d-learn@puremagic.com> wrote:
>
>> The easiest way is to not use search paths, and instead pass all the
>> modules you want compiled to the compiler directly. Then it will look for
>> the module name declaration instead of the directory/filename layout.
>>
>
> Could you be more specific, perhaps with a command line example?
> If I understand correctly, what you suggest doesn't bode well with separate
> compilation.
>
> Really, I think the easiest would be a flag to disable including current
> directory implicitly in search path

dmd main.d ..\foo.d

this will use base\foo.d dmd won't know base\bar\foo.d exists.
June 17, 2015
On Monday, 8 June 2015 at 04:08:55 UTC, Adam D. Ruppe wrote:
> The easiest way is to not use search paths, and instead pass all the modules you want compiled to the compiler directly. Then it will look for the module name declaration instead of the directory/filename layout.

I think that this should be an explicit decision to also add -I. to the compilation or not.

We (at Weka.IO) have to work extra hard to work around it, and since we have a large project with many packages it's impractical to just put everything on the command line.

Also -- you WANT imported modules to be imported (and use the .di equivalent) instead of being compiled on the command line.

A solution that won't break backwards compatibility and will still make sense is have this by default in dmd.conf, and when/if required dmd users can just modify their dmd.conf file.

Liran
July 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14811

On Wed, Jun 17, 2015 at 3:22 AM, Liran Zvibel via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:

> On Monday, 8 June 2015 at 04:08:55 UTC, Adam D. Ruppe wrote:
>
>> The easiest way is to not use search paths, and instead pass all the modules you want compiled to the compiler directly. Then it will look for the module name declaration instead of the directory/filename layout.
>>
>
> I think that this should be an explicit decision to also add -I. to the compilation or not.
>
> We (at Weka.IO) have to work extra hard to work around it, and since we have a large project with many packages it's impractical to just put everything on the command line.
>
> Also -- you WANT imported modules to be imported (and use the .di equivalent) instead of being compiled on the command line.
>
> A solution that won't break backwards compatibility and will still make sense is have this by default in dmd.conf, and when/if required dmd users can just modify their dmd.conf file.
>
> Liran
>


July 20, 2015
I've attached a reduced use case showing that the solutions proposed in this thread do not work, and wrote a local modification to dmd to allow a flag -exclude_cwd_from_imports that does work. Would that be acceptable to have this in official dmd?


On Sun, Jul 19, 2015 at 8:07 PM, Timothee Cour <thelastmammoth@gmail.com> wrote:

> https://issues.dlang.org/show_bug.cgi?id=14811
>
> On Wed, Jun 17, 2015 at 3:22 AM, Liran Zvibel via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:
>
>> On Monday, 8 June 2015 at 04:08:55 UTC, Adam D. Ruppe wrote:
>>
>>> The easiest way is to not use search paths, and instead pass all the modules you want compiled to the compiler directly. Then it will look for the module name declaration instead of the directory/filename layout.
>>>
>>
>> I think that this should be an explicit decision to also add -I. to the compilation or not.
>>
>> We (at Weka.IO) have to work extra hard to work around it, and since we have a large project with many packages it's impractical to just put everything on the command line.
>>
>> Also -- you WANT imported modules to be imported (and use the .di equivalent) instead of being compiled on the command line.
>>
>> A solution that won't break backwards compatibility and will still make sense is have this by default in dmd.conf, and when/if required dmd users can just modify their dmd.conf file.
>>
>> Liran
>>
>
>


July 20, 2015
On Monday, 20 July 2015 at 03:33:08 UTC, Timothee Cour wrote:
> I've attached a reduced use case showing that the solutions proposed in this thread do not work, and wrote a local modification to dmd to allow a flag -exclude_cwd_from_imports that does work. Would that be acceptable to have this in official dmd?
>

The best way to find out is to make a Pull Request. If it's hard to workaround than it's a good candidate for enhancement.
July 20, 2015
https://github.com/D-Programming-Language/dmd/pull/4823

On Sun, Jul 19, 2015 at 10:42 PM, ZombineDev via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:

> On Monday, 20 July 2015 at 03:33:08 UTC, Timothee Cour wrote:
>
>> I've attached a reduced use case showing that the solutions proposed in this thread do not work, and wrote a local modification to dmd to allow a flag -exclude_cwd_from_imports that does work. Would that be acceptable to have this in official dmd?
>>
>>
> The best way to find out is to make a Pull Request. If it's hard to workaround than it's a good candidate for enhancement.
>