www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Range of dub package versions

reply ShadoLight <ettienne.gilbert gmail.com> writes:
I can build my app using dub, which has a dependency on the 
particular version of dlangui that was available when I 
originally created the project:

	"dependencies": {
		"dlangui": "~>0.9.182",
		...etc..
	},

I've recently noticed that the dlangui package is now on v0.9.186.

According to [1] this means:

"Restrict to a certain minor version: "~>2.2.13", equivalent to 
">=2.2.13 <2.3.0""

which I understood means that a 'dub build' would automatically 
download and use this latest version (well, up to v0.10.0 anyway).

But I probably misunderstood this - since this does not happen 
and a 'dub build' still reports:

dlangui 0.9.182: target for configuration "default" is up to date.

Is this behaviour correct?

If it is, then does this not imply that one still have to 
manually track and update the json file each time a dependency 
package is updated (if you want to stick with the latest 
version)? Note that I do understand that, if I had v0.9.186 
package on my machine, the same json file (that specifies 
"~>0.9.182") will still work and actually use this version of the 
package.

But the thing is, how would I get v0.9.186 on my machine except 
by doing a explicit 'dub fetch/add' step?  What then is the 
advantage to the "~>0.9.182" syntax compared with simply 
specifying the actual version (as in "dlangui": "==0.9.182" if it 
anyway boils down to a tracking dependency versions manually?

What am I missing?

[1] https://dub.pm/package-format-json.html#version-specs
Dec 28 2020
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
$ dub upgrade

https://dub.pm/commandline.html#upgrade

dub.selections.json hasn't been deleted/upgraded so the versions would 
have gotten pinned to a known good state. Unless you change the version 
invalidating it, it most likely won't upgrade by itself.
Dec 28 2020
parent ShadoLight <ettienne.gilbert gmail.com> writes:
On Monday, 28 December 2020 at 23:49:02 UTC, rikki cattermole 
wrote:
 $ dub upgrade
[..]
 Unless you change the version invalidating it, it most likely 
 won't upgrade by itself.
Thanks Rikki - that explains it and, indeed, worked perfectly. Thanks!
Dec 29 2020