summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/component.cpp29
-rw-r--r--tests/auto/installer/scriptengine/data/component1.qs6
-rw-r--r--tests/auto/installer/scriptengine/tst_scriptengine.cpp5
3 files changed, 6 insertions, 34 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp
index 5016b5020..633f7a744 100644
--- a/src/libs/installer/component.cpp
+++ b/src/libs/installer/component.cpp
@@ -1171,10 +1171,13 @@ QStringList Component::dependencies() const
QStringList Component::autoDependencies() const
{
- QStringList autoDependencyStringList =
+ const QStringList autoDependencyStringList =
d->m_vars.value(scAutoDependOn).split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
- autoDependencyStringList.removeAll(scScript);
- return autoDependencyStringList;
+ QStringList withoutScriptValuesList;
+ foreach (const QString &string, autoDependencyStringList)
+ if (string.compare(scScript, Qt::CaseInsensitive))
+ withoutScriptValuesList.append(string);
+ return withoutScriptValuesList;
}
/*!
@@ -1201,26 +1204,6 @@ bool Component::isAutoDependOn(const QSet<QString> &componentsToInstall) const
if (autoDependOnList.isEmpty())
return false;
- // The script can override this method and determines if the component needs to be installed.
- if (autoDependOnList.first().compare(scScript, Qt::CaseInsensitive) == 0) {
- QJSValue valueFromScript;
- try {
- valueFromScript = d->scriptEngine()->callScriptMethod(d->m_scriptContext,
- QLatin1String("isAutoDependOn"));
- } catch (const Error &error) {
- MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(),
- QLatin1String("isAutoDependOnError"), tr("Cannot resolve isAutoDependOn in %1"
- ).arg(name()), error.message());
- return false;
- }
-
- if (!valueFromScript.isError())
- return valueFromScript.toBool();
- qDebug() << "Value from script is not valid." << (valueFromScript.toString().isEmpty()
- ? QString::fromLatin1("Unknown error.") : valueFromScript.toString());
- return false;
- }
-
QSet<QString> components = componentsToInstall;
const QStringList installedPackages = d->m_core->localInstalledPackages().keys();
foreach (const QString &name, installedPackages)
diff --git a/tests/auto/installer/scriptengine/data/component1.qs b/tests/auto/installer/scriptengine/data/component1.qs
index af81f5747..60f51bb02 100644
--- a/tests/auto/installer/scriptengine/data/component1.qs
+++ b/tests/auto/installer/scriptengine/data/component1.qs
@@ -35,12 +35,6 @@ Component.prototype.createOperations = function()
component.createOperations();
}
-Component.prototype.isAutoDependOn = function()
-{
- print("isAutoDependOn - OK");
- return false;
-}
-
Component.prototype.isDefault = function()
{
print("isDefault - OK");
diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
index d7b7aa4d0..de5b32076 100644
--- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp
+++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
@@ -114,7 +114,6 @@ private slots:
// (it calls clearAllComponentLists which calls qDeleteAll(m_rootComponents);)
m_core.appendRootComponent(m_component);
- m_component->setValue("AutoDependOn", "Script");
m_component->setValue("Default", "Script");
m_component->setValue(scName, "component.test.name");
@@ -256,10 +255,6 @@ private slots:
setExpectedScriptOutput("\"createOperations - OK\"");
m_component->createOperations();
- setExpectedScriptOutput("\"isAutoDependOn - OK\"");
- bool returnIsAutoDependOn = m_component->isAutoDependOn(QSet<QString>());
- QCOMPARE(returnIsAutoDependOn, false);
-
setExpectedScriptOutput("\"isDefault - OK\"");
bool returnIsDefault = m_component->isDefault();
QCOMPARE(returnIsDefault, false);