From 31fd5cbb2099ef06515a2dad5e8c209600190b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Fri, 28 Mar 2014 09:10:24 +0100 Subject: [PATCH] Let "*" match any version or branch. Fixes #151. --- source/dub/dependency.d | 3 +++ test/path-subpackage-ref/dub.json | 2 +- test/subpackage-ref/dub.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/dub/dependency.d b/source/dub/dependency.d index 48bf9bf40..d8daee7ab 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -241,6 +241,7 @@ struct Dependency { bool matches(string vers) const { return matches(Version(vers)); } bool matches(const(Version) v) const { return matches(v); } bool matches(ref const(Version) v) const { + if (this == ANY) return true; //logDebug(" try match: %s with: %s", v, this); // Master only matches master if(m_versA.isBranch) { @@ -259,6 +260,8 @@ struct Dependency { /// Merges to versions Dependency merge(ref const(Dependency) o) const { + if (this == ANY) return o; + if (o == ANY) return this; if (!this.valid || !o.valid) return INVALID; if (m_versA.isBranch != o.m_versA.isBranch) return INVALID; if (m_versB.isBranch != o.m_versB.isBranch) return INVALID; diff --git a/test/path-subpackage-ref/dub.json b/test/path-subpackage-ref/dub.json index f82433dd3..378acee84 100644 --- a/test/path-subpackage-ref/dub.json +++ b/test/path-subpackage-ref/dub.json @@ -1,7 +1,7 @@ { "name": "test", "dependencies": { - "test:subpack": "~master" + "test:subpack": "*" }, "subPackages": [ "subpack/" diff --git a/test/subpackage-ref/dub.json b/test/subpackage-ref/dub.json index 73148a570..0f4f3cd3d 100644 --- a/test/subpackage-ref/dub.json +++ b/test/subpackage-ref/dub.json @@ -1,7 +1,7 @@ { "name": "test", "dependencies": { - "test:subpack": "~master" + "test:subpack": "*" }, "subPackages": [ {