You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DUB version 1.25.0, built on Apr 23 2021
Linux Ubuntu 20.04
DMD64 D Compiler v2.096.1
Bug Description
You can optionally specify a dependency in a configuration. However, if any of your dependencies optionally also can use that dependency, it gets selected. This means that the dependency can infect configurations with dependencies that nobody has selected.
As an example, consider 3 projects, project1, project2, and projectdep. projectdep is the optional dependency selected by project1. It's dub file isn't important.
project1 has the following dub file:
name "project1"
dependency "projectdep" version="*" optional=true
What I would expect is that dub would build WITH projectdep by default, but WITHOUT projectdep when the nodep configuration is selected. Instead, it always builds with projectdep.
What I believe happens is that dub downloads all possible dependencies of all possible configurations (there are numerous bug reports on this). Then the project1 dependency sees that projectdep is in the dub.selections.json, and adds it to the mix, even though nobody else requested it.
This happens even if the nodep configuration is requested on the first build (with no dub.selections.json file yet)
Some interesting behavior:
If I generate the dub.selections.json, and then remove the withdep config dependency, it still builds with the dependency.
If I instead comment out the optional dependency in project1, THEN it is not built with projectdep even though it's in the selections file.
If I comment out the withdep depedency, AND remove dub.selections.json, then it is build without the dependency.
I have attached a tarball with a sample directory structure and simple app that prints "has dep" or "no dep" to signify whether the dependency is included.
System information
DUB version 1.25.0, built on Apr 23 2021
Linux Ubuntu 20.04
DMD64 D Compiler v2.096.1
Bug Description
You can optionally specify a dependency in a configuration. However, if any of your dependencies optionally also can use that dependency, it gets selected. This means that the dependency can infect configurations with dependencies that nobody has selected.
As an example, consider 3 projects,
project1
,project2
, andprojectdep
.projectdep
is the optional dependency selected byproject1
. It's dub file isn't important.project1
has the following dub file:project2
has the following dub file:Expected Behavior
What I would expect is that dub would build WITH
projectdep
by default, but WITHOUTprojectdep
when thenodep
configuration is selected. Instead, it always builds withprojectdep
.What I believe happens is that dub downloads all possible dependencies of all possible configurations (there are numerous bug reports on this). Then the project1 dependency sees that
projectdep
is in the dub.selections.json, and adds it to the mix, even though nobody else requested it.This happens even if the
nodep
configuration is requested on the first build (with no dub.selections.json file yet)Some interesting behavior:
withdep
config dependency, it still builds with the dependency.withdep
depedency, AND remove dub.selections.json, then it is build without the dependency.I have attached a tarball with a sample directory structure and simple app that prints "has dep" or "no dep" to signify whether the dependency is included.
dubtest.tar.gz
The text was updated successfully, but these errors were encountered: