www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dub: Use Alternate Dependency

reply jmh530 <john.michael.hall gmail.com> writes:
I'm working on two related dub projects on code.dlang.org. One 
has a dependency on the other. However, I've made changes to both 
and to run the tests properly requires me to use both versions in 
my working directory, rather than the versions (specifically for 
the dependency) that is registered on dub.

How do I ensure that dub picks up the right version?
Nov 20 2017
parent reply bauss <jj_1337 live.dk> writes:
On Tuesday, 21 November 2017 at 02:51:13 UTC, jmh530 wrote:
 I'm working on two related dub projects on code.dlang.org. One 
 has a dependency on the other. However, I've made changes to 
 both and to run the tests properly requires me to use both 
 versions in my working directory, rather than the versions 
 (specifically for the dependency) that is registered on dub.

 How do I ensure that dub picks up the right version?
Well dub will always use the versions you have specified in your dub.json/dub.sdl file, so if you have a specific version in you dub.json/dub.sdl then dub will use that version only and won't fetch a new version, so don't use something like "~>version", but just "version". Example --- Instead of (something like this.): dependency "package" version="~>1.2.3" Do: dependency "package" version="1.2.3"
Nov 20 2017
parent reply drug <drug2004 bk.ru> writes:
21.11.2017 07:42, bauss пишет:
 On Tuesday, 21 November 2017 at 02:51:13 UTC, jmh530 wrote:
 I'm working on two related dub projects on code.dlang.org. One has a 
 dependency on the other. However, I've made changes to both and to run 
 the tests properly requires me to use both versions in my working 
 directory, rather than the versions (specifically for the dependency) 
 that is registered on dub.

 How do I ensure that dub picks up the right version?
Well dub will always use the versions you have specified in your dub.json/dub.sdl file, so if you have a specific version in you dub.json/dub.sdl then dub will use that version only and won't fetch a new version, so don't use something like "~>version", but just "version". Example --- Instead of (something like this.): dependency "package" version="~>1.2.3" Do: dependency "package" version="1.2.3"
Probably author needs the following: dependency "package" version="*" path="../relative/path/to/other/custom/package" instead of dependency "package" version="~>1.2.3" this allows using custom package not registered on dub and after debugging register them and use them as usual.
Nov 20 2017
parent jmh530 <john.michael.hall gmail.com> writes:
On Tuesday, 21 November 2017 at 07:36:25 UTC, drug wrote:
 Probably author needs the following:
 dependency "package" version="*" 
 path="../relative/path/to/other/custom/package"
 instead of
 dependency "package" version="~>1.2.3"

 this allows using custom package not registered on dub and 
 after debugging register them and use them as usual.
That looks like it will be useful. For bauss's recommendation, I would effectively have to register the working directory with dub add-local and give it a version in order for it to work. I think it would work, but this looks to be fewer steps. I don't have to remember to remove it when I'm done, just to not use "git add .".
Nov 21 2017