www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dub and unit-threaded import problem

reply Casey <sybrandy gmail.com> writes:
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.
Mar 05 2016
next sibling parent reply Atila Neves <atila.neves gmail.com> writes:
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
Mar 05 2016
next sibling parent Casey <sybrandy gmail.com> writes:
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.
Mar 05 2016
prev sibling parent Casey <sybrandy gmail.com> writes:
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.
Mar 05 2016
prev sibling parent Sebastiaan Koppe <mail skoppe.eu> writes:
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" } }
Mar 05 2016