forked from qt-creator/qt-creator
Project: Improve activeParseEnvironment
Not all Projects have build configurations. Handle those better. Change-Id: I72e63798f034a2a497978a2844c4158dfd09ef0f Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -25,16 +25,18 @@
|
|||||||
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
|
||||||
#include "buildinfo.h"
|
|
||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
|
#include "buildinfo.h"
|
||||||
#include "deployconfiguration.h"
|
#include "deployconfiguration.h"
|
||||||
#include "editorconfiguration.h"
|
#include "editorconfiguration.h"
|
||||||
#include "kit.h"
|
#include "kit.h"
|
||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
#include "projectnodes.h"
|
#include "projectnodes.h"
|
||||||
#include "target.h"
|
#include "runconfiguration.h"
|
||||||
|
#include "runcontrol.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
#include "target.h"
|
||||||
#include "userfileaccessor.h"
|
#include "userfileaccessor.h"
|
||||||
|
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
@@ -862,10 +864,19 @@ Task Project::createProjectTask(Task::TaskType type, const QString &description)
|
|||||||
|
|
||||||
Utils::Environment Project::activeParseEnvironment() const
|
Utils::Environment Project::activeParseEnvironment() const
|
||||||
{
|
{
|
||||||
const BuildConfiguration * const buildConfiguration = activeTarget()
|
const Target *const t = activeTarget();
|
||||||
? activeTarget()->activeBuildConfiguration() : nullptr;
|
const BuildConfiguration *const bc = t ? t->activeBuildConfiguration() : nullptr;
|
||||||
return buildConfiguration ? buildConfiguration->environment()
|
if (bc)
|
||||||
: Utils::Environment::systemEnvironment();
|
return bc->environment();
|
||||||
|
|
||||||
|
const RunConfiguration *const rc = t ? t->activeRunConfiguration() : nullptr;
|
||||||
|
if (rc)
|
||||||
|
return rc->runnable().environment;
|
||||||
|
|
||||||
|
Utils::Environment result = Utils::Environment::systemEnvironment();
|
||||||
|
if (t)
|
||||||
|
t->kit()->addToEnvironment(result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Context Project::projectContext() const
|
Core::Context Project::projectContext() const
|
||||||
|
Reference in New Issue
Block a user