diff --git a/source/dub/dub.d b/source/dub/dub.d index 3dc9402..2314c80 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -80,8 +80,14 @@ m_systemConfig = jsonFromFile(m_systemDubPath ~ "settings.json", true); PackageSupplier[] ps = additional_package_suppliers; - if (auto pp = "registryUrls" in m_userConfig) ps ~= deserializeJson!(string[])(*pp).map!(url => new RegistryPackageSupplier(Url(url))).array; - if (auto pp = "registryUrls" in m_systemConfig) ps ~= deserializeJson!(string[])(*pp).map!(url => new RegistryPackageSupplier(Url(url))).array; + if (auto pp = "registryUrls" in m_userConfig) + ps ~= deserializeJson!(string[])(*pp) + .map!(url => cast(PackageSupplier)new RegistryPackageSupplier(Url(url))) + .array; + if (auto pp = "registryUrls" in m_systemConfig) + ps ~= deserializeJson!(string[])(*pp) + .map!(url => cast(PackageSupplier)new RegistryPackageSupplier(Url(url))) + .array; ps ~= defaultPackageSuppliers(); m_packageSuppliers = ps; diff --git a/source/dub/packagesupplier.d b/source/dub/packagesupplier.d index 4101321..27e4d23 100644 --- a/source/dub/packagesupplier.d +++ b/source/dub/packagesupplier.d @@ -22,14 +22,14 @@ /// Supplies packages, this is done by supplying the latest possible version /// which is available. interface PackageSupplier { + /// Returns a hunman readable representation of the supplier + @property string description(); + /// path: absolute path to store the package (usually in a zip format) void retrievePackage(Path path, string packageId, Dependency dep, bool pre_release); /// returns the metadata for the package Json getPackageDescription(string packageId, Dependency dep, bool pre_release); - - /// Returns a hunman readable representation of the supplier - string toString(); } class FileSystemPackageSupplier : PackageSupplier { @@ -39,7 +39,7 @@ this(Path root) { m_path = root; } - override string toString() { return "file repository at "~m_path.toNativeString(); } + override @property string description() { return "file repository at "~m_path.toNativeString(); } void retrievePackage(Path path, string packageId, Dependency dep, bool pre_release) { @@ -98,7 +98,7 @@ m_registryUrl = registry; } - override string toString() { return "registry at "~m_registryUrl.toString(); } + override @property string description() { return "registry at "~m_registryUrl.toString(); } void retrievePackage(Path path, string packageId, Dependency dep, bool pre_release) { diff --git a/source/dub/project.d b/source/dub/project.d index cb9d1cc..bba506a 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -601,7 +601,7 @@ p = sp; break; } catch (Exception e) { - logDiagnostic("No metadata for %s: %s", ps.toString(), e.msg); + logDiagnostic("No metadata for %s: %s", ps.description, e.msg); } } enforce(p !is null, "Could not find package candidate for "~pkg~" "~reqDep.dependency.toString());