Make dub part of the standard dmd distribution

Nick Sabalausky via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 1 10:36:36 PDT 2015


On 06/01/2015 11:16 AM, Steven Schveighoffer wrote:
> On 5/31/15 7:01 PM, Andrei Alexandrescu wrote:
>> Let's make this part of 2.068:
>>
>> https://issues.dlang.org/show_bug.cgi?id=14636
>>
>> It's preapproved. Who would want to work on it?
>
> Just a reminder to everyone that at one point, we wanted the compiler to
> do kind of what 'dub' does -- fetch packages as dependencies for a
> project. Remember this DIP? http://wiki.dlang.org/DIP11
>

That sort of did what dub does, but badly. Among other things, it 
directly encouraged developers to hardcode their exact dependencies. It 
would have been a mess. Dub's package management side already handles 
that DIP's goals WAY better. The *only* issue now is trying to opt-out 
of dub's buildsystem side without causing problems (and I absolutely 
believe that to be easily solvable, see my other posts).

There is one part of that old proposal that I have come to like though, 
and wouldn't mind seeing: There was an idea to have DMD automatically 
invoke an external tool

> The problem I have with dub is it makes you as a consumer of libraries
> live within its realm. You have to make a dub file to use it, and that's
> not a small burden.
>

The dub.json file is an absolutely trivial "burden". It's a really, 
REALLY simple little file. Or at least, it should be...

The ONLY real burden comes when trying to teach dub how to build your 
project using dub's own buildsystem. If your project doesn't do 
everything "the dub way" then it certainly can be a bother. And I'm 
pushing very hard to relieve projects of that requirement.

But really, the following is NOT a burden unless extreme lazyness is in 
play:

{
     "name": "my-project",
     "dependencies": {
         "libblah": "~>1.7.0",
         "libfoobar": "~>2.1.0"
     }
}

Yes, a very, very, *VERY* tiny "burden".

And then to also get dub's buildsystem out of the way:

$ mkdir dummy-src-dir
# If lib:
$ touch dummy-src-dir/dummy.d
# Or if app:
$ echo "void main() {}" > dummy-src-dir/dummy.d

{
     "name": "my-project",
     "dependencies": {
         "libblah": "~>1.7.0",
         "libfoobar": "~>2.1.0"
     },

     "sourcePaths": "dummy-src-dir/",
     "pre-build-command-posix": "./buildscript",
     "pre-build-command-win": "buildscript"
}

Done. Trivial. No real burden. (Well, aside from JSON's irritating lack 
of comments or trailing commas.)



More information about the Digitalmars-d mailing list