forked from qt-creator/qt-creator
Coco: Remove hard dependency on Qmake and CMake
Change-Id: Ieea8c873da56dfabcbcc97fb0853a5ff6de0dea1 Reviewed-by: Markus Redeker <markus.redeker@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -15,16 +15,12 @@ class MacroExpander;
|
||||
class OutputLineParser;
|
||||
} // namespace Utils
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
}
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
class CMakeBuildSystem;
|
||||
}
|
||||
namespace ProjectExplorer { class Project; }
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeBuildSystem;
|
||||
|
||||
class BuildDirParameters
|
||||
{
|
||||
public:
|
||||
|
@@ -1854,11 +1854,39 @@ QStringList CMakeBuildConfiguration::initialCMakeOptions() const
|
||||
return initialCMakeArguments.allValues();
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setInitialArgs(const QStringList &args)
|
||||
{
|
||||
setInitialCMakeArguments(args);
|
||||
}
|
||||
|
||||
QStringList CMakeBuildConfiguration::initialArgs() const
|
||||
{
|
||||
return initialCMakeOptions();
|
||||
}
|
||||
|
||||
QStringList CMakeBuildConfiguration::additionalArgs() const
|
||||
{
|
||||
return additionalCMakeArguments();
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::reconfigure()
|
||||
{
|
||||
cmakeBuildSystem()->clearCMakeCache();
|
||||
updateInitialCMakeArguments();
|
||||
cmakeBuildSystem()->runCMake();
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::stopReconfigure()
|
||||
{
|
||||
cmakeBuildSystem()->stopCMakeRun();
|
||||
}
|
||||
|
||||
CMakeConfig CMakeBuildConfiguration::signingFlags() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
void CMakeBuildConfiguration::setInitialBuildAndCleanSteps(const Target *target)
|
||||
{
|
||||
const CMakeConfigItem presetItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(
|
||||
|
@@ -14,10 +14,10 @@
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
class CMakeProject;
|
||||
class CMakeBuildSystem;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CMakeBuildSystem;
|
||||
class CMakeBuildSettingsWidget;
|
||||
class CMakeProjectImporter;
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
void setRestrictedBuildTarget(const QString &buildTarget);
|
||||
|
||||
Utils::Environment configureEnvironment() const;
|
||||
CMakeBuildSystem *cmakeBuildSystem() const;
|
||||
Internal::CMakeBuildSystem *cmakeBuildSystem() const;
|
||||
|
||||
QStringList additionalCMakeArguments() const;
|
||||
void setAdditionalCMakeArguments(const QStringList &args);
|
||||
@@ -93,6 +93,12 @@ public:
|
||||
void updateInitialCMakeArguments();
|
||||
QStringList initialCMakeOptions() const;
|
||||
|
||||
void setInitialArgs(const QStringList &args) override;
|
||||
QStringList initialArgs() const override;
|
||||
QStringList additionalArgs() const override;
|
||||
void reconfigure() override;
|
||||
void stopReconfigure() override;
|
||||
|
||||
signals:
|
||||
void signingFlagsChanged();
|
||||
void configureEnvironmentChanged();
|
||||
@@ -108,12 +114,12 @@ private:
|
||||
void setBuildPresetToBuildSteps(const ProjectExplorer::Target *target);
|
||||
void filterConfigArgumentsFromAdditionalCMakeArguments();
|
||||
|
||||
CMakeBuildSystem *m_buildSystem = nullptr;
|
||||
Internal::CMakeBuildSettingsWidget *m_configWidget = nullptr;
|
||||
Internal::CMakeBuildSystem *m_buildSystem = nullptr;
|
||||
QStringList m_unrestrictedBuildTargets;
|
||||
Internal::CMakeBuildSettingsWidget *m_configWidget = nullptr;
|
||||
|
||||
friend class Internal::CMakeBuildSettingsWidget;
|
||||
friend class CMakeBuildSystem;
|
||||
friend class Internal::CMakeBuildSystem;
|
||||
};
|
||||
|
||||
class CMAKE_EXPORT CMakeBuildConfigurationFactory
|
||||
|
@@ -62,9 +62,8 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
static Q_LOGGING_CATEGORY(cmakeBuildSystemLog, "qtc.cmake.buildsystem", QtWarningMsg);
|
||||
|
||||
@@ -2524,4 +2523,4 @@ ExtraCompiler *CMakeBuildSystem::findExtraCompiler(const ExtraCompilerFilter &fi
|
||||
return Utils::findOrDefault(m_extraCompilers, filter);
|
||||
}
|
||||
|
||||
} // CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
@@ -29,11 +29,13 @@ namespace CMakeProjectManager {
|
||||
class CMakeBuildConfiguration;
|
||||
class CMakeProject;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeBuildSystem:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
class CMAKE_EXPORT CMakeBuildSystem final : public ProjectExplorer::BuildSystem
|
||||
class CMakeBuildSystem final : public ProjectExplorer::BuildSystem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -134,8 +136,6 @@ public:
|
||||
signals:
|
||||
void configurationCleared();
|
||||
void configurationChanged(const CMakeConfig &config);
|
||||
void errorOccurred(const QString &message);
|
||||
void warningOccurred(const QString &message);
|
||||
|
||||
private:
|
||||
CMakeConfig initialCMakeConfiguration() const;
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
Utils::FilePaths *);
|
||||
bool addTsFiles(ProjectExplorer::Node *context, const Utils::FilePaths &filePaths,
|
||||
Utils::FilePaths *);
|
||||
bool renameFile(Internal::CMakeTargetNode *context,
|
||||
bool renameFile(CMakeTargetNode *context,
|
||||
const Utils::FilePath &oldFilePath,
|
||||
const Utils::FilePath &newFilePath, bool &shouldRunCMake);
|
||||
|
||||
@@ -173,10 +173,10 @@ private:
|
||||
};
|
||||
void reparse(int reparseParameters);
|
||||
QString reparseParametersString(int reparseFlags);
|
||||
void setParametersAndRequestParse(const Internal::BuildDirParameters ¶meters,
|
||||
void setParametersAndRequestParse(const BuildDirParameters ¶meters,
|
||||
const int reparseParameters);
|
||||
|
||||
bool mustApplyConfigurationChangesArguments(const Internal::BuildDirParameters ¶meters) const;
|
||||
bool mustApplyConfigurationChangesArguments(const BuildDirParameters ¶meters) const;
|
||||
|
||||
// State handling:
|
||||
// Parser states:
|
||||
@@ -206,7 +206,7 @@ private:
|
||||
|
||||
void wireUpConnections();
|
||||
|
||||
void ensureBuildDirectory(const Internal::BuildDirParameters ¶meters);
|
||||
void ensureBuildDirectory(const BuildDirParameters ¶meters);
|
||||
void stopParsingAndClearState();
|
||||
void becameDirty();
|
||||
|
||||
@@ -241,7 +241,7 @@ private:
|
||||
ProjectExplorer::ProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
|
||||
QList<CMakeBuildTarget> m_buildTargets;
|
||||
QSet<Internal::CMakeFileInfo> m_cmakeFiles;
|
||||
QSet<CMakeFileInfo> m_cmakeFiles;
|
||||
QHash<QString, Utils::Link> m_cmakeSymbolsHash;
|
||||
QHash<QString, Utils::Link> m_dotCMakeFilesHash;
|
||||
QHash<QString, Utils::Link> m_findPackagesFilesHash;
|
||||
@@ -252,9 +252,9 @@ private:
|
||||
QHash<QString, ProjectFileArgumentPosition> m_filesToBeRenamed;
|
||||
|
||||
// Parsing state:
|
||||
Internal::BuildDirParameters m_parameters;
|
||||
BuildDirParameters m_parameters;
|
||||
int m_reparseParameters = REPARSE_DEFAULT;
|
||||
Internal::FileApiReader m_reader;
|
||||
FileApiReader m_reader;
|
||||
mutable bool m_isHandlingError = false;
|
||||
|
||||
// CTest integration
|
||||
@@ -269,4 +269,5 @@ private:
|
||||
QString m_warning;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
@@ -3,49 +3,47 @@ add_qtc_plugin(Coco
|
||||
QtCreator::Core
|
||||
QtCreator::LanguageClient
|
||||
QtCreator::ProjectExplorer
|
||||
QtCreator::QmakeProjectManager
|
||||
DEPENDS
|
||||
QtCreator::CMakeProjectManager
|
||||
QtCreator::ExtensionSystem
|
||||
SOURCES
|
||||
Coco.json.in
|
||||
cocobuild/buildsettings.cpp
|
||||
cocobuild/buildsettings.h
|
||||
cocobuild/cmakemodificationfile.cpp
|
||||
cocobuild/cmakemodificationfile.h
|
||||
cocobuild/cococmakesettings.cpp
|
||||
cocobuild/cococmakesettings.h
|
||||
cocobuild/cocobuildstep.cpp
|
||||
cocobuild/cocobuildstep.h
|
||||
cocobuild/cocoprojectwidget.cpp
|
||||
cocobuild/cocoprojectwidget.h
|
||||
cocobuild/modificationfile.cpp
|
||||
cocobuild/modificationfile.h
|
||||
cocobuild/qmakefeaturefile.cpp
|
||||
cocobuild/qmakefeaturefile.h
|
||||
cocobuild/cocoqmakesettings.cpp
|
||||
cocobuild/cocoqmakesettings.h
|
||||
buildsettings.cpp
|
||||
buildsettings.h
|
||||
cmakemodificationfile.cpp
|
||||
cmakemodificationfile.h
|
||||
cocobuildstep.cpp
|
||||
cocobuildstep.h
|
||||
cococmakesettings.cpp
|
||||
cococmakesettings.h
|
||||
cococommon.cpp
|
||||
cococommon.h
|
||||
cocoinstallation.cpp
|
||||
cocoinstallation.h
|
||||
cocolanguageclient.cpp
|
||||
cocolanguageclient.h
|
||||
cocoplugin.cpp
|
||||
cocoplugin.qrc
|
||||
cocoplugin_global.h
|
||||
cocopluginconstants.h
|
||||
cocoprojectsettingswidget.cpp
|
||||
cocoprojectsettingswidget.h
|
||||
cocoprojectwidget.cpp
|
||||
cocoprojectwidget.h
|
||||
cocoqmakesettings.cpp
|
||||
cocoqmakesettings.h
|
||||
cocotr.h
|
||||
common.cpp
|
||||
common.h
|
||||
files/cocoplugin-clang.cmake
|
||||
files/cocoplugin-gcc.cmake
|
||||
files/cocoplugin-visualstudio.cmake
|
||||
files/cocoplugin.cmake
|
||||
files/cocoplugin.prf
|
||||
globalsettings.cpp
|
||||
globalsettings.h
|
||||
globalsettingspage.cpp
|
||||
globalsettingspage.h
|
||||
images/SquishCoco_48x48.png
|
||||
settings/cocoinstallation.cpp
|
||||
settings/cocoinstallation.h
|
||||
settings/cocoprojectsettingswidget.cpp
|
||||
settings/cocoprojectsettingswidget.h
|
||||
settings/globalsettings.cpp
|
||||
settings/globalsettings.h
|
||||
settings/globalsettingspage.cpp
|
||||
settings/globalsettingspage.h
|
||||
modificationfile.cpp
|
||||
modificationfile.h
|
||||
qmakefeaturefile.cpp
|
||||
qmakefeaturefile.h
|
||||
)
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
||||
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
bool BuildSettings::supportsBuildConfig(const ProjectExplorer::BuildConfiguration &config)
|
||||
@@ -21,19 +23,18 @@ bool BuildSettings::supportsBuildConfig(const ProjectExplorer::BuildConfiguratio
|
||||
|| config.id() == CMakeProjectManager::Constants::CMAKE_BUILDCONFIGURATION_ID;
|
||||
}
|
||||
|
||||
BuildSettings *BuildSettings::createdFor(const ProjectExplorer::BuildConfiguration &config)
|
||||
BuildSettings *BuildSettings::createdFor(BuildConfiguration *buildConfig)
|
||||
{
|
||||
if (config.id() == QmakeProjectManager::Constants::QMAKE_BC_ID)
|
||||
return new CocoQMakeSettings{config.project()};
|
||||
else if (config.id() == CMakeProjectManager::Constants::CMAKE_BUILDCONFIGURATION_ID)
|
||||
return new CocoCMakeSettings{config.project()};
|
||||
else
|
||||
if (buildConfig->id() == QmakeProjectManager::Constants::QMAKE_BC_ID)
|
||||
return createCocoQMakeSettings(buildConfig);
|
||||
if (buildConfig->id() == CMakeProjectManager::Constants::CMAKE_BUILDCONFIGURATION_ID)
|
||||
return createCocoCMakeSettings(buildConfig);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BuildSettings::BuildSettings(ModificationFile &featureFile, ProjectExplorer::Project *project)
|
||||
BuildSettings::BuildSettings(ModificationFile &featureFile, BuildConfiguration *buildConfig)
|
||||
: m_featureFile{featureFile}
|
||||
, m_project{*project}
|
||||
, m_buildConfig{buildConfig}
|
||||
{
|
||||
// Do not use m_featureFile in the constructor; it may not yet be valid.
|
||||
}
|
||||
@@ -41,7 +42,7 @@ BuildSettings::BuildSettings(ModificationFile &featureFile, ProjectExplorer::Pro
|
||||
void BuildSettings::connectToBuildStep(CocoBuildStep *step) const
|
||||
{
|
||||
connect(
|
||||
activeTarget(),
|
||||
buildConfig()->target(),
|
||||
&ProjectExplorer::Target::buildSystemUpdated,
|
||||
step,
|
||||
&CocoBuildStep::buildSystemUpdated);
|
||||
@@ -93,9 +94,9 @@ void BuildSettings::setEnabled(bool enabled)
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
ProjectExplorer::Target *BuildSettings::activeTarget() const
|
||||
BuildConfiguration *BuildSettings::buildConfig() const
|
||||
{
|
||||
return m_project.activeTarget();
|
||||
return m_buildConfig;
|
||||
}
|
||||
|
||||
} // namespace Coco::Internal
|
@@ -23,9 +23,9 @@ class BuildSettings : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
static bool supportsBuildConfig(const ProjectExplorer::BuildConfiguration &config);
|
||||
static BuildSettings *createdFor(const ProjectExplorer::BuildConfiguration &config);
|
||||
static BuildSettings *createdFor(ProjectExplorer::BuildConfiguration *config);
|
||||
|
||||
explicit BuildSettings(ModificationFile &featureFile, ProjectExplorer::Project *project);
|
||||
BuildSettings(ModificationFile &featureFile, ProjectExplorer::BuildConfiguration *buildConfig);
|
||||
virtual ~BuildSettings() {}
|
||||
|
||||
void connectToBuildStep(CocoBuildStep *step) const;
|
||||
@@ -56,11 +56,11 @@ public:
|
||||
protected:
|
||||
QString tableRow(const QString &name, const QString &value) const;
|
||||
void setEnabled(bool enabled);
|
||||
ProjectExplorer::Target *activeTarget() const;
|
||||
ProjectExplorer::BuildConfiguration *buildConfig() const;
|
||||
|
||||
private:
|
||||
ModificationFile &m_featureFile;
|
||||
ProjectExplorer::Project &m_project;
|
||||
ProjectExplorer::BuildConfiguration *m_buildConfig;
|
||||
bool m_enabled = false;
|
||||
};
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "cmakemodificationfile.h"
|
||||
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "cocopluginconstants.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -16,25 +16,11 @@ using namespace ProjectExplorer;
|
||||
static const char flagsSetting[] = "set(coverage_flags_list\n";
|
||||
static const char tweaksLine[] = "# User-supplied settings follow here:\n";
|
||||
|
||||
CMakeModificationFile::CMakeModificationFile(Project *project)
|
||||
: m_project{project}
|
||||
CMakeModificationFile::CMakeModificationFile(ProjectExplorer::Project *project)
|
||||
: ModificationFile{QString(Constants::PROFILE_NAME) + ".cmake", ":/cocoplugin/files/cocoplugin.cmake"}
|
||||
, m_project{project}
|
||||
{}
|
||||
|
||||
QString CMakeModificationFile::fileName() const
|
||||
{
|
||||
return QString(Constants::PROFILE_NAME) + ".cmake";
|
||||
}
|
||||
|
||||
void CMakeModificationFile::setProjectDirectory(const Utils::FilePath &projectDirectory)
|
||||
{
|
||||
setFilePath(projectDirectory.pathAppended(fileName()));
|
||||
}
|
||||
|
||||
QStringList CMakeModificationFile::defaultModificationFile() const
|
||||
{
|
||||
return contentOf(":/cocoplugin/files/cocoplugin.cmake");
|
||||
}
|
||||
|
||||
void CMakeModificationFile::read()
|
||||
{
|
||||
clear();
|
@@ -16,14 +16,8 @@ class CMakeModificationFile : public ModificationFile
|
||||
public:
|
||||
CMakeModificationFile(ProjectExplorer::Project *project);
|
||||
|
||||
void read() override;
|
||||
void write() const override;
|
||||
|
||||
QString fileName() const override;
|
||||
void setProjectDirectory(const Utils::FilePath &projectDirectory) override;
|
||||
|
||||
protected:
|
||||
QStringList defaultModificationFile() const override;
|
||||
void read();
|
||||
void write() const;
|
||||
|
||||
private:
|
||||
ProjectExplorer::Project *m_project;
|
@@ -5,55 +5,53 @@ QtcPlugin {
|
||||
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "LanguageClient" }
|
||||
Depends { name: "CMakeProjectManager" }
|
||||
Depends { name: "ExtensionSystem" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "QmakeProjectManager" }
|
||||
Depends { name: "TextEditor" }
|
||||
Depends { name: "Utils" }
|
||||
|
||||
Depends { name: "Qt"; submodules: ["widgets"] }
|
||||
|
||||
files: [
|
||||
"cocobuild/buildsettings.cpp",
|
||||
"cocobuild/buildsettings.h",
|
||||
"cocobuild/cmakemodificationfile.cpp",
|
||||
"cocobuild/cmakemodificationfile.h",
|
||||
"cocobuild/cocobuildstep.cpp",
|
||||
"cocobuild/cocobuildstep.h",
|
||||
"cocobuild/cococmakesettings.cpp",
|
||||
"cocobuild/cococmakesettings.h",
|
||||
"cocobuild/cocoprojectwidget.cpp",
|
||||
"cocobuild/cocoprojectwidget.h",
|
||||
"cocobuild/cocoqmakesettings.cpp",
|
||||
"cocobuild/cocoqmakesettings.h",
|
||||
"cocobuild/modificationfile.cpp",
|
||||
"cocobuild/modificationfile.h",
|
||||
"cocobuild/qmakefeaturefile.cpp",
|
||||
"cocobuild/qmakefeaturefile.h",
|
||||
"buildsettings.cpp",
|
||||
"buildsettings.h",
|
||||
"cmakemodificationfile.cpp",
|
||||
"cmakemodificationfile.h",
|
||||
"cocobuildstep.cpp",
|
||||
"cocobuildstep.h",
|
||||
"cococmakesettings.cpp",
|
||||
"cococmakesettings.h",
|
||||
"cococommon.cpp",
|
||||
"cococommon.h",
|
||||
"cocoinstallation.cpp",
|
||||
"cocoinstallation.h",
|
||||
"cocolanguageclient.cpp",
|
||||
"cocolanguageclient.h",
|
||||
"cocoplugin.cpp",
|
||||
"cocoplugin.qrc",
|
||||
"cocoplugin_global.h",
|
||||
"cocopluginconstants.h",
|
||||
"cocoprojectsettingswidget.cpp",
|
||||
"cocoprojectsettingswidget.h",
|
||||
"cocoprojectwidget.cpp",
|
||||
"cocoprojectwidget.h",
|
||||
"cocoqmakesettings.cpp",
|
||||
"cocoqmakesettings.h",
|
||||
"cocotr.h",
|
||||
"common.cpp",
|
||||
"common.h",
|
||||
"files/cocoplugin-clang.cmake",
|
||||
"files/cocoplugin-gcc.cmake",
|
||||
"files/cocoplugin-visualstudio.cmake",
|
||||
"files/cocoplugin.cmake",
|
||||
"files/cocoplugin.prf",
|
||||
"globalsettings.cpp",
|
||||
"globalsettings.h",
|
||||
"globalsettingspage.cpp",
|
||||
"globalsettingspage.h",
|
||||
"images/SquishCoco_48x48.png",
|
||||
"settings/cocoinstallation.cpp",
|
||||
"settings/cocoinstallation.h",
|
||||
"settings/cocoprojectsettingswidget.cpp",
|
||||
"settings/cocoprojectsettingswidget.h",
|
||||
"settings/globalsettings.cpp",
|
||||
"settings/globalsettings.h",
|
||||
"settings/globalsettingspage.cpp",
|
||||
"settings/globalsettingspage.h",
|
||||
"modificationfile.cpp",
|
||||
"modificationfile.h",
|
||||
"qmakefeaturefile.cpp",
|
||||
"qmakefeaturefile.h",
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -1,51 +0,0 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "buildsettings.h"
|
||||
#include "cmakemodificationfile.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
class CMakeBuildConfiguration;
|
||||
class CMakeConfig;
|
||||
}
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
class CocoProjectWidget;
|
||||
|
||||
class CocoCMakeSettings : public BuildSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CocoCMakeSettings(ProjectExplorer::Project *project);
|
||||
~CocoCMakeSettings() override;
|
||||
|
||||
void connectToProject(CocoProjectWidget *parent) const override;
|
||||
void read() override;
|
||||
bool validSettings() const override;
|
||||
void setCoverage(bool on) override;
|
||||
|
||||
QString saveButtonText() const override;
|
||||
QString configChanges() const override;
|
||||
bool needsReconfigure() const override { return true; }
|
||||
void reconfigure() override;
|
||||
void stopReconfigure() override;
|
||||
|
||||
QString projectDirectory() const override;
|
||||
void write(const QString &options, const QString &tweaks) override;
|
||||
|
||||
private:
|
||||
bool hasInitialCacheOption(const QStringList &args) const;
|
||||
QString initialCacheOption() const;
|
||||
void writeToolchainFile(const QString &internalPath);
|
||||
|
||||
CMakeProjectManager::CMakeBuildConfiguration *m_buildConfig;
|
||||
CMakeModificationFile m_featureFile;
|
||||
};
|
||||
|
||||
} // namespace Coco::Internal
|
@@ -1,56 +0,0 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../settings/cocoinstallation.h"
|
||||
#include "buildsettings.h"
|
||||
#include "qmakefeaturefile.h"
|
||||
|
||||
#include <utils/commandline.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
class QMakeStep;
|
||||
class QmakeBuildConfiguration;
|
||||
}
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
class CocoProjectWidget;
|
||||
|
||||
class CocoQMakeSettings : public BuildSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CocoQMakeSettings(ProjectExplorer::Project *project);
|
||||
~CocoQMakeSettings() override;
|
||||
|
||||
void read() override;
|
||||
bool validSettings() const override;
|
||||
void setCoverage(bool on) override;
|
||||
|
||||
QString saveButtonText() const override;
|
||||
QString configChanges() const override;
|
||||
QString projectDirectory() const override;
|
||||
void write(const QString &options, const QString &tweaks) override;
|
||||
|
||||
private:
|
||||
bool environmentSet() const;
|
||||
QString pathAssignment() const;
|
||||
const QStringList userArgumentList() const;
|
||||
Utils::Environment buildEnvironment() const;
|
||||
void setQMakeFeatures() const;
|
||||
bool cocoPathValid() const;
|
||||
|
||||
QmakeProjectManager::QmakeBuildConfiguration *m_buildConfig;
|
||||
QmakeProjectManager::QMakeStep *m_qmakeStep;
|
||||
|
||||
QMakeFeatureFile m_featureFile;
|
||||
CocoInstallation m_coco;
|
||||
};
|
||||
|
||||
} // namespace Coco::Internal
|
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "cocobuildstep.h"
|
||||
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "../cocotr.h"
|
||||
#include "../settings/cocoinstallation.h"
|
||||
#include "cocoinstallation.h"
|
||||
#include "cocopluginconstants.h"
|
||||
#include "cocotr.h"
|
||||
|
||||
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -109,7 +109,7 @@ void CocoBuildStep::display(BuildConfiguration *buildConfig)
|
||||
{
|
||||
Q_ASSERT( m_buildSettings.isNull() );
|
||||
|
||||
m_buildSettings = BuildSettings::createdFor(*buildConfig);
|
||||
m_buildSettings = BuildSettings::createdFor(buildConfig);
|
||||
m_buildSettings->read();
|
||||
m_buildSettings->connectToBuildStep(this);
|
||||
|
@@ -3,33 +3,64 @@
|
||||
|
||||
#include "cococmakesettings.h"
|
||||
|
||||
#include "../cocotr.h"
|
||||
#include "../common.h"
|
||||
#include "buildsettings.h"
|
||||
#include "cmakemodificationfile.h"
|
||||
#include "cococommon.h"
|
||||
#include "cocoprojectwidget.h"
|
||||
#include "cocotr.h"
|
||||
|
||||
#include <cmakeprojectmanager/cmakebuildconfiguration.h>
|
||||
#include <cmakeprojectmanager/cmakebuildsystem.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
CocoCMakeSettings::CocoCMakeSettings(Project *project)
|
||||
: BuildSettings{m_featureFile, project}
|
||||
, m_featureFile{project}
|
||||
class CocoCMakeSettings : public BuildSettings
|
||||
{
|
||||
public:
|
||||
explicit CocoCMakeSettings(BuildConfiguration *bc)
|
||||
: BuildSettings{m_featureFile, bc}
|
||||
, m_featureFile{bc->project()}
|
||||
{}
|
||||
|
||||
CocoCMakeSettings::~CocoCMakeSettings() {}
|
||||
void connectToProject(CocoProjectWidget *parent) const override;
|
||||
void read() override;
|
||||
bool validSettings() const override;
|
||||
void setCoverage(bool on) override;
|
||||
|
||||
QString saveButtonText() const override;
|
||||
QString configChanges() const override;
|
||||
bool needsReconfigure() const override { return true; }
|
||||
void reconfigure() override;
|
||||
void stopReconfigure() override;
|
||||
|
||||
QString projectDirectory() const override;
|
||||
void write(const QString &options, const QString &tweaks) override;
|
||||
|
||||
private:
|
||||
bool hasInitialCacheOption(const QStringList &args) const;
|
||||
QString initialCacheOption() const;
|
||||
void writeToolchainFile(const QString &internalPath);
|
||||
|
||||
CMakeModificationFile m_featureFile;
|
||||
};
|
||||
|
||||
void CocoCMakeSettings::connectToProject(CocoProjectWidget *parent) const
|
||||
{
|
||||
connect(
|
||||
activeTarget(), &Target::buildSystemUpdated, parent, &CocoProjectWidget::buildSystemUpdated);
|
||||
buildConfig()->target(),
|
||||
&Target::buildSystemUpdated,
|
||||
parent,
|
||||
&CocoProjectWidget::buildSystemUpdated);
|
||||
connect(
|
||||
qobject_cast<CMakeProjectManager::CMakeBuildSystem *>(activeTarget()->buildSystem()),
|
||||
&CMakeProjectManager::CMakeBuildSystem::errorOccurred,
|
||||
buildConfig()->buildSystem(),
|
||||
&ProjectExplorer::BuildSystem::errorOccurred,
|
||||
parent,
|
||||
&CocoProjectWidget::configurationErrorOccurred);
|
||||
}
|
||||
@@ -37,15 +68,10 @@ void CocoCMakeSettings::connectToProject(CocoProjectWidget *parent) const
|
||||
void CocoCMakeSettings::read()
|
||||
{
|
||||
setEnabled(false);
|
||||
if (Target *target = activeTarget()) {
|
||||
if ((m_buildConfig = qobject_cast<CMakeBuildConfiguration *>(
|
||||
target->activeBuildConfiguration()))) {
|
||||
m_featureFile.setProjectDirectory(m_buildConfig->project()->projectDirectory());
|
||||
m_featureFile.setFilePath(buildConfig());
|
||||
m_featureFile.read();
|
||||
setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString CocoCMakeSettings::initialCacheOption() const
|
||||
{
|
||||
@@ -67,8 +93,8 @@ bool CocoCMakeSettings::hasInitialCacheOption(const QStringList &args) const
|
||||
|
||||
bool CocoCMakeSettings::validSettings() const
|
||||
{
|
||||
return enabled() && m_featureFile.exists()
|
||||
&& hasInitialCacheOption(m_buildConfig->additionalCMakeArguments());
|
||||
const QStringList args = buildConfig()->additionalArgs();
|
||||
return enabled() && m_featureFile.exists() && hasInitialCacheOption(args);
|
||||
}
|
||||
|
||||
void CocoCMakeSettings::setCoverage(bool on)
|
||||
@@ -76,7 +102,7 @@ void CocoCMakeSettings::setCoverage(bool on)
|
||||
if (!enabled())
|
||||
return;
|
||||
|
||||
auto values = m_buildConfig->initialCMakeOptions();
|
||||
QStringList values = buildConfig()->initialArgs();
|
||||
QStringList args = Utils::filtered(values, [&](const QString &option) {
|
||||
return !(option.startsWith("-C") && option.endsWith(featureFilenName()));
|
||||
});
|
||||
@@ -84,7 +110,7 @@ void CocoCMakeSettings::setCoverage(bool on)
|
||||
if (on)
|
||||
args << QString("-C%1").arg(m_featureFile.nativePath());
|
||||
|
||||
m_buildConfig->setInitialCMakeArguments(args);
|
||||
buildConfig()->setInitialArgs(args);
|
||||
}
|
||||
|
||||
QString CocoCMakeSettings::saveButtonText() const
|
||||
@@ -95,30 +121,27 @@ QString CocoCMakeSettings::saveButtonText() const
|
||||
QString CocoCMakeSettings::configChanges() const
|
||||
{
|
||||
return "<table><tbody>"
|
||||
+ tableRow("Additional CMake options: ", maybeQuote(initialCacheOption()))
|
||||
+ tableRow("Initial cache script: ", maybeQuote(featureFilePath())) + "</tbody></table>";
|
||||
+ tableRow(Tr::tr("Additional CMake options: "), maybeQuote(initialCacheOption()))
|
||||
+ tableRow(Tr::tr("Initial cache script: "), maybeQuote(featureFilePath()))
|
||||
+ "</tbody></table>";
|
||||
}
|
||||
|
||||
void CocoCMakeSettings::reconfigure()
|
||||
{
|
||||
if (!enabled())
|
||||
return;
|
||||
|
||||
m_buildConfig->cmakeBuildSystem()->clearCMakeCache();
|
||||
m_buildConfig->updateInitialCMakeArguments();
|
||||
m_buildConfig->cmakeBuildSystem()->runCMake();
|
||||
if (enabled())
|
||||
buildConfig()->reconfigure();
|
||||
}
|
||||
|
||||
void Coco::Internal::CocoCMakeSettings::stopReconfigure()
|
||||
{
|
||||
if (enabled())
|
||||
m_buildConfig->cmakeBuildSystem()->stopCMakeRun();
|
||||
buildConfig()->stopReconfigure();
|
||||
}
|
||||
|
||||
QString CocoCMakeSettings::projectDirectory() const
|
||||
{
|
||||
if (enabled())
|
||||
return m_buildConfig->project()->projectDirectory().path();
|
||||
return buildConfig()->project()->projectDirectory().path();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
@@ -136,7 +159,7 @@ void CocoCMakeSettings::write(const QString &options, const QString &tweaks)
|
||||
|
||||
void CocoCMakeSettings::writeToolchainFile(const QString &internalPath)
|
||||
{
|
||||
const Utils::FilePath projectDirectory = m_buildConfig->project()->projectDirectory();
|
||||
const Utils::FilePath projectDirectory = buildConfig()->project()->projectDirectory();
|
||||
|
||||
QFile internalFile{internalPath};
|
||||
internalFile.open(QIODeviceBase::ReadOnly);
|
||||
@@ -164,4 +187,9 @@ void CocoCMakeSettings::writeToolchainFile(const QString &internalPath)
|
||||
out.close();
|
||||
}
|
||||
|
||||
BuildSettings *createCocoCMakeSettings(BuildConfiguration *bc)
|
||||
{
|
||||
return new CocoCMakeSettings(bc);
|
||||
}
|
||||
|
||||
} // namespace Coco::Internal
|
15
src/plugins/coco/cococmakesettings.h
Normal file
15
src/plugins/coco/cococmakesettings.h
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ProjectExplorer { class BuildConfiguration; }
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
class BuildSettings;
|
||||
|
||||
BuildSettings *createCocoCMakeSettings(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
} // namespace Coco::Internal
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "common.h"
|
||||
#include "cococommon.h"
|
||||
|
||||
#include "cocopluginconstants.h"
|
||||
|
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "cocoinstallation.h"
|
||||
|
||||
#include "../cocotr.h"
|
||||
#include "../common.h"
|
||||
#include "cococommon.h"
|
||||
#include "cocotr.h"
|
||||
#include "globalsettings.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
@@ -1,13 +1,13 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cocobuild/cocobuildstep.h"
|
||||
#include "cocobuildstep.h"
|
||||
#include "cocolanguageclient.h"
|
||||
#include "cocopluginconstants.h"
|
||||
#include "cocoprojectsettingswidget.h"
|
||||
#include "cocotr.h"
|
||||
#include "settings/cocoprojectsettingswidget.h"
|
||||
#include "settings/globalsettings.h"
|
||||
#include "settings/globalsettingspage.h"
|
||||
#include "globalsettings.h"
|
||||
#include "globalsettingspage.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
|
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "cocoprojectsettingswidget.h"
|
||||
|
||||
#include "../cocobuild/cocoprojectwidget.h"
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "cocopluginconstants.h"
|
||||
#include "cocoprojectwidget.h"
|
||||
|
||||
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
@@ -27,7 +27,7 @@ CocoProjectSettingsWidget::CocoProjectSettingsWidget(ProjectExplorer::Project *p
|
||||
|
||||
if (abc->id() == QmakeProjectManager::Constants::QMAKE_BC_ID
|
||||
|| abc->id() == CMakeProjectManager::Constants::CMAKE_BUILDCONFIGURATION_ID)
|
||||
m_layout->addWidget(new CocoProjectWidget(project, *abc));
|
||||
m_layout->addWidget(new CocoProjectWidget(project, abc));
|
||||
}
|
||||
setLayout(m_layout);
|
||||
}
|
@@ -3,11 +3,11 @@
|
||||
|
||||
#include "cocoprojectwidget.h"
|
||||
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "../cocotr.h"
|
||||
#include "../common.h"
|
||||
#include "../settings/globalsettingspage.h"
|
||||
#include "buildsettings.h"
|
||||
#include "cococommon.h"
|
||||
#include "cocopluginconstants.h"
|
||||
#include "cocotr.h"
|
||||
#include "globalsettingspage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
@@ -20,9 +20,9 @@ using namespace Core;
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
CocoProjectWidget::CocoProjectWidget(Project *project, const BuildConfiguration &buildConfig)
|
||||
CocoProjectWidget::CocoProjectWidget(Project *project, BuildConfiguration *buildConfig)
|
||||
: m_project{project}
|
||||
, m_buildConfigurationName{buildConfig.displayName()}
|
||||
, m_buildConfigurationName{buildConfig->displayName()}
|
||||
{
|
||||
using namespace Layouting;
|
||||
using namespace Utils;
|
||||
@@ -142,7 +142,7 @@ void CocoProjectWidget::configurationErrorOccurred(const QString &error)
|
||||
// The variable error seems to contain no usable information.
|
||||
setMessageLabel(
|
||||
Utils::InfoLabel::Error,
|
||||
Tr::tr("Error when configuring with \"%1\". "
|
||||
Tr::tr("Error when configuring with <i>%1</i>. "
|
||||
"Check General Messages for more information.")
|
||||
.arg(m_buildSettings->featureFilenName()));
|
||||
setState(configDone);
|
@@ -3,8 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../settings/cocoinstallation.h"
|
||||
#include "buildsettings.h"
|
||||
#include "cocoinstallation.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <utils/aspects.h>
|
||||
@@ -26,8 +26,7 @@ class CocoProjectWidget : public QWidget
|
||||
public:
|
||||
enum ConfigurationState { configDone, configEdited, configRunning, configStopped };
|
||||
|
||||
explicit CocoProjectWidget(
|
||||
ProjectExplorer::Project *project, const ProjectExplorer::BuildConfiguration &buildConfig);
|
||||
explicit CocoProjectWidget(ProjectExplorer::Project *project, ProjectExplorer::BuildConfiguration *buildConfig);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event) override;
|
@@ -3,42 +3,63 @@
|
||||
|
||||
#include "cocoqmakesettings.h"
|
||||
|
||||
#include "../cocobuild/cocoprojectwidget.h"
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "../cocotr.h"
|
||||
#include "../common.h"
|
||||
#include "buildsettings.h"
|
||||
#include "cococommon.h"
|
||||
#include "cocoinstallation.h"
|
||||
#include "cocopluginconstants.h"
|
||||
#include "cocoprojectwidget.h"
|
||||
#include "cocotr.h"
|
||||
#include "qmakefeaturefile.h"
|
||||
|
||||
#include <utils/commandline.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
|
||||
#include <qmakeprojectmanager/qmakestep.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
CocoQMakeSettings::CocoQMakeSettings(Project *project)
|
||||
: BuildSettings{m_featureFile, project}
|
||||
class CocoQMakeSettings : public BuildSettings
|
||||
{
|
||||
public:
|
||||
explicit CocoQMakeSettings(BuildConfiguration *buildConfig)
|
||||
: BuildSettings{m_featureFile, buildConfig}
|
||||
{}
|
||||
|
||||
CocoQMakeSettings::~CocoQMakeSettings() {}
|
||||
void read() override;
|
||||
bool validSettings() const override;
|
||||
void setCoverage(bool on) override;
|
||||
|
||||
QString saveButtonText() const override;
|
||||
QString configChanges() const override;
|
||||
QString projectDirectory() const override;
|
||||
void write(const QString &options, const QString &tweaks) override;
|
||||
|
||||
private:
|
||||
bool environmentSet() const;
|
||||
QString pathAssignment() const;
|
||||
const QStringList userArgumentList() const;
|
||||
Utils::Environment buildEnvironment() const;
|
||||
void setQMakeFeatures() const;
|
||||
bool cocoPathValid() const;
|
||||
|
||||
QMakeFeatureFile m_featureFile;
|
||||
CocoInstallation m_coco;
|
||||
};
|
||||
|
||||
void CocoQMakeSettings::read()
|
||||
{
|
||||
setEnabled(false);
|
||||
if (Target *target = activeTarget()) {
|
||||
if ((m_buildConfig = qobject_cast<QmakeProjectManager::QmakeBuildConfiguration*>(target->activeBuildConfiguration()))) {
|
||||
if (BuildStepList *buildSteps = m_buildConfig->buildSteps()) {
|
||||
if ((m_qmakeStep = buildSteps->firstOfType<QmakeProjectManager::QMakeStep>())) {
|
||||
m_featureFile.setProjectDirectory(m_buildConfig->project()->projectDirectory());
|
||||
m_featureFile.setFilePath(buildConfig());
|
||||
m_featureFile.read();
|
||||
setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString configAssignment()
|
||||
{
|
||||
@@ -54,15 +75,7 @@ const QStringList CocoQMakeSettings::userArgumentList() const
|
||||
if (!enabled())
|
||||
return {};
|
||||
|
||||
Utils::ProcessArgs::ConstArgIterator it{m_qmakeStep->userArguments.unexpandedArguments()};
|
||||
QStringList result;
|
||||
|
||||
while (it.next()) {
|
||||
if (it.isSimple())
|
||||
result << it.value();
|
||||
}
|
||||
|
||||
return result;
|
||||
return buildConfig()->initialArgs();
|
||||
}
|
||||
|
||||
Utils::Environment CocoQMakeSettings::buildEnvironment() const
|
||||
@@ -70,8 +83,8 @@ Utils::Environment CocoQMakeSettings::buildEnvironment() const
|
||||
if (!enabled())
|
||||
return Utils::Environment();
|
||||
|
||||
Utils::Environment env = m_buildConfig->environment();
|
||||
env.modify(m_buildConfig->userEnvironmentChanges());
|
||||
Utils::Environment env = buildConfig()->environment();
|
||||
env.modify(buildConfig()->userEnvironmentChanges());
|
||||
return env;
|
||||
}
|
||||
|
||||
@@ -82,15 +95,15 @@ void CocoQMakeSettings::setQMakeFeatures() const
|
||||
|
||||
Utils::Environment env = buildEnvironment();
|
||||
|
||||
const QString projectDir = m_buildConfig->project()->projectDirectory().nativePath();
|
||||
const QString projectDir = buildConfig()->project()->projectDirectory().nativePath();
|
||||
if (env.value(featuresVar) != projectDir) {
|
||||
// Bug in prependOrSet(): It does not recognize if QMAKEFEATURES contains a single path
|
||||
// without a colon and then appends it twice.
|
||||
env.prependOrSet(featuresVar, projectDir);
|
||||
}
|
||||
|
||||
Utils::EnvironmentItems diff = m_buildConfig->baseEnvironment().diff(env);
|
||||
m_buildConfig->setUserEnvironmentChanges(diff);
|
||||
Utils::EnvironmentItems diff = buildConfig()->baseEnvironment().diff(env);
|
||||
buildConfig()->setUserEnvironmentChanges(diff);
|
||||
}
|
||||
|
||||
bool CocoQMakeSettings::environmentSet() const
|
||||
@@ -99,7 +112,7 @@ bool CocoQMakeSettings::environmentSet() const
|
||||
return true;
|
||||
|
||||
const Utils::Environment env = buildEnvironment();
|
||||
const Utils::FilePath projectDir = m_buildConfig->project()->projectDirectory();
|
||||
const Utils::FilePath projectDir = buildConfig()->project()->projectDirectory();
|
||||
const QString nativeProjectDir = projectDir.nativePath();
|
||||
return env.value(featuresVar) == nativeProjectDir
|
||||
|| env.value(featuresVar).startsWith(nativeProjectDir + projectDir.pathListSeparator());
|
||||
@@ -114,25 +127,22 @@ bool CocoQMakeSettings::validSettings() const
|
||||
|
||||
void CocoQMakeSettings::setCoverage(bool on)
|
||||
{
|
||||
QString args = m_qmakeStep->userArguments.unexpandedArguments();
|
||||
Utils::ProcessArgs::ArgIterator it{&args};
|
||||
QStringList args;
|
||||
|
||||
while (it.next()) {
|
||||
if (it.isSimple()) {
|
||||
const QString value = it.value();
|
||||
if (value.startsWith(pathAssignmentPrefix) || value == configAssignment())
|
||||
it.deleteArg();
|
||||
}
|
||||
for (const QString &arg : buildConfig()->initialArgs()) {
|
||||
if (!arg.startsWith(pathAssignmentPrefix) && arg != configAssignment())
|
||||
args.append(arg);
|
||||
}
|
||||
|
||||
if (on) {
|
||||
it.appendArg(configAssignment());
|
||||
it.appendArg(pathAssignment());
|
||||
args.append(configAssignment());
|
||||
args.append(pathAssignment());
|
||||
|
||||
setQMakeFeatures();
|
||||
m_featureFile.write();
|
||||
}
|
||||
|
||||
m_qmakeStep->userArguments.setArguments(args);
|
||||
buildConfig()->setInitialArgs(args);
|
||||
}
|
||||
|
||||
QString CocoQMakeSettings::saveButtonText() const
|
||||
@@ -144,17 +154,18 @@ QString CocoQMakeSettings::configChanges() const
|
||||
{
|
||||
return "<table><tbody>"
|
||||
+ tableRow(
|
||||
"Additional qmake arguments: ",
|
||||
Tr::tr("Additional qmake arguments: "),
|
||||
maybeQuote(configAssignment()) + " " + maybeQuote(pathAssignment()))
|
||||
+ tableRow(
|
||||
"Build environment: ", maybeQuote(QString(featuresVar) + "=" + projectDirectory()))
|
||||
+ tableRow("Feature File: ", maybeQuote(featureFilePath())) + "</tbody></table>";
|
||||
Tr::tr("Build environment: "),
|
||||
maybeQuote(QString(featuresVar) + "=" + projectDirectory()))
|
||||
+ tableRow(Tr::tr("Feature File: "), maybeQuote(featureFilePath())) + "</tbody></table>";
|
||||
}
|
||||
|
||||
QString CocoQMakeSettings::projectDirectory() const
|
||||
{
|
||||
if (enabled())
|
||||
return m_buildConfig->project()->projectDirectory().nativePath();
|
||||
return buildConfig()->project()->projectDirectory().nativePath();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
@@ -173,16 +184,17 @@ QString CocoQMakeSettings::pathAssignment() const
|
||||
|
||||
bool CocoQMakeSettings::cocoPathValid() const
|
||||
{
|
||||
Utils::ProcessArgs::ConstArgIterator it{m_qmakeStep->userArguments.unexpandedArguments()};
|
||||
|
||||
while (it.next()) {
|
||||
if (it.isSimple()) {
|
||||
const QString value = it.value();
|
||||
if (value.startsWith(pathAssignmentPrefix) && value != pathAssignment())
|
||||
for (const QString &arg : buildConfig()->initialArgs()) {
|
||||
if (arg.startsWith(pathAssignmentPrefix) && arg != pathAssignment())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BuildSettings *createCocoQMakeSettings(BuildConfiguration *bc)
|
||||
{
|
||||
return new CocoQMakeSettings(bc);
|
||||
}
|
||||
|
||||
} // namespace Coco::Internal
|
14
src/plugins/coco/cocoqmakesettings.h
Normal file
14
src/plugins/coco/cocoqmakesettings.h
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ProjectExplorer { class BuildConfiguration; }
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
class BuildSettings;
|
||||
|
||||
BuildSettings *createCocoQMakeSettings(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
} // namespace Coco::Internal
|
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "globalsettings.h"
|
||||
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "cocoinstallation.h"
|
||||
#include "cocopluginconstants.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/filepath.h>
|
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "globalsettingspage.h"
|
||||
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "../cocotr.h"
|
||||
#include "cocoinstallation.h"
|
||||
#include "cocopluginconstants.h"
|
||||
#include "cocotr.h"
|
||||
#include "globalsettings.h"
|
||||
|
||||
#include <utils/fancylineedit.h>
|
@@ -2,6 +2,9 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "modificationfile.h"
|
||||
#include "projectexplorer/project.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
@@ -11,7 +14,21 @@ static void cutTail(QStringList &list)
|
||||
list.removeLast();
|
||||
}
|
||||
|
||||
ModificationFile::ModificationFile() {}
|
||||
ModificationFile::ModificationFile(const QString &fileName, const Utils::FilePath &defaultModificationFile)
|
||||
: m_fileName{fileName}
|
||||
, m_defaultModificationFile{defaultModificationFile}
|
||||
{}
|
||||
|
||||
void ModificationFile::setFilePath(ProjectExplorer::BuildConfiguration *buildConfig)
|
||||
{
|
||||
Utils::FilePath projectDirectory = buildConfig->project()->projectDirectory();
|
||||
m_filePath = projectDirectory.pathAppended(fileName());
|
||||
}
|
||||
|
||||
QString ModificationFile::fileName() const
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
bool ModificationFile::exists() const
|
||||
{
|
||||
@@ -24,6 +41,11 @@ void ModificationFile::clear()
|
||||
m_tweaks.clear();
|
||||
}
|
||||
|
||||
QStringList ModificationFile::defaultModificationFile() const
|
||||
{
|
||||
return contentOf(m_defaultModificationFile);
|
||||
}
|
||||
|
||||
QStringList ModificationFile::contentOf(const Utils::FilePath &filePath) const
|
||||
{
|
||||
QFile resource(filePath.nativePath());
|
@@ -7,41 +7,42 @@
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class BuildConfiguration;
|
||||
}
|
||||
|
||||
namespace Coco::Internal {
|
||||
|
||||
class ModificationFile
|
||||
{
|
||||
public:
|
||||
ModificationFile();
|
||||
ModificationFile(const QString &fileName, const Utils::FilePath &defaultModificationFile);
|
||||
|
||||
virtual void read() = 0;
|
||||
virtual void write() const = 0;
|
||||
void setFilePath(ProjectExplorer::BuildConfiguration *buildConfig);
|
||||
|
||||
virtual void setProjectDirectory(const Utils::FilePath &projectDirectory) = 0;
|
||||
|
||||
virtual QString fileName() const = 0;
|
||||
QString fileName() const;
|
||||
QString nativePath() const { return m_filePath.nativePath(); }
|
||||
bool exists() const;
|
||||
|
||||
const QStringList &options() const { return m_options; }
|
||||
void setOptions(const QString &options);
|
||||
void setOptions(const QStringList &options);
|
||||
|
||||
const QStringList &tweaks() const { return m_tweaks; }
|
||||
void setTweaks(const QString &tweaks);
|
||||
|
||||
protected:
|
||||
void clear();
|
||||
|
||||
virtual QStringList defaultModificationFile() const = 0;
|
||||
QStringList contentOf(const Utils::FilePath &filePath) const;
|
||||
QStringList currentModificationFile() const;
|
||||
|
||||
void setFilePath(const Utils::FilePath &path) { m_filePath = path; }
|
||||
|
||||
void setOptions(const QStringList &options);
|
||||
void setTweaks(const QStringList &tweaks);
|
||||
|
||||
void clear();
|
||||
|
||||
QStringList defaultModificationFile() const;
|
||||
QStringList currentModificationFile() const;
|
||||
|
||||
private:
|
||||
QStringList contentOf(const Utils::FilePath &filePath) const;
|
||||
|
||||
const QString m_fileName;
|
||||
const Utils::FilePath m_defaultModificationFile;
|
||||
|
||||
QStringList m_options;
|
||||
QStringList m_tweaks;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "qmakefeaturefile.h"
|
||||
|
||||
#include "../cocopluginconstants.h"
|
||||
#include "cocopluginconstants.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
@@ -14,17 +14,9 @@ namespace Coco::Internal {
|
||||
static const char assignment[] = "COVERAGE_OPTIONS = \\\n";
|
||||
static const char tweaksLine[] = "# User-supplied settings follow here:\n";
|
||||
|
||||
QMakeFeatureFile::QMakeFeatureFile() {}
|
||||
|
||||
QString QMakeFeatureFile::fileName() const
|
||||
{
|
||||
return QString(Constants::PROFILE_NAME) + ".prf";
|
||||
}
|
||||
|
||||
void QMakeFeatureFile::setProjectDirectory(const Utils::FilePath &projectDirectory)
|
||||
{
|
||||
setFilePath(projectDirectory.pathAppended(fileName()));
|
||||
}
|
||||
QMakeFeatureFile::QMakeFeatureFile()
|
||||
: ModificationFile{QString(Constants::PROFILE_NAME) + ".prf", ":/cocoplugin/files/cocoplugin.prf"}
|
||||
{}
|
||||
|
||||
QString QMakeFeatureFile::fromFileLine(const QString &line) const
|
||||
{
|
||||
@@ -91,9 +83,4 @@ void QMakeFeatureFile::write() const
|
||||
out.close();
|
||||
}
|
||||
|
||||
QStringList QMakeFeatureFile::defaultModificationFile() const
|
||||
{
|
||||
return contentOf(":/cocoplugin/files/cocoplugin.prf");
|
||||
}
|
||||
|
||||
} // namespace Coco::Internal
|
@@ -17,14 +17,8 @@ class QMakeFeatureFile : public ModificationFile
|
||||
public:
|
||||
QMakeFeatureFile();
|
||||
|
||||
void setProjectDirectory(const Utils::FilePath &projectDirectory) override;
|
||||
void read() override;
|
||||
void write() const override;
|
||||
|
||||
QString fileName() const override;
|
||||
|
||||
protected:
|
||||
QStringList defaultModificationFile() const override;
|
||||
void read();
|
||||
void write() const;
|
||||
|
||||
private:
|
||||
QString fromFileLine(const QString &line) const;
|
@@ -294,6 +294,23 @@ bool BuildConfiguration::createBuildDirectory()
|
||||
return result;
|
||||
}
|
||||
|
||||
void BuildConfiguration::setInitialArgs(const QStringList &)
|
||||
{
|
||||
QTC_CHECK(false);
|
||||
}
|
||||
|
||||
QStringList BuildConfiguration::initialArgs() const
|
||||
{
|
||||
QTC_CHECK(false);
|
||||
return {};
|
||||
}
|
||||
|
||||
QStringList BuildConfiguration::additionalArgs() const
|
||||
{
|
||||
QTC_CHECK(false);
|
||||
return {};
|
||||
}
|
||||
|
||||
void BuildConfiguration::setInitializer(const std::function<void(const BuildInfo &)> &initializer)
|
||||
{
|
||||
d->m_initializer = initializer;
|
||||
|
@@ -113,6 +113,14 @@ public:
|
||||
|
||||
bool createBuildDirectory();
|
||||
|
||||
// For tools that need to manipulate the main build command's argument list
|
||||
virtual void setInitialArgs(const QStringList &);
|
||||
virtual QStringList initialArgs() const;
|
||||
virtual QStringList additionalArgs() const;
|
||||
|
||||
virtual void reconfigure() {}
|
||||
virtual void stopReconfigure() {}
|
||||
|
||||
signals:
|
||||
void environmentChanged();
|
||||
void buildDirectoryInitialized();
|
||||
|
@@ -151,6 +151,8 @@ signals:
|
||||
void parsingFinished(bool success);
|
||||
void testInformationUpdated();
|
||||
void debuggingStarted();
|
||||
void errorOccurred(const QString &message);
|
||||
void warningOccurred(const QString &message);
|
||||
|
||||
protected:
|
||||
// Helper methods to manage parsing state and signalling
|
||||
|
@@ -415,6 +415,33 @@ bool QmakeBuildConfiguration::runQmakeSystemFunctions() const
|
||||
return settings().runSystemFunction();
|
||||
}
|
||||
|
||||
void QmakeBuildConfiguration::setInitialArgs(const QStringList &args)
|
||||
{
|
||||
if (BuildStepList *buildSteps = this->buildSteps()) {
|
||||
if (auto qmakeStep = buildSteps->firstOfType<QmakeProjectManager::QMakeStep>())
|
||||
qmakeStep->userArguments.setArguments(ProcessArgs::joinArgs(args));
|
||||
}
|
||||
}
|
||||
|
||||
QStringList QmakeBuildConfiguration::initialArgs() const
|
||||
{
|
||||
if (BuildStepList *buildSteps = this->buildSteps()) {
|
||||
if (auto qmakeStep = buildSteps->firstOfType<QmakeProjectManager::QMakeStep>()) {
|
||||
QString arg = qmakeStep->userArguments.unexpandedArguments();
|
||||
ProcessArgs::ConstArgIterator it{arg};
|
||||
QStringList result;
|
||||
|
||||
while (it.next()) {
|
||||
if (it.isSimple())
|
||||
result << it.value();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
QStringList QmakeBuildConfiguration::configCommandLineArguments() const
|
||||
{
|
||||
QStringList result;
|
||||
|
@@ -95,6 +95,9 @@ public:
|
||||
|
||||
bool runQmakeSystemFunctions() const;
|
||||
|
||||
void setInitialArgs(const QStringList &) override;
|
||||
QStringList initialArgs() const override;
|
||||
|
||||
signals:
|
||||
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
|
||||
/// if those change the qmakebuildconfig
|
||||
|
Reference in New Issue
Block a user