Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

Bastiaan Veelo Bastiaan at Veelo.net
Fri Aug 3 19:41:32 UTC 2018


On Tuesday, 19 December 2017 at 10:15:18 UTC, Jacob Carlborg 
wrote:
> On 2017-12-18 23:36, WhatMeWorry wrote:
[...]
>> 
>> But when I look the directory that has the dub.sdl file, I 
>> also see a file called dub.selections.json
>> 
>> {
>>      "fileVersion": 1,
>>      "versions": {
>>          "derelict-al": "1.0.3",
>>          "derelict-assimp3": "1.3.0",
>>          "derelict-fi": "2.0.3",
>>          "derelict-fmod": "2.0.4",
>>          "derelict-ft": "1.1.3",
>>          "derelict-gl3": "1.0.23",
>>          "derelict-glfw3": "3.1.3",
>>          "derelict-util": "2.0.6",
>>          "gl3n": "1.3.1"
>>      }
>> }
>> 
>> 
>> So how did this .json file get created and can I just delete 
>> it?
> You should keep it. If you have developed an application it 
> should be committed to git, if it's a library it should not be 
> committed.

But if you commit it, and a compiler deprecation causes a 
dependency in that pinned version to fail to compile, then your 
app won't compile either, even though your code itself does not 
suffer from the deprecation and even though a newer release of 
the dependency is available that solves the deprecations. This 
means that, if your app is on code.dlang.org, people won't be 
able to dub fetch && dub run.

What advantages does committing dub.selections.json have that 
outweigh this disadvantage?

It would be OK if dub.selections.json would also pin the compiler 
version and there were a standard way to select that version 
(like dvm, but without its shortcomings).

For example, scod 0.4.4 does not compile with dmd 2.081.1 because 
of this (https://github.com/MartinNowak/scod/issues/14). Its 
latest change to dub.selections.json is only three months old, to 
make it work with dmd 2.080.0. This illustrates that if you're 
unlucky, you may have to bring out frequent new releases with 
updates to dub.selections.json (through "dub upgrade") even 
though your app is stable and doesn't change.


More information about the Digitalmars-d-learn mailing list