dub icon indicating copy to clipboard operation
dub copied to clipboard

Feature Request: Add provides/replacement tag to dub file

Open LunaTheFoxgirl opened this issue 1 year ago • 1 comments

Some projects on the dub database are meant as drop-in replacements and are API compatible with other projects, it would be a good idea to add a provides/replaces tag to the dub file so that during package resolution, if a top level project uses a drop-in replacement sub-packages will use that replacement as well.

This tag should additionally allow specifying a range of versions which are compatible.

Example:

name "i2d-opengl"
description "Dynamic bindings to OpenGL, compatible with -betterC, @nogc, and nothrow."

provides "bindbc-opengl" from="~>1.0.0" to="~>1.0.0"

This file would cause a project using i2d-opengl, to use i2d-opengl for any sub-dependencies using bindbc-opengl, just for the compilation of that package.

Omitting from would make the package resolution count the replacement from all versions from 0.0.0 to to. Omitting to would make the provides be unbounded, replacing any versions after from Omitting both, would make the package replace any version of the package it replaces.

LunaTheFoxgirl avatar May 05 '23 13:05 LunaTheFoxgirl

from and to wouldn't be able to be version ranges here, since it's quite ambiguous what they would actually mean.

Instead we should just use

provides "bindbc-opengl" version=">=1.0.0 <2.0.0"

and use dub's regular version range syntax here

WebFreak001 avatar May 05 '23 13:05 WebFreak001