So, we get this dub.json :

{
  "name": "example",
  "configurations": [
    {
      "name": "example",
      "targetType": "library"
    },
    {
      "name": "unittest",
      "targetType": "library",
      "importPaths": ["source", "tests"],
      "sourcePaths": ["source", "tests"],
      "dependencies": {
        "silly": "~>1.0.2",
        "dshould": "~>1.4.3"
      }
    }
  ]
}

Where "dshould have a dependency to unit-threaded marked as "optional", and not have any "default" set to true. DUB documentation says that the proyect not must pick the optional dependency if I not edit manualy dub.selections.json to pick unit-threaded.

Well.. DUB ignores and picks unit-threaded as I can show here :

$ dub build
Performing "debug" build using /usr/bin/dmd for x86_64.
sybok ~master: building configuration "sybok"...
$ dub test
Generating test runner configuration 'sybok-test-unittest' for 'unittest' (library).
Performing "unittest" build using /usr/bin/dmd for x86_64.
prettyprint 1.0.7: building configuration "library"...
unit-threaded:from 1.0.14: building configuration "library"...
unit-threaded:exception 1.0.14: building configuration "library"... unit-threaded:assertions 1.0.14: building configuration "library"... unit-threaded:integration 1.0.14: building configuration "library"...
unit-threaded:mocks 1.0.14: building configuration "library"...
unit-threaded:property 1.0.14: building configuration "default"...
unit-threaded:runner 1.0.14: building configuration "library"...
unit-threaded 1.0.14: building configuration "library"...
dshould 1.4.3: building configuration "library"...
sybok ~master: building configuration "sybok-test-unittest"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./sybok-test-unittest
 ✓ sybok_spec Sybock test

Summary: 1 passed, 0 failed in 0 ms

And dub.selections.json show this :

{
        "fileVersion": 1,
        "versions": {
                "dshould": "1.4.3",
                "prettyprint": "1.0.7",
                "silly": "1.0.2",
                "unit-threaded": "1.0.14"
        }
}

Plus, If edit dub.selections.json to remove unit-threaded , every time that I launch dub test, overwrites dub.selections.json and picks again unit-threaded.

From my point of view, or documentation it's wrong, or there it's something really broken about this functionality.


Reply via email to