~zeller-benjamin/qtcreator-plugin-ubuntu/cmakecache-4.1

« back to all changes in this revision

Viewing changes to src/ubuntu/ubuntuprojecthelper.cpp

  • Committer: Benjamin Zeller
  • Date: 2016-09-05 17:14:46 UTC
  • Revision ID: benjamin.zeller@canonical.com-20160905171446-am7tvf2rm2n59n56
Refactored CMakePlugin uses a temporary dir as long as the builddir was not created.
We can now get the CMakeCache information directly from the plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
17
17
 */
18
18
#include "ubuntuprojecthelper.h"
19
 
#include "ubuntucmakecache.h"
20
19
 
21
20
#include <projectexplorer/project.h>
22
21
#include <projectexplorer/target.h>
24
23
 
25
24
#include <cmakeprojectmanager/cmakeproject.h>
26
25
#include <cmakeprojectmanager/cmakeprojectconstants.h>
 
26
#include <cmakeprojectmanager/cmakebuildconfiguration.h>
27
27
 
28
28
#include <qmakeprojectmanager/qmakeproject.h>
29
29
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
33
33
#include <QDebug>
34
34
 
35
35
#include <QFile>
 
36
#include <QDir>
36
37
#include <QTextStream>
37
38
#include <QRegularExpression>
38
39
 
124
125
QString UbuntuProjectHelper::getManifestPath(ProjectExplorer::Target *target, const QString &defaultValue)
125
126
{
126
127
    if(target && target->project()->id() == CMakeProjectManager::Constants::CMAKEPROJECT_ID ) {
127
 
        QVariant manifestPath = UbuntuCMakeCache::getValue(QStringLiteral("UBUNTU_MANIFEST_PATH"),
128
 
                                                           target->activeBuildConfiguration(),
129
 
                                                           defaultValue);
 
128
 
 
129
        CMakeProjectManager::CMakeConfig fullCache = CMakeProjectManager::CMakeProject::activeCmakeCacheForTarget(target);
 
130
 
 
131
        QString manifestPath;
 
132
 
 
133
        QByteArray fromCache = CMakeProjectManager::CMakeConfigItem::valueOf("UBUNTU_MANIFEST_PATH", fullCache );
 
134
        if (!fromCache.isEmpty()) {
 
135
            manifestPath = QString::fromUtf8(fromCache);
 
136
        } else {
 
137
            manifestPath = defaultValue;
 
138
        }
 
139
 
 
140
        if(QDir::isAbsolutePath(manifestPath))
 
141
            return manifestPath;
130
142
 
131
143
        Utils::FileName projectDir = target->project()->projectDirectory();
132
 
        return projectDir.appendPath(manifestPath.toString()).toString();
 
144
        return projectDir.appendPath(manifestPath).toString();
 
145
 
133
146
    } else if (target && target->project()->id() == QmakeProjectManager::Constants::QMAKEPROJECT_ID ) {
134
147
        QmakeProjectManager::QmakeProject *qmakeProj = static_cast<QmakeProjectManager::QmakeProject *>(target->project());
135
148
        QList<QmakeProjectManager::QmakeProFileNode *> nodes = qmakeProj->allProFiles();