I really don't understand DUB

Dennis dkorpel at gmail.com
Mon Apr 8 20:14:47 UTC 2019


On Monday, 8 April 2019 at 19:54:28 UTC, WhatMeWorry wrote:
> Now, I've studied the on-line documentation and even walked 
> through the code somewhat but I'm not making an headway.

Very relatable. My tips so far are:

- Look for projects in github with a similar structure to yours 
and look at their package files. Want to split up your library in 
sub-components? Look at:
https://github.com/d-gamedev-team/gfm/blob/master/dub.json
or:
https://github.com/AuburnSounds/Dplug/blob/master/dub.json

Want to build a game on Windows without console, with and icon 
and including Dll's?
https://github.com/gecko0307/dagon-demo/blob/master/dub.json

- If you think "okay, my D project is slightly unconventional, 
but I think I can make it work with dub using the right 
configuration / preBuildCommands / targetType none": It's an 
uphill battle, it won't work well (or at all).

- bookmark the package reference 
(https://dub.pm/package-format-json.html), you'll go back to it a 
lot.

> (Surely it hurts that I've never been exposed to a library or 
> package manager in general)

It shouldn't be this hard to grasp.

> Is there some good beginner tutorial that I'm missing?

Nope. I considered writing one, but the prerequisite of that is 
that I understand dub myself. You'll have to do with:

https://dub.pm/getting_started.html
https://dub.pm/advanced_usage.html
https://github.com/dlang/dub/wiki/Cookbook


More information about the Digitalmars-d-learn mailing list