aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/environmentscriptrunner.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-11-17 16:19:57 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2017-11-22 15:41:43 +0000
commit3b55e4b03499730085924edfdf04b140ef62274e (patch)
treefee3b33cdc91d2e68531c4b6757e9443df0f7741 /src/lib/corelib/buildgraph/environmentscriptrunner.cpp
parentdf04c86b873ae6167230e66c5a33b2a460e86da0 (diff)
Give the setupRunEnvironment script an additional parameter
Required by follow-up commit. [ChangeLog] The Module.setupRunEnvironment script now has a new parameter "config". Users can set it via the --setup-run-env-config option of the run command. Change-Id: I1be57fcff5321874cf3dcf4fb3a7ef7d6f69a8a5 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/environmentscriptrunner.cpp')
-rw-r--r--src/lib/corelib/buildgraph/environmentscriptrunner.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/corelib/buildgraph/environmentscriptrunner.cpp b/src/lib/corelib/buildgraph/environmentscriptrunner.cpp
index d255c50d2..34c80fd0a 100644
--- a/src/lib/corelib/buildgraph/environmentscriptrunner.cpp
+++ b/src/lib/corelib/buildgraph/environmentscriptrunner.cpp
@@ -114,12 +114,10 @@ void EnvironmentScriptRunner::setupForBuild()
setupEnvironment();
}
-void EnvironmentScriptRunner::setupForRun()
+void EnvironmentScriptRunner::setupForRun(const QStringList &config)
{
- // TODO: This must not be cached anymore after we introduce run script arguments
- if (!m_product->runEnvironment.isEmpty())
- return;
m_envType = RunEnv;
+ m_runEnvConfig = config;
setupEnvironment();
}
@@ -177,6 +175,12 @@ void EnvironmentScriptRunner::setupEnvironment()
static const QString projectKey = QStringLiteral("project");
m_evalContext->scope().setProperty(productKey, envScriptContext.property(productKey));
m_evalContext->scope().setProperty(projectKey, envScriptContext.property(projectKey));
+ if (m_envType == RunEnv) {
+ QScriptValue configArray = engine()->newArray(m_runEnvConfig.size());
+ for (int i = 0; i < m_runEnvConfig.size(); ++i)
+ configArray.setProperty(i, QScriptValue(m_runEnvConfig.at(i)));
+ m_evalContext->scope().setProperty(QLatin1String("config"), configArray);
+ }
setupScriptEngineForFile(engine(), setupScript->fileContext, m_evalContext->scope(),
ObserveMode::Disabled);
QScriptValue fun = engine()->evaluate(setupScript->sourceCode,