Don't create dub.selections.json for library and test targets by default
Since libraries are usually built as dependencies of other (executable )packages, dub.selections.json usually doesn't serve a useful purpose. There may be exceptions when the generated library is intended to be distributed or is used as a plugin (i.e. is itself meant as the final output of the build process), so there should be a command line switch to force generating a selections file.
Whenever a selections file already exists, it should however be used and updated as usual. Apart from library targets, a selections file should also not be created for test runs (dub test).
See #1153 for the previous discussion.
I have very strong opinions about this and we should discuss this carefully.
I don't think this should be implemented at all. Let's please not follow other package managers just because they do the same.
Lockfiles serves a clear purpose, reproduce an environment. Encouraging someone to not use them, in libraries, leads to a lot of issues being created to intentionally remove lock files, making people confused about the purpose of it. On libraries, we should both test in a locked and a suitable different environment (more commonly the latest, but supposedly any supported version, according to the specified version range).
See my and other cited articles here.
From my experience, some experienced users really care about having dub.selections.json checked in, so that tests don't randomly break, so I think for the time being we should hold off on that.