diff --git a/source/dub/dependency.d b/source/dub/dependency.d index ddadb84..f2ca231 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -1116,6 +1116,7 @@ string r; if (this == Invalid) return "no"; + if (this.matchesAny()) return "*"; if (this.isExactVersion() && m_inclusiveA && m_inclusiveB) { // Special "==" case if (m_versA == Version.masterBranch) return "~master"; @@ -1142,9 +1143,12 @@ } } - if (m_versA != Version.minRelease) r = (m_inclusiveA ? ">=" : ">") ~ m_versA.toString(); - if (m_versB != Version.maxRelease) r ~= (r.length==0 ? "" : " ") ~ (m_inclusiveB ? "<=" : "<") ~ m_versB.toString(); - if (this.matchesAny()) r = ">=0.0.0"; + if (m_versA != Version.minRelease || !m_inclusiveA) + r = (m_inclusiveA ? ">=" : ">") ~ m_versA.toString(); + if (m_versB != Version.maxRelease || !m_inclusiveB) + r ~= (r.length == 0 ? "" : " ") ~ (m_inclusiveB ? "<=" : "<") ~ + m_versB.toString(); + return r; } @@ -1241,6 +1245,13 @@ assert(Version("1.0.0+foo").matches(Version("1.0.0+foo"), VersionMatchMode.strict)); } +// Erased version specification for dependency, converted to "" instead of ">0.0.0" +// https://github.com/dlang/dub/issues/2901 +unittest +{ + assert(VersionRange.fromString(">0.0.0").toString() == ">0.0.0"); +} + /// Determines whether the given string is a Git hash. bool isGitHash(string hash) @nogc nothrow pure @safe { diff --git a/test/5-convert/dub.sdl b/test/5-convert/dub.sdl index cd3a039..a8753ce 100644 --- a/test/5-convert/dub.sdl +++ b/test/5-convert/dub.sdl @@ -7,7 +7,7 @@ license "BSD 2-clause" x:ddoxFilterArgs "dfa1" "dfa2" x:ddoxTool "ddoxtool" -dependency "describe-dependency-1:sub1" version=">=0.0.0" +dependency "describe-dependency-1:sub1" version="*" targetType "sourceLibrary" subConfiguration "describe-dependency-1:sub1" "library" dflags "--another-dflag"