dub optional dependency

Andre Pany andre at s-e-a-p.de
Sun Oct 29 19:46:58 UTC 2017


On Sunday, 29 October 2017 at 03:26:14 UTC, Mike Parker wrote:
> On Sunday, 29 October 2017 at 01:55:22 UTC, evilrat wrote:
>
>>
>> This is dub design choice, optional requires manual 
>> fetching(dub fetch 'package'). I don't see other options, but 
>> you can try hack this using 'preBuildCommands' by adding dub 
>> fetch. Of course this defeats the purpose.
>
> No, they don't need to be manually fetched. Optional packages 
> are downloaded when they are specified in the 
> dub.selections.json file.
>
>>
>> Isn't it possible to put dependencies in specific 
>> configuration?
>
> What the OP wants is to have dependencies in a configuration be 
> downloaded only when the configuration is specified. Currently, 
> dependencies are always downloaded unless they are optional, no 
> matter where they're listed in the file. And optional 
> dependencies are only downloaded when they are specified in 
> dub.selections.json.
>
> It would be a nice feature to have.

In my case the eager dependency resolution is a serious problem. 
In my work environment access to the internet is forbidden for 
the official build due to software lifecycle requirements. The 
consequence is that I have to fetch all dependencies into the dub 
project (--cache = local).
In addition every time open source software is used, for each 
open source software product a process has to be fulfilled.

As example I would like to use the unit test framework d-unit. 
This dub package has for a specific configuration a decency to 
unit-threaded. The official build will fail as unit-threaded can 
not be found (no internet access). Including unit-threaded is not 
an option due to the open source process. Doing this process for 
the sake of a dub issue is not acceptable.

There is an additional dub build option --nodeps. In my opinion 
this option should solve the problem but it is not working as 
expected. Maybe to due a bug.
I created dub issue 1272 regarding this issue.

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list