Current RDMD, please?

Nick Sabalausky aaaaaa at aaaaaaa.com
Mon Aug 16 23:53:14 PDT 2010


== Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
> Walter, could you please update your build scripts to build and include
> rdmd? It's an important tool. Thanks.
> Andrei

That would be great...

But it seems rdmd and my project still aren't getting along (the change in r1315
*does* help though, just not 100%). I'd like to investigate this further and maybe
provide a patch, but I have some questions about it:

Let me start by outlining [a simplified version of] my project's setup:

My package system is something like this:
module myproj.apps.appA.main; // AppA's 'void main()'
module myproj.apps.appB.main; // AppB's 'void main()'
module myproj.lib.foo; // Foo module, common to both apps

All of the source lives in a "src" subdirectory directly off my project's main
directory. Ie, the modules above correspond to:

{main proj dir}/src/myproj/apps/appA/main.d
{main proj dir}/src/myproj/apps/appB/main.d
{main proj dir}/src/myproj/lib/foo.d

Then there's a build script directly in "{main proj dir}" that tries to build AppA
by calling:

rdmd -ofbin/appA -Isrc --build-only src/myproj/apps/appA/main.d

Before r1315 (ie the rdmd currently packaged with dmd), rdmd would cd into
"src/myproj/apps/appA/" and would, of course, be unable to find
"src/myproj/apps/appA/main.d" from there.

After r1315 (actually, I'm using the one from r1400), rdmd accessess
"src/myproj/apps/appA/main.d" and gets the deps just fine, since it doesn't cd
anywhere. But then it'll prepend "src/myproj/apps/appA/" to the non-phobos
dependencies and end up telling dmd to compile
"src/myproj/apps/appA/src/myproj/lib/foo.d", which, of course, is a butchered path.

I can fix this by changing rdmd's (r1400) line #326 from:

myModules[/*rel2abs*/join(rootDir, moduleSrc)] = moduleObj;

to:

myModules[moduleSrc] = moduleObj;

With that change, all is well for me.

So, I would file a ticket with that one-line patch, but I'm not sure if there was
a specific reason that rootDir should be prepended. Ie, is there some use-case
that would break? If not, then I'll just file that as a ticket, and hopefully it
can be included in the next release. But if not, could you explain what I'm
overlooking so I can try to come up with a patch that would be appropriate?


More information about the Digitalmars-d mailing list