summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2021-01-20 14:21:57 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2021-01-21 17:01:31 +0000
commit848669cee3acedc2ed62094a9ab0d26e7c8122e1 (patch)
tree456a133eb09f7a7aa3c0179ee02389c198832200 /src
parent111624970da17bd4642579441ad42b381a596ef5 (diff)
downloadqt-creator-848669cee3acedc2ed62094a9ab0d26e7c8122e1.tar.gz
Read a path to conan from ConanSettings/ConanFilePath key
Introduce the ConanSettings/ConanFilePath key. This key is supposed to be set by QtCreator installer. Fixes: QTCREATORBUG-24968 Change-Id: Ia004a9c14a530f595843fca90f2ec6c62cd2fbca Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/conan/CMakeLists.txt1
-rw-r--r--src/plugins/conan/conan.pro6
-rw-r--r--src/plugins/conan/conan.qbs6
-rw-r--r--src/plugins/conan/conaninstallstep.cpp5
-rw-r--r--src/plugins/conan/conanplugin.cpp14
-rw-r--r--src/plugins/conan/conanplugin.h4
-rw-r--r--src/plugins/conan/conansettings.cpp51
-rw-r--r--src/plugins/conan/conansettings.h49
8 files changed, 130 insertions, 6 deletions
diff --git a/src/plugins/conan/CMakeLists.txt b/src/plugins/conan/CMakeLists.txt
index fd19c47875..e6fdf0f587 100644
--- a/src/plugins/conan/CMakeLists.txt
+++ b/src/plugins/conan/CMakeLists.txt
@@ -3,4 +3,5 @@ add_qtc_plugin(Conan
SOURCES
conaninstallstep.cpp conaninstallstep.h
conanplugin.cpp conanplugin.h
+ conansettings.cpp conansettings.h
)
diff --git a/src/plugins/conan/conan.pro b/src/plugins/conan/conan.pro
index 6fc42a8a62..af1f0b19e0 100644
--- a/src/plugins/conan/conan.pro
+++ b/src/plugins/conan/conan.pro
@@ -2,7 +2,9 @@ include(../../qtcreatorplugin.pri)
SOURCES += \
conaninstallstep.cpp \
- conanplugin.cpp
+ conanplugin.cpp \
+ conansettings.cpp
HEADERS += \
conaninstallstep.h \
- conanplugin.h
+ conanplugin.h \
+ conansettings.h
diff --git a/src/plugins/conan/conan.qbs b/src/plugins/conan/conan.qbs
index 8ed2f131d2..50696ca8c6 100644
--- a/src/plugins/conan/conan.qbs
+++ b/src/plugins/conan/conan.qbs
@@ -10,10 +10,12 @@ QtcPlugin {
Depends { name: "ProjectExplorer" }
files: [
+ "conaninstallstep.h",
+ "conaninstallstep.cpp".
"conanplugin.h",
"conanplugin.cpp",
- "conaninstallstep.h",
- "conaninstallstep.cpp"
+ "conansettings.h",
+ "conansettings.cpp"
]
}
diff --git a/src/plugins/conan/conaninstallstep.cpp b/src/plugins/conan/conaninstallstep.cpp
index d45015a0a1..66a095aaa2 100644
--- a/src/plugins/conan/conaninstallstep.cpp
+++ b/src/plugins/conan/conaninstallstep.cpp
@@ -24,6 +24,8 @@
****************************************************************************/
#include "conaninstallstep.h"
+#include "conanplugin.h"
+#include "conansettings.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h>
@@ -80,7 +82,8 @@ ConanInstallStep::ConanInstallStep(BuildStepList *bsl, Id id)
BuildConfiguration::BuildType bt = buildConfiguration()->buildType();
const QString buildType = bt == BuildConfiguration::Release ? QString("Release")
: QString("Debug");
- CommandLine cmd("conan");
+
+ CommandLine cmd(ConanPlugin::conanSettings()->conanFilePath());
cmd.addArgs({"install", "-s", "build_type=" + buildType, conanFile->value()});
cmd.addArgs(additionalArguments->value(), CommandLine::Raw);
return cmd;
diff --git a/src/plugins/conan/conanplugin.cpp b/src/plugins/conan/conanplugin.cpp
index bf88c803fc..5bd0546223 100644
--- a/src/plugins/conan/conanplugin.cpp
+++ b/src/plugins/conan/conanplugin.cpp
@@ -23,12 +23,16 @@
**
****************************************************************************/
-#include "conanplugin.h"
#include "conaninstallstep.h"
+#include "conanplugin.h"
+#include "conansettings.h"
+#include <coreplugin/icore.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/buildmanager.h>
+using namespace Core;
+
namespace ConanPackageManager {
namespace Internal {
@@ -52,9 +56,17 @@ bool ConanPlugin::initialize(const QStringList &arguments, QString *errorString)
Q_UNUSED(errorString)
m_runData = new ConanPluginRunData;
+ conanSettings()->fromSettings(ICore::settings());
return true;
}
+ConanSettings *ConanPlugin::conanSettings()
+{
+ static ConanSettings theSettings;
+ return &theSettings;
+}
+
+
} // namespace Internal
} // namespace ConanPackageManager
diff --git a/src/plugins/conan/conanplugin.h b/src/plugins/conan/conanplugin.h
index d77409ec97..b26a738276 100644
--- a/src/plugins/conan/conanplugin.h
+++ b/src/plugins/conan/conanplugin.h
@@ -31,12 +31,16 @@ namespace ConanPackageManager {
namespace Internal {
class ConanPluginRunData;
+class ConanSettings;
class ConanPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Conan.json")
+public:
+ static ConanSettings *conanSettings();
+private:
~ConanPlugin() final;
void extensionsInitialized() final;
diff --git a/src/plugins/conan/conansettings.cpp b/src/plugins/conan/conansettings.cpp
new file mode 100644
index 0000000000..f1c3857e94
--- /dev/null
+++ b/src/plugins/conan/conansettings.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "conansettings.h"
+
+namespace ConanPackageManager {
+namespace Internal {
+
+namespace {
+static const char SETTINGS_KEY[] = "ConanSettings";
+static const char CONAN_FILE_PATH[] = "ConanFilePath";
+}
+
+void ConanSettings::fromSettings(QSettings *settings)
+{
+ const QString rootKey = QString(SETTINGS_KEY) + '/';
+
+ m_conanFilePath = Utils::FilePath::fromUserInput(
+ settings->value(rootKey + CONAN_FILE_PATH, QString("conan")).toString());
+}
+
+void ConanSettings::toSettings(QSettings *settings) const
+{
+ settings->beginGroup(QString(SETTINGS_KEY));
+ settings->endGroup();
+}
+
+}
+}
diff --git a/src/plugins/conan/conansettings.h b/src/plugins/conan/conansettings.h
new file mode 100644
index 0000000000..c21b09a0d2
--- /dev/null
+++ b/src/plugins/conan/conansettings.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <utils/fileutils.h>
+
+#include <QSettings>
+
+namespace ConanPackageManager {
+namespace Internal {
+
+class ConanSettings
+{
+public:
+ ConanSettings() = default;
+ void fromSettings(QSettings *settings);
+ void toSettings(QSettings *settings) const;
+
+ Utils::FilePath conanFilePath() const { return m_conanFilePath; }
+
+private:
+ Utils::FilePath m_conanFilePath;
+};
+
+}
+}