diff --git a/source/dub/generators/visuald.d b/source/dub/generators/visuald.d index 1e72ba8..9382b37 100644 --- a/source/dub/generators/visuald.d +++ b/source/dub/generators/visuald.d @@ -126,7 +126,7 @@ if (!deppack) continue; if (isHeaderOnlyPackage(deppack, settings)) { addDepsRec(deppack); - } else { + } else if (!m_app.isRedundantDependency(p, deppack)) { // TODO: clarify what "uuid = uuid" should mean auto uuid = guid(id); ret.formattedWrite("\n %s = %s", uuid, uuid); @@ -327,7 +327,7 @@ // Add libraries, system libs need to be suffixed by ".lib". string linkLibs = join(map!(a => a~".lib")(getSettings!"libs"()), " "); string addLinkFiles = join(getSettings!"sourceFiles"().filter!(s => s.endsWith(".lib"))(), " "); - ret.formattedWrite(" %s %s phobos.lib\n", linkLibs, addLinkFiles); + if (!is_lib) ret.formattedWrite(" %s %s phobos.lib\n", linkLibs, addLinkFiles); // Unittests ret.formattedWrite(" %s\n", buildsettings.options & BuildOptions.unittests ? "1" : "0"); diff --git a/source/dub/project.d b/source/dub/project.d index 766e077..44c9735 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -281,7 +281,8 @@ } size_t cidx = createConfig(p.name, c); foreach (dn; p.dependencies.byKey) { - auto dp = getDependency(dn, false); + auto dp = getDependency(dn, true); + if (!dp) continue; auto subconf = p.getSubConfiguration(c, dp, platform); if (subconf.empty) { foreach (sc; dp.getPlatformConfigurations(platform)) { @@ -294,7 +295,8 @@ } } foreach (dn; p.dependencies.byKey) { - auto dp = getDependency(dn, false); + auto dp = getDependency(dn, true); + if (!dp) continue; determineAllConfigs(dp); } } @@ -339,7 +341,7 @@ string[string] ret; foreach (c; configs) { assert(ret.get(c.pack, c.config) == c.config, format("Conflicting configurations for %s found: %s vs. %s", c.pack, c.config, ret[c.pack])); - logDiagnostic("Using configuration '%s' for %s", c.config, c.pack); + logDebug("Using configuration '%s' for %s", c.config, c.pack); ret[c.pack] = c.config; } @@ -401,6 +403,19 @@ } } + /// Determines if the given dependency is already indirectly referenced by other dependencies of pack. + bool isRedundantDependency(in Package pack, in Package dependency) + const { + foreach (dep; pack.dependencies.byKey) { + auto dp = getDependency(dep, true); + if (!dp) continue; + if (dp is dependency) continue; + foreach (ddp; getTopologicalPackageList(false, dp)) + if (ddp is dependency) return true; + } + return false; + } + /// Actions which can be performed to update the application. Action[] determineActions(PackageSupplier[] packageSuppliers, int option)