Dub and unit-threaded import problem

Sebastiaan Koppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 5 13:35:21 PST 2016


On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote:
> {
>     "name": "unittest",
>     "preBuildCommands": [
>         "dub run unit-threaded -c gen_ut_main -- -f  bin/ut.d"
>     ],
>     "mainSourceFile": "bin/ut.d",
>     "excludedSourceFiles": ["source/app.d"],
>     "dependences": {
>         "unit-threaded": "~>0.6.3"
>     }
> }

If dub is complaining about not finding bin/ut.d, You need a 
"importPaths": ["bin"] in there. Dub by default only looks in the 
source folder, and it cannot find `bin/ut.d` in `./source`. If 
that is the case you also need to remove the `source` part from 
the excludedSourceFiles.

Here is a config that works for me

{
     "name": "unittest",
     "preBuildCommands": ["dub run unit-threaded -c gen_ut_main -- 
-f bin/ut.d"],
     "importPaths": ["bin"],
     "mainSourceFile": "bin/ut.d",
     "excludedSourceFiles": ["app.d"],
     "dependencies": {
         "unit-threaded": "~>0.6.3"
     }
}


More information about the Digitalmars-d-learn mailing list