Thread overview
Dub and unit-threaded import problem
Mar 05, 2016
Casey
Mar 05, 2016
Atila Neves
Mar 06, 2016
Casey
Mar 06, 2016
Casey
Mar 05, 2016
Sebastiaan Koppe
March 05, 2016
Hello,

I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found.

Details:

DMD version: DMD64 2.070.0

Dub version: 0.9.24

Dub Config:

{
    "name": "pst",
    "targetType": "executable",
    "targetPath": "bin",
    "configurations": [
        {
            "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"
            }
        }
    ]
}

I haven't created any tests at this time.  It's a bare project.  I just wanted to make sure the dub config worked before I started coding.  I feel I'm missing something very simple.  I just don't see it.
March 05, 2016
On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote:
> Hello,
>
> I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found.
>
> [...]

You mispelled "dependencies".

Atila
March 05, 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"
    }
}
March 06, 2016
On Saturday, 5 March 2016 at 18:01:48 UTC, Atila Neves wrote:
> On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote:
>> Hello,
>>
>> I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found.
>>
>> [...]
>
> You mispelled "dependencies".
>
> Atila

Thanks.  I knew it had to be something dumb.
March 06, 2016
On Saturday, 5 March 2016 at 18:01:48 UTC, Atila Neves wrote:
> On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote:
>> Hello,
>>
>> I'm just starting a small project with dub and unit-threaded, but I'm getting an issue where the file "unit_threaded.d" cannot be found.
>>
>> [...]
>
> You mispelled "dependencies".
>
> Atila

Oh, and forgot to mention I like what you did with this new update of unit-threaded.  Can't wait to get some code written.