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