From 0b996210f6e0b7d98e505dd313fdc1ed69de3217 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 4 Mar 2015 08:24:16 +0200 Subject: [PATCH] Project: Deduplicate dependency resolving logic Change-Id: I6af80600b060fa6a99704df0709461799858d41e Reviewed-by: Oswald Buddenhagen --- src/qtcreatorplugin.pri | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/qtcreatorplugin.pri b/src/qtcreatorplugin.pri index e3536b35478..a478f498aa3 100644 --- a/src/qtcreatorplugin.pri +++ b/src/qtcreatorplugin.pri @@ -14,33 +14,27 @@ plugin_recmds = $$QTC_PLUGIN_RECOMMENDS include(../qtcreator.pri) +defineReplace(dependencyName) { + dependencies_file = + for(dir, QTC_PLUGIN_DIRS) { + exists($$dir/$$1/$${1}_dependencies.pri) { + dependencies_file = $$dir/$$1/$${1}_dependencies.pri + break() + } + } + isEmpty(dependencies_file): \ + error("Plugin dependency $$dep not found") + include($$dependencies_file) + return($$QTC_PLUGIN_NAME) +} + # for substitution in the .json dependencyList = for(dep, plugin_deps) { - dependencies_file = - for(dir, QTC_PLUGIN_DIRS) { - exists($$dir/$$dep/$${dep}_dependencies.pri) { - dependencies_file = $$dir/$$dep/$${dep}_dependencies.pri - break() - } - } - isEmpty(dependencies_file): \ - error("Plugin dependency $$dep not found") - include($$dependencies_file) - dependencyList += " { \"Name\" : \"$$QTC_PLUGIN_NAME\", \"Version\" : \"$$QTCREATOR_VERSION\" }" + dependencyList += " { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\" }" } for(dep, plugin_recmds) { - dependencies_file = - for(dir, QTC_PLUGIN_DIRS) { - exists($$dir/$$dep/$${dep}_dependencies.pri) { - dependencies_file = $$dir/$$dep/$${dep}_dependencies.pri - break() - } - } - isEmpty(dependencies_file): \ - error("Plugin dependency $$dep not found") - include($$dependencies_file) - dependencyList += " { \"Name\" : \"$$QTC_PLUGIN_NAME\", \"Version\" : \"$$QTCREATOR_VERSION\", \"Type\" : \"optional\" }" + dependencyList += " { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\", \"Type\" : \"optional\" }" } dependencyList = $$join(dependencyList, ",$$escape_expand(\\n)")