From fee6a037b7b28afdc2dfd6297eb089d3e5888ff7 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 12 Apr 2018 13:31:35 +0200 Subject: setupRunEnv: Visit each product dependency only once Otherwise products that appear more than once in the dependencies tree (directly and indirectly) will be processed over and over again. Task-number: QTCREATORBUG-20175 Change-Id: I1c67ecc45aa3203c10d35c5822ad8055111331d3 Reviewed-by: Joerg Bornemann --- share/qbs/modules/cpp/setuprunenv.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'share/qbs/modules/cpp/setuprunenv.js') diff --git a/share/qbs/modules/cpp/setuprunenv.js b/share/qbs/modules/cpp/setuprunenv.js index dfc30d20c..5d8bb5248 100644 --- a/share/qbs/modules/cpp/setuprunenv.js +++ b/share/qbs/modules/cpp/setuprunenv.js @@ -55,8 +55,12 @@ function addExternalLibPath(product, list, path) } } -function gatherPaths(product, libPaths, frameworkPaths) +function gatherPaths(product, libPaths, frameworkPaths, seenProducts) { + if (seenProducts.contains(product.name)) + return; + seenProducts.push(product.name); + // Gather explicitly given library paths. if (product.cpp && product.cpp.libraryPaths) product.cpp.libraryPaths.forEach(function(p) { addExternalLibPath(product, libPaths, p); }); @@ -92,7 +96,7 @@ function gatherPaths(product, libPaths, frameworkPaths) loadableModuleArtifacts.forEach(addArtifact); } if (!dep.hasOwnProperty("present")) // Recurse if the dependency is a product. TODO: Provide non-heuristic way to decide whether dependency is a product. - gatherPaths(dep, libPaths, frameworkPaths); + gatherPaths(dep, libPaths, frameworkPaths, seenProducts); } } @@ -107,7 +111,7 @@ function setupRunEnvironment(product, config) var libPaths = []; var frameworkPaths = []; - gatherPaths(product, libPaths, frameworkPaths); + gatherPaths(product, libPaths, frameworkPaths, []); var runPaths = product.cpp ? product.cpp.systemRunPaths : undefined; if (runPaths && runPaths.length > 0) { -- cgit v1.2.3