forked from qt-creator/qt-creator
QtSupport: Collect environment changes instead of full environments
Starting creating custom qmakeRunEnvironment() with systemEnvironment in derived classes without further context breaks down in cases of e.g. containerized builds. So instead create the base environment outside where the context is clear (still wrong after this patch) and let the derived class only apply the changes they need to an otherwise unspecified environment. Change-Id: Ibb23844f490ce86d8a89f6ce728faff65865c09b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -145,12 +145,10 @@ void AndroidQtVersion::addToEnvironment(const Kit *k, Utils::Environment &env) c
|
||||
config.bestNdkPlatformMatch(qMax(minimumNDK(), AndroidManager::minimumSDK(k)), this));
|
||||
}
|
||||
|
||||
Utils::Environment AndroidQtVersion::qmakeRunEnvironment() const
|
||||
void AndroidQtVersion::setupQmakeRunEnvironment(Utils::Environment &env) const
|
||||
{
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
env.set(QLatin1String("ANDROID_NDK_ROOT"),
|
||||
AndroidConfigurations::currentConfig().ndkLocation(this).toUserOutput());
|
||||
return env;
|
||||
}
|
||||
|
||||
QString AndroidQtVersion::description() const
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
ProjectExplorer::Abis detectQtAbis() const override;
|
||||
|
||||
void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const override;
|
||||
Utils::Environment qmakeRunEnvironment() const override;
|
||||
void setupQmakeRunEnvironment(Utils::Environment &env) const override;
|
||||
|
||||
QSet<Utils::Id> availableFeatures() const override;
|
||||
QSet<Utils::Id> targetDeviceTypes() const override;
|
||||
|
@@ -134,15 +134,12 @@ void QnxQtVersion::addToEnvironment(const Kit *k, Environment &env) const
|
||||
env.prependOrSetLibrarySearchPath(libraryPath().toString());
|
||||
}
|
||||
|
||||
Environment QnxQtVersion::qmakeRunEnvironment() const
|
||||
void QnxQtVersion::setupQmakeRunEnvironment(Utils::Environment &env) const
|
||||
{
|
||||
if (!sdpPath().isEmpty())
|
||||
updateEnvironment();
|
||||
|
||||
Environment env = Environment::systemEnvironment();
|
||||
env.modify(m_qnxEnv);
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
QtSupport::QtConfigWidget *QnxQtVersion::createConfigurationWidget() const
|
||||
|
@@ -56,7 +56,7 @@ public:
|
||||
ProjectExplorer::Abis detectQtAbis() const override;
|
||||
|
||||
void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const override;
|
||||
Utils::Environment qmakeRunEnvironment() const override;
|
||||
void setupQmakeRunEnvironment(Utils::Environment &env) const override;
|
||||
|
||||
QtSupport::QtConfigWidget *createConfigurationWidget() const override;
|
||||
|
||||
|
@@ -1182,7 +1182,9 @@ void BaseQtVersion::ensureMkSpecParsed() const
|
||||
QMakeVfs vfs;
|
||||
QMakeGlobals option;
|
||||
applyProperties(&option);
|
||||
option.environment = qmakeRunEnvironment().toProcessEnvironment();
|
||||
Environment env = Environment::systemEnvironment(); // FIXME: Use build device
|
||||
setupQmakeRunEnvironment(env);
|
||||
option.environment = env.toProcessEnvironment();
|
||||
ProMessageHandler msgHandler(true);
|
||||
ProFileCacheManager::instance()->incRefCount();
|
||||
QMakeParser parser(ProFileCacheManager::instance()->cache(), &vfs, &msgHandler);
|
||||
@@ -1706,9 +1708,17 @@ void BaseQtVersion::addToEnvironment(const Kit *k, Environment &env) const
|
||||
// One such example is Blackberry which for some reason decided to always use the same
|
||||
// qmake and use environment variables embedded in their mkspecs to make that point to
|
||||
// the different Qt installations.
|
||||
|
||||
Environment BaseQtVersion::qmakeRunEnvironment() const
|
||||
{
|
||||
return Environment::systemEnvironment();
|
||||
Environment env = Environment::systemEnvironment(); // FIXME: Use build environment
|
||||
setupQmakeRunEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
void BaseQtVersion::setupQmakeRunEnvironment(Environment &env) const
|
||||
{
|
||||
Q_UNUSED(env);
|
||||
}
|
||||
|
||||
bool BaseQtVersion::hasQmlDumpWithRelocatableFlag() const
|
||||
|
@@ -122,7 +122,7 @@ public:
|
||||
|
||||
void applyProperties(QMakeGlobals *qmakeGlobals) const;
|
||||
virtual void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const;
|
||||
virtual Utils::Environment qmakeRunEnvironment() const;
|
||||
Utils::Environment qmakeRunEnvironment() const;
|
||||
|
||||
// source path defined by qmake property QT_INSTALL_PREFIX/src or by qmake.stash QT_SOURCE_TREE
|
||||
Utils::FilePath sourcePath() const;
|
||||
@@ -253,6 +253,7 @@ protected:
|
||||
|
||||
void ensureMkSpecParsed() const;
|
||||
virtual void parseMkSpec(ProFileEvaluator *) const;
|
||||
virtual void setupQmakeRunEnvironment(Utils::Environment &env) const;
|
||||
|
||||
private:
|
||||
void updateDefaultDisplayName();
|
||||
|
Reference in New Issue
Block a user