aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/depscanner.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2017-02-22 15:58:56 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2017-02-24 11:46:45 +0000
commit3851fe4ca3da537c9304fafca901b10bfa2bd7ce (patch)
tree1f1398f0111ff50a128310109a21dc7c92a2d883 /src/lib/corelib/buildgraph/depscanner.cpp
parent268ad79759f75a25b7b192fc27283a6f1f446bb0 (diff)
Un-duplicate code in UserDependencyScanner::evaluate
Use Transformer::translateFileConfig to create an artifact's JS representation. This removes duplicated code and makes sure that no artifact property is missing. Change-Id: Iba3d5713eb08f2c5a6f1aa84e1cfbe09e3a549f6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/depscanner.cpp')
-rw-r--r--src/lib/corelib/buildgraph/depscanner.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/lib/corelib/buildgraph/depscanner.cpp b/src/lib/corelib/buildgraph/depscanner.cpp
index 6a010aca7..8dc99f5ed 100644
--- a/src/lib/corelib/buildgraph/depscanner.cpp
+++ b/src/lib/corelib/buildgraph/depscanner.cpp
@@ -41,6 +41,7 @@
#include "artifact.h"
#include "projectbuilddata.h"
#include "buildgraph.h"
+#include "transformer.h"
#include <tools/error.h>
#include <logging/translator.h>
@@ -231,20 +232,11 @@ QStringList UserDependencyScanner::evaluate(Artifact *artifact, const ScriptFunc
m_scanner->module, m_global, &m_observer);
}
- QScriptValue artifactConfig = m_engine->newObject();
- ModuleProperties::init(artifactConfig, artifact);
- artifactConfig.setProperty(QLatin1String("fileName"),
- FileInfo::fileName(artifact->filePath()), 0);
- artifactConfig.setProperty(QLatin1String("filePath"), artifact->filePath(), 0);
- const QStringList fileTags = artifact->fileTags().toStringList();
- artifactConfig.setProperty(QLatin1String("fileTags"), m_engine->toScriptValue(fileTags));
- if (!m_scanner->module->name.isEmpty())
- artifactConfig.setProperty(QLatin1String("moduleName"), m_scanner->module->name);
QScriptValueList args;
args.reserve(3);
args.append(m_global.property(QString::fromLatin1("project")));
args.append(m_global.property(QString::fromLatin1("product")));
- args.append(artifactConfig);
+ args.append(Transformer::translateFileConfig(m_engine, artifact, m_scanner->module->name));
m_engine->setGlobalObject(m_global);
QScriptValue &function = script->scriptFunction;