gradle-dependency-lock-plugin icon indicating copy to clipboard operation
gradle-dependency-lock-plugin copied to clipboard

Confusing behavior for updateLock

Open sghill opened this issue 8 years ago • 3 comments

Running updateLock with no parameters places a new lock file in the build directory (running generateLock). It'd be more intuitive for users of other dependency management systems if this also automatically added the file to the source directory (saveLock)

sghill avatar Jan 03 '17 19:01 sghill

Oh, that would be nice, but the issue I was getting at was that if you already have a lock file and run updateLock it doesn't actually update the versions of existing dependencies. For example, if I have a dependency on org:foo-lib:1.+ and I'm locked to 1.0.3 when I run updateLock saveLock I'll still be on 1.0.3 even though the tool recognizes there's a newer 1.0.4 version. I have to explicitly run updateLock with an argument telling to bump foo-lib in the lock file. This behavior also differs from existing other language solutions which update everything with no argument or only the thing passed if there is an argument.

jhspaybar avatar Jan 03 '17 19:01 jhspaybar

Other dependency management solutions don't also have a formalized notion of build artifacts and task inputs/outputs. Because gradle has a bigger scope, the problem can be decomposed more granularly. Something you can do for example is compare the updated lock file with the current lock file for issues or editing before "saving" it. You'd be relying on your version control system to otherwise perform this function. You also get to leverage gradle's ability to evaluate task inputs/outputs when updating or saving (if the newly generated file does not differ from the current one, no actual work should be done).

IIRC saveTask.mustRunAfter lockTask updateTask so you could write a dummy task that dependsOn both and simply run that.

dcow avatar Jan 04 '17 04:01 dcow

Hey @sghill , can you fill me in on this one? wondering if there are ergonomics we can improve here in the future

rpalcolea avatar Sep 17 '19 00:09 rpalcolea