build: allow to disable language support in cmake
* in addition: add unloadable sourcegroup to visualize, load and save information when loading a project that contains source groups that are not supported by the build
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "SourceGroupSettingsJavaMaven.h"
|
||||
#include "SourceGroupSettingsJavaGradle.h"
|
||||
#include "SourceGroupSettingsPythonEmpty.h"
|
||||
#include "SourceGroupSettingsUnloadable.h"
|
||||
#include "logging.h"
|
||||
#include "utilityFile.h"
|
||||
#include "utilityString.h"
|
||||
@@ -174,6 +175,7 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
|
||||
switch (type)
|
||||
{
|
||||
#if BUILD_CXX_LANGUAGE_PACKAGE
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsCEmpty>(id, this);
|
||||
break;
|
||||
@@ -186,6 +188,8 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxCodeblocks>(id, this);
|
||||
break;
|
||||
#endif // BUILD_CXX_LANGUAGE_PACKAGE
|
||||
#if BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
case SOURCE_GROUP_JAVA_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsJavaEmpty>(id, this);
|
||||
break;
|
||||
@@ -195,14 +199,17 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
case SOURCE_GROUP_JAVA_GRADLE:
|
||||
settings = std::make_shared<SourceGroupSettingsJavaGradle>(id, this);
|
||||
break;
|
||||
#endif // BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
#if BUILD_PYTHON_LANGUAGE_PACKAGE
|
||||
case SOURCE_GROUP_PYTHON_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsPythonEmpty>(id, this);
|
||||
break;
|
||||
#endif // BUILD_PYTHON_LANGUAGE_PACKAGE
|
||||
case SOURCE_GROUP_CUSTOM_COMMAND:
|
||||
settings = std::make_shared<SourceGroupSettingsCustomCommand>(id, this);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
settings = std::make_shared<SourceGroupSettingsUnloadable>(id, this);
|
||||
}
|
||||
|
||||
if (settings)
|
||||
@@ -307,6 +314,7 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
const std::string language = migration->getValueFromSettings<std::string>(settings, "language_settings/language", "");
|
||||
|
||||
SourceGroupType type = SOURCE_GROUP_UNKNOWN;
|
||||
#if BUILD_CXX_LANGUAGE_PACKAGE
|
||||
if (language == "C" || language == "C++")
|
||||
{
|
||||
const std::string cdbPath = migration->getValueFromSettings<std::string>(settings, sourceGroupKey + "/build_file_path/compilation_db_path", "");
|
||||
@@ -323,7 +331,9 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
type = SOURCE_GROUP_CPP_EMPTY;
|
||||
}
|
||||
}
|
||||
else if (language == "Java")
|
||||
#endif // BUILD_CXX_LANGUAGE_PACKAGE
|
||||
#if BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
if (language == "Java")
|
||||
{
|
||||
const std::string mavenProjectFilePath = migration->getValueFromSettings<std::string>(settings, sourceGroupKey + "/maven/project_file_path", "");
|
||||
if (!mavenProjectFilePath.empty())
|
||||
@@ -340,7 +350,7 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
type = SOURCE_GROUP_JAVA_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
migration->setValueInSettings(settings, sourceGroupKey + "/type", sourceGroupTypeToString(type));
|
||||
}
|
||||
));
|
||||
@@ -357,11 +367,13 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings : getAllSourceGroupSettings())
|
||||
{
|
||||
#if BUILD_CXX_LANGUAGE_PACKAGE
|
||||
if (sourceGroupSettings->getType() == SOURCE_GROUP_CXX_CDB)
|
||||
{
|
||||
const std::string key = SourceGroupSettings::s_keyPrefix + sourceGroupSettings->getId();
|
||||
migrator.addMigration(6, std::make_shared<SettingsMigrationMoveKey>(key + "/source_paths/source_path", key + "/indexed_header_paths/indexed_header_path"));
|
||||
}
|
||||
#endif // BUILD_CXX_LANGUAGE_PACKAGE
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings : getAllSourceGroupSettings())
|
||||
@@ -369,15 +381,19 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
std::string languageName;
|
||||
switch (getLanguageTypeForSourceGroupType(sourceGroupSettings->getType()))
|
||||
{
|
||||
#if BUILD_CXX_LANGUAGE_PACKAGE
|
||||
case LANGUAGE_C:
|
||||
languageName = "c";
|
||||
break;
|
||||
case LANGUAGE_CPP:
|
||||
languageName = "cpp";
|
||||
break;
|
||||
#endif // BUILD_CXX_LANGUAGE_PACKAGE
|
||||
#if BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
case LANGUAGE_JAVA:
|
||||
languageName = "java";
|
||||
break;
|
||||
#endif // BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user