questions about dub

togrue via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 21 14:58:17 PDT 2017


On Tuesday, 21 March 2017 at 21:01:31 UTC, thorstein wrote:
>
> Beside my specific problem of how to start with the mir-tools I 
> wonder how and for what purpose 'dub' is applied when building 
> projects in connection with Visual Studio? Or is it just a more 
> light-weight command line build tool?
>
> Thanks for shedding some light!
> Thorstein

Hello Thorstein,

actually mir-algorithm is a library, and can't be run.

A good entry point for dub is 
https://code.dlang.org/getting_started

The overall workflow of dub is something like:


1. Create your own project in a empty folder ( dub init ... )
    (this will generate several files)

2. Add your dependencies to "dub.json" 
(https://code.dlang.org/package-format?lang=json)
    or "dub.sdl" (https://code.dlang.org/package-format?lang=sdl)
    Yes, there exist two equivalent file formats that dub can 
understand.
    But you don't have to remember the whole syntax to add a few 
dependencies.
    The package homepages contain simple snippets you can simply 
copy/paste into your
    dub.json or dub.sdl file 
https://code.dlang.org/packages/mir-algorithm


3. Write code... :)


To build and run your application, execute "dub" in the folder 
where the dub.json / dub.sdl file is located

Dub manages downloading the dependencies and building the right 
version of them.. Very handy!

If you want to develop with visual-d you can generate a visual-d 
project file out of your dub project... ( dub generate visuald )


~togrue




More information about the Digitalmars-d-learn mailing list