logic: added Gradle project setup (issue #379)

* added implementation for Gradle project setup (icon is still missing)
* refactored project loading/saving and SourceGroupSettings
* removed long deprecated Cxx UseSourcePathsForHeaderSearch option

fortune cookie message = There is true and sincere friendship between you and your friends.
This commit is contained in:
mlangkabel
2017-10-02 18:43:59 +02:00
parent 72ae4d5695
commit e604d24c40
83 changed files with 3518 additions and 1182 deletions
+10
View File
@@ -296,8 +296,18 @@ add_files(
settings/SourceGroupSettings.h
settings/SourceGroupSettingsCxx.cpp
settings/SourceGroupSettingsCxx.h
settings/SourceGroupSettingsCxxCdb.cpp
settings/SourceGroupSettingsCxxCdb.h
settings/SourceGroupSettingsCxxEmpty.cpp
settings/SourceGroupSettingsCxxEmpty.h
settings/SourceGroupSettingsJava.cpp
settings/SourceGroupSettingsJava.h
settings/SourceGroupSettingsJavaEmpty.cpp
settings/SourceGroupSettingsJavaEmpty.h
settings/SourceGroupSettingsJavaGradle.cpp
settings/SourceGroupSettingsJavaGradle.h
settings/SourceGroupSettingsJavaMaven.cpp
settings/SourceGroupSettingsJavaMaven.h
settings/SourceGroupType.cpp
settings/SourceGroupType.h
+1 -2
View File
@@ -45,7 +45,6 @@ Project::Project(std::shared_ptr<ProjectSettings> settings, StorageAccessProxy*
{
}
Project::~Project()
{
}
@@ -53,7 +52,7 @@ Project::~Project()
bool Project::refresh(bool forceRefresh)
{
if (m_state == PROJECT_STATE_NOT_LOADED)
{
{
return false;
}
+14
View File
@@ -1,5 +1,7 @@
#include "project/SourceGroup.h"
#include "settings/SourceGroupSettings.h"
#include "utility/file/FileManager.h"
#include "utility/file/FilePath.h"
SourceGroup::~SourceGroup()
@@ -21,6 +23,18 @@ bool SourceGroup::prepareIndexing()
return true;
}
void SourceGroup::fetchAllSourceFilePaths()
{
m_sourceFilePathsToIndex.clear();
FileManager fileManager;
fileManager.update(
getAllSourcePaths(),
getSourceGroupSettings()->getExcludePathsExpandedAndAbsolute(),
getSourceGroupSettings()->getSourceExtensions()
);
m_allSourceFilePaths = fileManager.getAllSourceFilePaths();
}
void SourceGroup::fetchSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths)
{
for (const FilePath& sourceFilePath: m_allSourceFilePaths)
+6 -1
View File
@@ -10,6 +10,7 @@
class FilePath;
class IndexerCommand;
class SourceGroupSettings;
class SourceGroup
{
@@ -22,7 +23,7 @@ public:
virtual bool prepareRefresh();
virtual bool prepareIndexing();
virtual void fetchAllSourceFilePaths() = 0;
void fetchAllSourceFilePaths();
void fetchSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths);
std::set<FilePath> getAllSourceFilePaths() const;
@@ -34,6 +35,10 @@ public:
protected:
std::set<FilePath> m_allSourceFilePaths;
std::set<FilePath> m_sourceFilePathsToIndex;
private:
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() = 0;
virtual std::vector<FilePath> getAllSourcePaths() const = 0;
};
#endif // SOURCE_GROUP_H
+2
View File
@@ -49,6 +49,8 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
return LANGUAGE_JAVA;
case SOURCE_GROUP_JAVA_MAVEN:
return LANGUAGE_JAVA;
case SOURCE_GROUP_JAVA_GRADLE:
return LANGUAGE_JAVA;
default:
break;
}
+32 -101
View File
@@ -3,8 +3,12 @@
#include "settings/migration/SettingsMigrationDeleteKey.h"
#include "settings/migration/SettingsMigrationLambda.h"
#include "settings/migration/SettingsMigrationMoveKey.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsJava.h"
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsJavaEmpty.h"
#include "settings/SourceGroupSettingsJavaMaven.h"
#include "settings/SourceGroupSettingsJavaGradle.h"
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
#include "utility/utilityUuid.h"
@@ -135,7 +139,7 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
std::vector<std::shared_ptr<SourceGroupSettings>> allSettings;
for (const std::string& key: m_config->getSublevelKeys("source_groups"))
{
const std::string id = key.substr(std::string("source_groups/source_group_").length());
const std::string id = key.substr(std::string(SourceGroupSettings::s_keyPrefix).length());
const SourceGroupType type = stringToSourceGroupType(getValue<std::string>(key + "/type", ""));
std::shared_ptr<SourceGroupSettings> settings;
@@ -143,62 +147,36 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
switch (type)
{
case SOURCE_GROUP_C_EMPTY:
settings = std::make_shared<SourceGroupSettingsCxxEmpty>(id, SOURCE_GROUP_C_EMPTY, this);
break;
case SOURCE_GROUP_CPP_EMPTY:
settings = std::make_shared<SourceGroupSettingsCxxEmpty>(id, SOURCE_GROUP_CPP_EMPTY, this);
break;
case SOURCE_GROUP_CXX_CDB:
{
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::make_shared<SourceGroupSettingsCxx>(id, type, this);
cxxSettings->setHeaderSearchPaths(getPathValues(key + "/header_search_paths/header_search_path"));
cxxSettings->setFrameworkSearchPaths(getPathValues(key + "/framework_search_paths/framework_search_path"));
cxxSettings->setCompilerFlags(getValues<std::string>(key + "/compiler_flags/compiler_flag", std::vector<std::string>()));
cxxSettings->setUseSourcePathsForHeaderSearch(getValue<bool>(key + "/use_source_paths_for_header_search", false));
cxxSettings->setHasDefinedUseSourcePathsForHeaderSearch(isValueDefined(key + "/use_source_paths_for_header_search"));
if (type == SOURCE_GROUP_CXX_CDB)
{
cxxSettings->setCompilationDatabasePath(FilePath(getValue<std::string>(key + "/build_file_path/compilation_db_path", "")));
}
if (type == SOURCE_GROUP_C_EMPTY || type == SOURCE_GROUP_CPP_EMPTY)
{
cxxSettings->setTargetOptionsEnabled(getValue<bool>(key + "/cross_compilation/target_options_enabled", false));
cxxSettings->setTargetArch(getValue<std::string>(key + "/cross_compilation/target/arch", ""));
cxxSettings->setTargetVendor(getValue<std::string>(key + "/cross_compilation/target/vendor", ""));
cxxSettings->setTargetSys(getValue<std::string>(key + "/cross_compilation/target/sys", ""));
cxxSettings->setTargetAbi(getValue<std::string>(key + "/cross_compilation/target/abi", ""));
}
cxxSettings->setShouldApplyAnonymousTypedefTransformation(getValue<bool>(key + "/should_apply_anonymous_typedef_transformation", true));
settings = cxxSettings;
}
settings = std::make_shared<SourceGroupSettingsCxxCdb>(id, this);
break;
case SOURCE_GROUP_JAVA_EMPTY:
settings = std::make_shared<SourceGroupSettingsJavaEmpty>(id, this);
break;
case SOURCE_GROUP_JAVA_MAVEN:
{
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::make_shared<SourceGroupSettingsJava>(id, type, this);
javaSettings->setClasspath(getPathValues(key + "/class_paths/class_path"));
javaSettings->setUseJreSystemLibrary(getValue<bool>(key + "/use_jre_system_library", true));
if (type == SOURCE_GROUP_JAVA_MAVEN)
{
javaSettings->setMavenProjectFilePath(FilePath(getValue<std::string>(key + "/maven/project_file_path", "")));
javaSettings->setMavenDependenciesDirectory(FilePath(getValue<std::string>(key + "/maven/dependencies_directory", "")));
javaSettings->setShouldIndexMavenTests(getValue<bool>(key + "/maven/should_index_tests", false));
}
settings = javaSettings;
}
settings = std::make_shared<SourceGroupSettingsJavaMaven>(id, this);
break;
case SOURCE_GROUP_JAVA_GRADLE:
settings = std::make_shared<SourceGroupSettingsJavaGradle>(id, this);
break;
default:
continue;
}
const std::string name = getValue<std::string>(key + "/name", "");
if (name.size())
if (settings)
{
settings->setName(name);
settings->load(m_config);
allSettings.push_back(settings);
}
else
{
LOG_WARNING("Sourcegroup with id \"" + id + "\" could not be loaded.");
}
settings->setStandard(getValue<std::string>(key + "/standard", ""));
settings->setSourcePaths(getPathValues(key + "/source_paths/source_path"));
settings->setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path"));
settings->setSourceExtensions(getValues(key + "/source_extensions/source_extension", std::vector<std::string>()));
allSettings.push_back(settings);
}
return allSettings;
@@ -213,63 +191,11 @@ void ProjectSettings::setAllSourceGroupSettings(const std::vector<std::shared_pt
for (const std::shared_ptr<SourceGroupSettings>& settings: allSettings)
{
const std::string key = "source_groups/source_group_" + settings->getId();
const std::string key = SourceGroupSettings::s_keyPrefix + settings->getId();
const SourceGroupType type = settings->getType();
setValue(key + "/type", sourceGroupTypeToString(type));
setValue(key + "/name", settings->getName());
setValue(key + "/standard", settings->getStandard());
setPathValues(key + "/source_paths/source_path", settings->getSourcePaths());
setPathValues(key + "/exclude_paths/exclude_path", settings->getExcludePaths());
setValues(key + "/source_extensions/source_extension", settings->getSourceExtensions());
switch (type)
{
case SOURCE_GROUP_C_EMPTY:
case SOURCE_GROUP_CPP_EMPTY:
case SOURCE_GROUP_CXX_CDB:
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(settings))
{
setPathValues(key + "/header_search_paths/header_search_path", cxxSettings->getHeaderSearchPaths());
setPathValues(key + "/framework_search_paths/framework_search_path", cxxSettings->getFrameworkSearchPaths());
setValues(key + "/compiler_flags/compiler_flag", cxxSettings->getCompilerFlags());
if (cxxSettings->getHasDefinedUseSourcePathsForHeaderSearch())
{
setValue(key + "/use_source_paths_for_header_search", cxxSettings->getUseSourcePathsForHeaderSearch());
}
if (type == SOURCE_GROUP_CXX_CDB)
{
setValue(key + "/build_file_path/compilation_db_path", cxxSettings->getCompilationDatabasePath().str());
}
if (type == SOURCE_GROUP_C_EMPTY || type == SOURCE_GROUP_CPP_EMPTY)
{
setValue(key + "/cross_compilation/target_options_enabled", cxxSettings->getTargetOptionsEnabled());
setValue(key + "/cross_compilation/target/arch", cxxSettings->getTargetArch());
setValue(key + "/cross_compilation/target/vendor", cxxSettings->getTargetVendor());
setValue(key + "/cross_compilation/target/sys", cxxSettings->getTargetSys());
setValue(key + "/cross_compilation/target/abi", cxxSettings->getTargetAbi());
}
setValue(key + "/should_apply_anonymous_typedef_transformation", cxxSettings->getShouldApplyAnonymousTypedefTransformation());
}
break;
case SOURCE_GROUP_JAVA_EMPTY:
case SOURCE_GROUP_JAVA_MAVEN:
if (std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(settings))
{
setPathValues(key + "/class_paths/class_path", javaSettings->getClasspath());
setValue(key + "/use_jre_system_library", javaSettings->getUseJreSystemLibrary());
if (type == SOURCE_GROUP_JAVA_MAVEN)
{
setValue(key + "/maven/project_file_path", javaSettings->getMavenProjectFilePath().str());
setValue(key + "/maven/dependencies_directory", javaSettings->getMavenDependenciesDirectory().str());
setValue(key + "/maven/should_index_tests", javaSettings->getShouldIndexMavenTests());
}
}
break;
default:
continue;
}
settings->save(m_config);
}
}
@@ -373,6 +299,11 @@ SettingsMigrator ProjectSettings::getMigrations() const
{
type = SOURCE_GROUP_JAVA_MAVEN;
}
const std::string gradleProjectFilePath = migration->getValueFromSettings<std::string>(settings, sourceGroupKey + "/gradle/project_file_path", "");
if (!gradleProjectFilePath.empty())
{
type = SOURCE_GROUP_JAVA_GRADLE;
}
else
{
type = SOURCE_GROUP_JAVA_EMPTY;
+2 -2
View File
@@ -118,9 +118,9 @@ std::vector<FilePath> Settings::getPathValues(const std::string& key) const
values = getValues(key, values);
std::vector<FilePath> paths;
for (const std::string& path : values)
for (const std::string& value : values)
{
paths.push_back(FilePath(path));
paths.push_back(FilePath(value));
}
return paths;
}
+53
View File
@@ -2,6 +2,8 @@
#include "utility/utility.h"
std::string SourceGroupSettings::s_keyPrefix = "source_groups/source_group_";
SourceGroupSettings::SourceGroupSettings(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: m_projectSettings(projectSettings)
, m_id(id)
@@ -18,6 +20,33 @@ SourceGroupSettings::~SourceGroupSettings()
{
}
void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config)
{
const std::string key = s_keyPrefix + getId();
const std::string name = getValue<std::string>(key + "/name", "", config);
if (!name.empty())
{
setName(name);
}
setStandard(getValue<std::string>(key + "/standard", "", config));
setSourcePaths(getPathValues(key + "/source_paths/source_path", config));
setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path", config));
setSourceExtensions(getValues(key + "/source_extensions/source_extension", std::vector<std::string>(), config));
}
void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
{
const std::string key = s_keyPrefix + getId();
setValue(key + "/name", getName(), config);
setValue(key + "/standard", getStandard(), config);
setPathValues(key + "/source_paths/source_path", getSourcePaths(), config);
setPathValues(key + "/exclude_paths/exclude_path", getExcludePaths(), config);
setValues(key + "/source_extensions/source_extension", getSourceExtensions(), config);
}
bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) const
{
return (
@@ -128,3 +157,27 @@ void SourceGroupSettings::setSourceExtensions(const std::vector<std::string>& so
{
m_sourceExtensions = sourceExtensions;
}
std::vector<FilePath> SourceGroupSettings::getPathValues(const std::string& key, std::shared_ptr<const ConfigManager> config)
{
std::vector<std::string> values;
values = getValues(key, values, config);
std::vector<FilePath> paths;
for (const std::string& value : values)
{
paths.push_back(FilePath(value));
}
return paths;
}
bool SourceGroupSettings::setPathValues(const std::string& key, const std::vector<FilePath>& paths, std::shared_ptr<ConfigManager> config)
{
std::vector<std::string> values;
for (const FilePath& path : paths)
{
values.push_back(path.str());
}
return setValues(key, values, config);
}
+71
View File
@@ -12,9 +12,14 @@ class ProjectSettings;
class SourceGroupSettings
{
public:
static std::string s_keyPrefix;
SourceGroupSettings(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettings();
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
std::string getId() const;
@@ -45,6 +50,22 @@ public:
void setSourceExtensions(const std::vector<std::string>& sourceExtensions);
protected:
template<typename T>
static T getValue(const std::string& key, T defaultValue, std::shared_ptr<const ConfigManager> config);
template<typename T>
static std::vector<T> getValues(const std::string& key, std::vector<T> defaultValues, std::shared_ptr<const ConfigManager> config);
static std::vector<FilePath> getPathValues(const std::string& key, std::shared_ptr<const ConfigManager> config);
template<typename T>
static bool setValue(const std::string& key, T value, std::shared_ptr<ConfigManager> config);
template<typename T>
static bool setValues(const std::string& key, std::vector<T> values, std::shared_ptr<ConfigManager> config);
static bool setPathValues(const std::string& key, const std::vector<FilePath>& paths, std::shared_ptr<ConfigManager> config);
const ProjectSettings* m_projectSettings;
private:
@@ -61,4 +82,54 @@ private:
std::vector<std::string> m_sourceExtensions;
};
template<typename T>
T SourceGroupSettings::getValue(const std::string& key, T defaultValue, std::shared_ptr<const ConfigManager> config)
{
if (config)
{
T value;
if (config->getValue(key, value))
{
return value;
}
}
return defaultValue;
}
template<typename T>
std::vector<T> SourceGroupSettings::getValues(const std::string& key, std::vector<T> defaultValues, std::shared_ptr<const ConfigManager> config)
{
if (config)
{
std::vector<T> values;
if (config->getValues(key, values))
{
return values;
}
}
return defaultValues;
}
template<typename T>
bool SourceGroupSettings::setValue(const std::string& key, T value, std::shared_ptr<ConfigManager> config)
{
if (config)
{
config->setValue(key, value);
return true;
}
return false;
}
template<typename T>
bool SourceGroupSettings::setValues(const std::string& key, std::vector<T> values, std::shared_ptr<ConfigManager> config)
{
if (config)
{
config->setValues(key, values);
return true;
}
return false;
}
#endif // SOURCE_GROUP_SETTINGS_H
+25 -249
View File
@@ -3,156 +3,11 @@
#include "utility/utility.h"
#include "utility/utilityApp.h"
std::vector<std::string> SourceGroupSettingsCxx::getAvailableArchTypes()
{
return {
"aarch64",
"aarch64_be",
"arm",
"armeb",
"avr",
"bpfel",
"bpfeb",
"hexagon",
"mips",
"mipsel",
"mips64",
"mips64el",
"msp430",
"powerpc64",
"powerpc64le",
"powerpc",
"r600",
"amdgcn",
"riscv32",
"riscv64",
"sparc",
"sparcv9",
"sparcel",
"s390x",
"tce",
"tcele",
"thumb",
"thumbeb",
"i386",
"x86_64",
"xcore",
"nvptx",
"nvptx64",
"le32",
"le64",
"amdil",
"amdil64",
"hsail",
"hsail64",
"spir",
"spir64",
"kalimba",
"lanai",
"shave",
"wasm32",
"wasm64",
"renderscript32",
"renderscript64",
};
}
std::vector<std::string> SourceGroupSettingsCxx::getAvailableVendorTypes()
{
return {
"unknown",
"apple",
"pc",
"scei",
"bgp",
"bgq",
"fsl",
"ibm",
"img",
"mti",
"nvidia",
"csr",
"myriad",
"amd",
"mesa"
};
}
std::vector<std::string> SourceGroupSettingsCxx::getAvailableOsTypes()
{
return {
"unknown",
"cloudabi",
"darwin",
"dragonfly",
"freebsd",
"fuchsia",
"ios",
"kfreebsd",
"linux",
"lv2",
"macosx",
"netbsd",
"openbsd",
"solaris",
"windows",
"haiku",
"minix",
"rtems",
"nacl",
"cnk",
"bitrig",
"aix",
"cuda",
"nvcl",
"amdhsa",
"ps4",
"elfiamcu",
"tvos",
"watchos",
"mesa3d",
"contiki"
};
}
std::vector<std::string> SourceGroupSettingsCxx::getAvailableEnvironmentTypes()
{
return {
"unknown",
"gnu",
"gnuabi64",
"gnueabihf",
"gnueabi",
"gnux32",
"code16",
"eabi",
"eabihf",
"android",
"musl",
"musleabi",
"musleabihf",
"msvc",
"itanium",
"cygnus",
"amdopencl",
"coreclr",
"opencl"
};
}
SourceGroupSettingsCxx::SourceGroupSettingsCxx(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: SourceGroupSettings(id, type, projectSettings)
, m_headerSearchPaths(std::vector<FilePath>())
, m_frameworkSearchPaths(std::vector<FilePath>())
, m_targetOptionsEnabled(false)
, m_targetArch("")
, m_targetVendor("")
, m_targetSys("")
, m_targetAbi("")
, m_compilerFlags(std::vector<std::string>())
, m_useSourcePathsForHeaderSearch(false)
, m_hasDefinedUseSourcePathsForHeaderSearch(false)
, m_compilationDatabasePath(FilePath())
, m_shouldApplyAnonymousTypedefTransformation(true)
{
}
@@ -161,6 +16,30 @@ SourceGroupSettingsCxx::~SourceGroupSettingsCxx()
{
}
void SourceGroupSettingsCxx::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
setHeaderSearchPaths(getPathValues(key + "/header_search_paths/header_search_path", config));
setFrameworkSearchPaths(getPathValues(key + "/framework_search_paths/framework_search_path", config));
setCompilerFlags(getValues<std::string>(key + "/compiler_flags/compiler_flag", std::vector<std::string>(), config));
setShouldApplyAnonymousTypedefTransformation(getValue<bool>(key + "/should_apply_anonymous_typedef_transformation", true, config));
}
void SourceGroupSettingsCxx::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
setPathValues(key + "/header_search_paths/header_search_path", getHeaderSearchPaths(), config);
setPathValues(key + "/framework_search_paths/framework_search_path", getFrameworkSearchPaths(), config);
setValues(key + "/compiler_flags/compiler_flag", getCompilerFlags(), config);
setValue(key + "/should_apply_anonymous_typedef_transformation", getShouldApplyAnonymousTypedefTransformation(), config);
}
bool SourceGroupSettingsCxx::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxx> otherCxx = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(other);
@@ -170,11 +49,7 @@ bool SourceGroupSettingsCxx::equals(std::shared_ptr<SourceGroupSettings> other)
SourceGroupSettings::equals(other) &&
utility::isPermutation(m_headerSearchPaths, otherCxx->m_headerSearchPaths) &&
utility::isPermutation(m_frameworkSearchPaths, otherCxx->m_frameworkSearchPaths) &&
utility::isPermutation(m_compilerFlags, otherCxx->m_compilerFlags) &&
m_useSourcePathsForHeaderSearch == otherCxx->m_useSourcePathsForHeaderSearch &&
m_hasDefinedUseSourcePathsForHeaderSearch == otherCxx->m_hasDefinedUseSourcePathsForHeaderSearch &&
m_compilationDatabasePath == otherCxx->m_compilationDatabasePath &&
getTargetFlag() == otherCxx->getTargetFlag()
utility::isPermutation(m_compilerFlags, otherCxx->m_compilerFlags)
);
}
@@ -271,70 +146,6 @@ void SourceGroupSettingsCxx::setFrameworkSearchPaths(const std::vector<FilePath>
m_frameworkSearchPaths = frameworkSearchPaths;
}
bool SourceGroupSettingsCxx::getTargetOptionsEnabled() const
{
return m_targetOptionsEnabled;
}
void SourceGroupSettingsCxx::setTargetOptionsEnabled(bool targetOptionsEnabled)
{
m_targetOptionsEnabled = targetOptionsEnabled;
}
std::string SourceGroupSettingsCxx::getTargetArch() const
{
return m_targetArch;
}
void SourceGroupSettingsCxx::setTargetArch(const std::string& arch)
{
m_targetArch = arch;
}
std::string SourceGroupSettingsCxx::getTargetVendor() const
{
return m_targetVendor;
}
void SourceGroupSettingsCxx::setTargetVendor(const std::string& vendor)
{
m_targetVendor = vendor;
}
std::string SourceGroupSettingsCxx::getTargetSys() const
{
return m_targetSys;
}
void SourceGroupSettingsCxx::setTargetSys(const std::string& sys)
{
m_targetSys = sys;
}
std::string SourceGroupSettingsCxx::getTargetAbi() const
{
return m_targetAbi;
}
void SourceGroupSettingsCxx::setTargetAbi(const std::string& abi)
{
m_targetAbi = abi;
}
std::string SourceGroupSettingsCxx::getTargetFlag() const
{
std::string targetFlag = "";
if (m_targetOptionsEnabled && !m_targetArch.empty())
{
targetFlag = "--target=";
targetFlag += m_targetArch;
targetFlag += "-" + (m_targetVendor.empty() ? "unknown" : m_targetVendor);
targetFlag += "-" + (m_targetSys.empty() ? "unknown" : m_targetSys);
targetFlag += "-" + (m_targetAbi.empty() ? "unknown" : m_targetAbi);
}
return targetFlag;
}
std::vector<std::string> SourceGroupSettingsCxx::getCompilerFlags() const
{
return m_compilerFlags;
@@ -345,41 +156,6 @@ void SourceGroupSettingsCxx::setCompilerFlags(const std::vector<std::string>& co
m_compilerFlags = compilerFlags;
}
bool SourceGroupSettingsCxx::getUseSourcePathsForHeaderSearch() const
{
return m_useSourcePathsForHeaderSearch;
}
void SourceGroupSettingsCxx::setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch)
{
m_useSourcePathsForHeaderSearch = useSourcePathsForHeaderSearch;
}
bool SourceGroupSettingsCxx::getHasDefinedUseSourcePathsForHeaderSearch() const
{
return m_hasDefinedUseSourcePathsForHeaderSearch;
}
void SourceGroupSettingsCxx::setHasDefinedUseSourcePathsForHeaderSearch(bool hasDefinedUseSourcePathsForHeaderSearch)
{
m_hasDefinedUseSourcePathsForHeaderSearch = hasDefinedUseSourcePathsForHeaderSearch;
}
FilePath SourceGroupSettingsCxx::getCompilationDatabasePath() const
{
return m_compilationDatabasePath;
}
FilePath SourceGroupSettingsCxx::getCompilationDatabasePathExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getCompilationDatabasePath());
}
void SourceGroupSettingsCxx::setCompilationDatabasePath(const FilePath& compilationDatabasePath)
{
m_compilationDatabasePath = compilationDatabasePath;
}
bool SourceGroupSettingsCxx::getShouldApplyAnonymousTypedefTransformation() const
{
return m_shouldApplyAnonymousTypedefTransformation;
+3 -41
View File
@@ -7,14 +7,12 @@ class SourceGroupSettingsCxx
: public SourceGroupSettings
{
public:
static std::vector<std::string> getAvailableArchTypes();
static std::vector<std::string> getAvailableVendorTypes();
static std::vector<std::string> getAvailableOsTypes();
static std::vector<std::string> getAvailableEnvironmentTypes();
SourceGroupSettingsCxx(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsCxx();
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
virtual std::vector<std::string> getAvailableLanguageStandards() const;
@@ -27,37 +25,9 @@ public:
std::vector<FilePath> getFrameworkSearchPathsExpandedAndAbsolute() const;
void setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths);
bool getTargetOptionsEnabled() const;
void setTargetOptionsEnabled(bool targetOptionsEnabled);
std::string getTargetArch() const;
void setTargetArch(const std::string& arch);
std::string getTargetVendor() const;
void setTargetVendor(const std::string& vendor);
std::string getTargetSys() const;
void setTargetSys(const std::string& sys);
std::string getTargetAbi() const;
void setTargetAbi(const std::string& abi);
std::string getTargetFlag() const;
std::vector<std::string> getCompilerFlags() const;
void setCompilerFlags(const std::vector<std::string>& compilerFlags);
// deprecated begin
bool getUseSourcePathsForHeaderSearch() const;
void setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch);
bool getHasDefinedUseSourcePathsForHeaderSearch() const;
void setHasDefinedUseSourcePathsForHeaderSearch(bool hasDefinedUseSourcePathsForHeaderSearch);
// deprecated end
FilePath getCompilationDatabasePath() const;
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
bool getShouldApplyAnonymousTypedefTransformation() const;
void setShouldApplyAnonymousTypedefTransformation(bool shouldApplyAnonymousTypedefTransformation);
@@ -67,15 +37,7 @@ private:
std::vector<FilePath> m_headerSearchPaths;
std::vector<FilePath> m_frameworkSearchPaths;
bool m_targetOptionsEnabled;
std::string m_targetArch;
std::string m_targetVendor;
std::string m_targetSys;
std::string m_targetAbi;
std::vector<std::string> m_compilerFlags;
bool m_useSourcePathsForHeaderSearch;
bool m_hasDefinedUseSourcePathsForHeaderSearch;
FilePath m_compilationDatabasePath;
bool m_shouldApplyAnonymousTypedefTransformation;
};
@@ -0,0 +1,58 @@
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "utility/utility.h"
#include "utility/utilityApp.h"
SourceGroupSettingsCxxCdb::SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CXX_CDB, projectSettings)
, m_compilationDatabasePath(FilePath())
{
}
SourceGroupSettingsCxxCdb::~SourceGroupSettingsCxxCdb()
{
}
void SourceGroupSettingsCxxCdb::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
setCompilationDatabasePath(FilePath(getValue<std::string>(key + "/build_file_path/compilation_db_path", "", config)));
}
void SourceGroupSettingsCxxCdb::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
setValue(key + "/build_file_path/compilation_db_path", getCompilationDatabasePath().str(), config);
}
bool SourceGroupSettingsCxxCdb::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxxCdb> otherCxxCdb = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(other);
return (
otherCxxCdb &&
SourceGroupSettingsCxx::equals(other) &&
m_compilationDatabasePath == otherCxxCdb->m_compilationDatabasePath
);
}
FilePath SourceGroupSettingsCxxCdb::getCompilationDatabasePath() const
{
return m_compilationDatabasePath;
}
FilePath SourceGroupSettingsCxxCdb::getCompilationDatabasePathExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getCompilationDatabasePath());
}
void SourceGroupSettingsCxxCdb::setCompilationDatabasePath(const FilePath& compilationDatabasePath)
{
m_compilationDatabasePath = compilationDatabasePath;
}
@@ -0,0 +1,26 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_CDB_H
#define SOURCE_GROUP_SETTINGS_CXX_CDB_H
#include "settings/SourceGroupSettingsCxx.h"
class SourceGroupSettingsCxxCdb
: public SourceGroupSettingsCxx
{
public:
SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsCxxCdb();
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
FilePath getCompilationDatabasePath() const;
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
private:
FilePath m_compilationDatabasePath;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_CDB_H
@@ -0,0 +1,256 @@
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "utility/utility.h"
#include "utility/utilityApp.h"
std::vector<std::string> SourceGroupSettingsCxxEmpty::getAvailableArchTypes()
{
return {
"aarch64",
"aarch64_be",
"arm",
"armeb",
"avr",
"bpfel",
"bpfeb",
"hexagon",
"mips",
"mipsel",
"mips64",
"mips64el",
"msp430",
"powerpc64",
"powerpc64le",
"powerpc",
"r600",
"amdgcn",
"riscv32",
"riscv64",
"sparc",
"sparcv9",
"sparcel",
"s390x",
"tce",
"tcele",
"thumb",
"thumbeb",
"i386",
"x86_64",
"xcore",
"nvptx",
"nvptx64",
"le32",
"le64",
"amdil",
"amdil64",
"hsail",
"hsail64",
"spir",
"spir64",
"kalimba",
"lanai",
"shave",
"wasm32",
"wasm64",
"renderscript32",
"renderscript64",
};
}
std::vector<std::string> SourceGroupSettingsCxxEmpty::getAvailableVendorTypes()
{
return {
"unknown",
"apple",
"pc",
"scei",
"bgp",
"bgq",
"fsl",
"ibm",
"img",
"mti",
"nvidia",
"csr",
"myriad",
"amd",
"mesa"
};
}
std::vector<std::string> SourceGroupSettingsCxxEmpty::getAvailableOsTypes()
{
return {
"unknown",
"cloudabi",
"darwin",
"dragonfly",
"freebsd",
"fuchsia",
"ios",
"kfreebsd",
"linux",
"lv2",
"macosx",
"netbsd",
"openbsd",
"solaris",
"windows",
"haiku",
"minix",
"rtems",
"nacl",
"cnk",
"bitrig",
"aix",
"cuda",
"nvcl",
"amdhsa",
"ps4",
"elfiamcu",
"tvos",
"watchos",
"mesa3d",
"contiki"
};
}
std::vector<std::string> SourceGroupSettingsCxxEmpty::getAvailableEnvironmentTypes()
{
return {
"unknown",
"gnu",
"gnuabi64",
"gnueabihf",
"gnueabi",
"gnux32",
"code16",
"eabi",
"eabihf",
"android",
"musl",
"musleabi",
"musleabihf",
"msvc",
"itanium",
"cygnus",
"amdopencl",
"coreclr",
"opencl"
};
}
SourceGroupSettingsCxxEmpty::SourceGroupSettingsCxxEmpty(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, type, projectSettings)
, m_targetOptionsEnabled(false)
, m_targetArch("")
, m_targetVendor("")
, m_targetSys("")
, m_targetAbi("")
{
}
SourceGroupSettingsCxxEmpty::~SourceGroupSettingsCxxEmpty()
{
}
void SourceGroupSettingsCxxEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
setTargetOptionsEnabled(getValue<bool>(key + "/cross_compilation/target_options_enabled", false, config));
setTargetArch(getValue<std::string>(key + "/cross_compilation/target/arch", "", config));
setTargetVendor(getValue<std::string>(key + "/cross_compilation/target/vendor", "", config));
setTargetSys(getValue<std::string>(key + "/cross_compilation/target/sys", "", config));
setTargetAbi(getValue<std::string>(key + "/cross_compilation/target/abi", "", config));
}
void SourceGroupSettingsCxxEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
setValue(key + "/cross_compilation/target_options_enabled", getTargetOptionsEnabled(), config);
setValue(key + "/cross_compilation/target/arch", getTargetArch(), config);
setValue(key + "/cross_compilation/target/vendor", getTargetVendor(), config);
setValue(key + "/cross_compilation/target/sys", getTargetSys(), config);
setValue(key + "/cross_compilation/target/abi", getTargetAbi(), config);
}
bool SourceGroupSettingsCxxEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxxEmpty> otherCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(other);
return (
otherCxxEmpty &&
SourceGroupSettingsCxx::equals(other) &&
getTargetFlag() == otherCxxEmpty->getTargetFlag()
);
}
bool SourceGroupSettingsCxxEmpty::getTargetOptionsEnabled() const
{
return m_targetOptionsEnabled;
}
void SourceGroupSettingsCxxEmpty::setTargetOptionsEnabled(bool targetOptionsEnabled)
{
m_targetOptionsEnabled = targetOptionsEnabled;
}
std::string SourceGroupSettingsCxxEmpty::getTargetArch() const
{
return m_targetArch;
}
void SourceGroupSettingsCxxEmpty::setTargetArch(const std::string& arch)
{
m_targetArch = arch;
}
std::string SourceGroupSettingsCxxEmpty::getTargetVendor() const
{
return m_targetVendor;
}
void SourceGroupSettingsCxxEmpty::setTargetVendor(const std::string& vendor)
{
m_targetVendor = vendor;
}
std::string SourceGroupSettingsCxxEmpty::getTargetSys() const
{
return m_targetSys;
}
void SourceGroupSettingsCxxEmpty::setTargetSys(const std::string& sys)
{
m_targetSys = sys;
}
std::string SourceGroupSettingsCxxEmpty::getTargetAbi() const
{
return m_targetAbi;
}
void SourceGroupSettingsCxxEmpty::setTargetAbi(const std::string& abi)
{
m_targetAbi = abi;
}
std::string SourceGroupSettingsCxxEmpty::getTargetFlag() const
{
std::string targetFlag = "";
if (m_targetOptionsEnabled && !m_targetArch.empty())
{
targetFlag = "--target=";
targetFlag += m_targetArch;
targetFlag += "-" + (m_targetVendor.empty() ? "unknown" : m_targetVendor);
targetFlag += "-" + (m_targetSys.empty() ? "unknown" : m_targetSys);
targetFlag += "-" + (m_targetAbi.empty() ? "unknown" : m_targetAbi);
}
return targetFlag;
}
@@ -0,0 +1,48 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_EMPTY_H
#define SOURCE_GROUP_SETTINGS_CXX_EMPTY_H
#include "settings/SourceGroupSettingsCxx.h"
class SourceGroupSettingsCxxEmpty
: public SourceGroupSettingsCxx
{
public:
static std::vector<std::string> getAvailableArchTypes();
static std::vector<std::string> getAvailableVendorTypes();
static std::vector<std::string> getAvailableOsTypes();
static std::vector<std::string> getAvailableEnvironmentTypes();
SourceGroupSettingsCxxEmpty(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsCxxEmpty();
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
bool getTargetOptionsEnabled() const;
void setTargetOptionsEnabled(bool targetOptionsEnabled);
std::string getTargetArch() const;
void setTargetArch(const std::string& arch);
std::string getTargetVendor() const;
void setTargetVendor(const std::string& vendor);
std::string getTargetSys() const;
void setTargetSys(const std::string& sys);
std::string getTargetAbi() const;
void setTargetAbi(const std::string& abi);
std::string getTargetFlag() const;
private:
bool m_targetOptionsEnabled;
std::string m_targetArch;
std::string m_targetVendor;
std::string m_targetSys;
std::string m_targetAbi;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_EMPTY_H
+22 -48
View File
@@ -4,10 +4,8 @@
SourceGroupSettingsJava::SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: SourceGroupSettings(id, type, projectSettings)
, m_useJreSystemLibrary(true)
, m_classpath(std::vector<FilePath>())
, m_mavenProjectFilePath(FilePath())
, m_mavenDependenciesDirectory(FilePath())
, m_shouldIndexMavenTests(false)
{
}
@@ -15,6 +13,26 @@ SourceGroupSettingsJava::~SourceGroupSettingsJava()
{
}
void SourceGroupSettingsJava::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
setClasspath(getPathValues(key + "/class_paths/class_path", config));
setUseJreSystemLibrary(getValue<bool>(key + "/use_jre_system_library", true, config));
}
void SourceGroupSettingsJava::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
setPathValues(key + "/class_paths/class_path", getClasspath(), config);
setValue(key + "/use_jre_system_library", getUseJreSystemLibrary(), config);
}
bool SourceGroupSettingsJava::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJava> otherJava = std::dynamic_pointer_cast<SourceGroupSettingsJava>(other);
@@ -22,11 +40,8 @@ bool SourceGroupSettingsJava::equals(std::shared_ptr<SourceGroupSettings> other)
return (
otherJava &&
SourceGroupSettings::equals(other) &&
utility::isPermutation(m_classpath, otherJava->m_classpath) &&
m_useJreSystemLibrary == otherJava->m_useJreSystemLibrary &&
m_mavenProjectFilePath == otherJava->m_mavenProjectFilePath &&
m_mavenDependenciesDirectory == otherJava->m_mavenDependenciesDirectory &&
m_shouldIndexMavenTests == otherJava->m_shouldIndexMavenTests
utility::isPermutation(m_classpath, otherJava->m_classpath)
);
}
@@ -59,47 +74,6 @@ void SourceGroupSettingsJava::setClasspath(const std::vector<FilePath>& classpat
{
m_classpath = classpath;
}
FilePath SourceGroupSettingsJava::getMavenProjectFilePath() const
{
return m_mavenProjectFilePath;
}
FilePath SourceGroupSettingsJava::getMavenProjectFilePathExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getMavenProjectFilePath());
}
void SourceGroupSettingsJava::setMavenProjectFilePath(const FilePath& path)
{
m_mavenProjectFilePath = path;
}
FilePath SourceGroupSettingsJava::getMavenDependenciesDirectory() const
{
return m_mavenDependenciesDirectory;
}
FilePath SourceGroupSettingsJava::getMavenDependenciesDirectoryExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getMavenDependenciesDirectory());
}
void SourceGroupSettingsJava::setMavenDependenciesDirectory(const FilePath& path)
{
m_mavenDependenciesDirectory = path;
}
bool SourceGroupSettingsJava::getShouldIndexMavenTests() const
{
return m_shouldIndexMavenTests;
}
void SourceGroupSettingsJava::setShouldIndexMavenTests(bool value)
{
m_shouldIndexMavenTests = value;
}
std::vector<std::string> SourceGroupSettingsJava::getDefaultSourceExtensions() const
{
return std::vector<std::string>(1, ".java");
+3 -14
View File
@@ -13,6 +13,9 @@ public:
SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsJava();
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
virtual std::vector<std::string> getAvailableLanguageStandards() const;
@@ -24,26 +27,12 @@ public:
std::vector<FilePath> getClasspathExpandedAndAbsolute() const;
void setClasspath(const std::vector<FilePath>& classpath);
FilePath getMavenProjectFilePath() const;
FilePath getMavenProjectFilePathExpandedAndAbsolute() const;
void setMavenProjectFilePath(const FilePath& path);
FilePath getMavenDependenciesDirectory() const;
FilePath getMavenDependenciesDirectoryExpandedAndAbsolute() const;
void setMavenDependenciesDirectory(const FilePath& path);
bool getShouldIndexMavenTests() const;
void setShouldIndexMavenTests(bool value);
private:
virtual std::vector<std::string> getDefaultSourceExtensions() const;
virtual std::string getDefaultStandard() const;
bool m_useJreSystemLibrary;
std::vector<FilePath> m_classpath;
FilePath m_mavenProjectFilePath;
FilePath m_mavenDependenciesDirectory;
bool m_shouldIndexMavenTests;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_H
@@ -0,0 +1,10 @@
#include "settings/SourceGroupSettingsJavaEmpty.h"
SourceGroupSettingsJavaEmpty::SourceGroupSettingsJavaEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsJava(id, SOURCE_GROUP_JAVA_EMPTY, projectSettings)
{
}
SourceGroupSettingsJavaEmpty::~SourceGroupSettingsJavaEmpty()
{
}
@@ -0,0 +1,14 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
#define SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
#include "settings/SourceGroupSettingsJava.h"
class SourceGroupSettingsJavaEmpty
: public SourceGroupSettingsJava
{
public:
SourceGroupSettingsJavaEmpty(const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsJavaEmpty();
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
@@ -0,0 +1,88 @@
#include "settings/SourceGroupSettingsJavaGradle.h"
SourceGroupSettingsJavaGradle::SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsJava(id, SOURCE_GROUP_JAVA_GRADLE, projectSettings)
, m_gradleProjectFilePath(FilePath())
, m_gradleDependenciesDirectory(FilePath())
, m_shouldIndexGradleTests(false)
{
}
SourceGroupSettingsJavaGradle::~SourceGroupSettingsJavaGradle()
{
}
void SourceGroupSettingsJavaGradle::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsJava::load(config);
const std::string key = s_keyPrefix + getId();
setGradleProjectFilePath(FilePath(getValue<std::string>(key + "/gradle/project_file_path", "", config)));
setGradleDependenciesDirectory(FilePath(getValue<std::string>(key + "/gradle/dependencies_directory", "", config)));
setShouldIndexGradleTests(getValue<bool>(key + "/gradle/should_index_tests", false, config));
}
void SourceGroupSettingsJavaGradle::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsJava::save(config);
const std::string key = s_keyPrefix + getId();
setValue(key + "/gradle/project_file_path", getGradleProjectFilePath().str(), config);
setValue(key + "/gradle/dependencies_directory", getGradleDependenciesDirectory().str(), config);
setValue(key + "/gradle/should_index_tests", getShouldIndexGradleTests(), config);
}
bool SourceGroupSettingsJavaGradle::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJavaGradle> otherJavaGradle = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(other);
return (
otherJavaGradle &&
SourceGroupSettingsJava::equals(other) &&
m_gradleProjectFilePath == otherJavaGradle->m_gradleProjectFilePath &&
m_gradleDependenciesDirectory == otherJavaGradle->m_gradleDependenciesDirectory &&
m_shouldIndexGradleTests == otherJavaGradle->m_shouldIndexGradleTests
);
}
FilePath SourceGroupSettingsJavaGradle::getGradleProjectFilePath() const
{
return m_gradleProjectFilePath;
}
FilePath SourceGroupSettingsJavaGradle::getGradleProjectFilePathExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getGradleProjectFilePath());
}
void SourceGroupSettingsJavaGradle::setGradleProjectFilePath(const FilePath& path)
{
m_gradleProjectFilePath = path;
}
FilePath SourceGroupSettingsJavaGradle::getGradleDependenciesDirectory() const
{
return m_gradleDependenciesDirectory;
}
FilePath SourceGroupSettingsJavaGradle::getGradleDependenciesDirectoryExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getGradleDependenciesDirectory());
}
void SourceGroupSettingsJavaGradle::setGradleDependenciesDirectory(const FilePath& path)
{
m_gradleDependenciesDirectory = path;
}
bool SourceGroupSettingsJavaGradle::getShouldIndexGradleTests() const
{
return m_shouldIndexGradleTests;
}
void SourceGroupSettingsJavaGradle::setShouldIndexGradleTests(bool value)
{
m_shouldIndexGradleTests = value;
}
@@ -0,0 +1,35 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
#define SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
#include "settings/SourceGroupSettingsJava.h"
class SourceGroupSettingsJavaGradle
: public SourceGroupSettingsJava
{
public:
SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsJavaGradle();
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
FilePath getGradleProjectFilePath() const;
FilePath getGradleProjectFilePathExpandedAndAbsolute() const;
void setGradleProjectFilePath(const FilePath& path);
FilePath getGradleDependenciesDirectory() const;
FilePath getGradleDependenciesDirectoryExpandedAndAbsolute() const;
void setGradleDependenciesDirectory(const FilePath& path);
bool getShouldIndexGradleTests() const;
void setShouldIndexGradleTests(bool value);
private:
FilePath m_gradleProjectFilePath;
FilePath m_gradleDependenciesDirectory;
bool m_shouldIndexGradleTests;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
@@ -0,0 +1,88 @@
#include "settings/SourceGroupSettingsJavaMaven.h"
SourceGroupSettingsJavaMaven::SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsJava(id, SOURCE_GROUP_JAVA_MAVEN, projectSettings)
, m_mavenProjectFilePath(FilePath())
, m_mavenDependenciesDirectory(FilePath())
, m_shouldIndexMavenTests(false)
{
}
SourceGroupSettingsJavaMaven::~SourceGroupSettingsJavaMaven()
{
}
void SourceGroupSettingsJavaMaven::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsJava::load(config);
const std::string key = s_keyPrefix + getId();
setMavenProjectFilePath(FilePath(getValue<std::string>(key + "/maven/project_file_path", "", config)));
setMavenDependenciesDirectory(FilePath(getValue<std::string>(key + "/maven/dependencies_directory", "", config)));
setShouldIndexMavenTests(getValue<bool>(key + "/maven/should_index_tests", false, config));
}
void SourceGroupSettingsJavaMaven::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsJava::save(config);
const std::string key = s_keyPrefix + getId();
setValue(key + "/maven/project_file_path", getMavenProjectFilePath().str(), config);
setValue(key + "/maven/dependencies_directory", getMavenDependenciesDirectory().str(), config);
setValue(key + "/maven/should_index_tests", getShouldIndexMavenTests(), config);
}
bool SourceGroupSettingsJavaMaven::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJavaMaven> otherJavaMaven = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(other);
return (
otherJavaMaven &&
SourceGroupSettingsJava::equals(other) &&
m_mavenProjectFilePath == otherJavaMaven->m_mavenProjectFilePath &&
m_mavenDependenciesDirectory == otherJavaMaven->m_mavenDependenciesDirectory &&
m_shouldIndexMavenTests == otherJavaMaven->m_shouldIndexMavenTests
);
}
FilePath SourceGroupSettingsJavaMaven::getMavenProjectFilePath() const
{
return m_mavenProjectFilePath;
}
FilePath SourceGroupSettingsJavaMaven::getMavenProjectFilePathExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getMavenProjectFilePath());
}
void SourceGroupSettingsJavaMaven::setMavenProjectFilePath(const FilePath& path)
{
m_mavenProjectFilePath = path;
}
FilePath SourceGroupSettingsJavaMaven::getMavenDependenciesDirectory() const
{
return m_mavenDependenciesDirectory;
}
FilePath SourceGroupSettingsJavaMaven::getMavenDependenciesDirectoryExpandedAndAbsolute() const
{
return m_projectSettings->makePathExpandedAndAbsolute(getMavenDependenciesDirectory());
}
void SourceGroupSettingsJavaMaven::setMavenDependenciesDirectory(const FilePath& path)
{
m_mavenDependenciesDirectory = path;
}
bool SourceGroupSettingsJavaMaven::getShouldIndexMavenTests() const
{
return m_shouldIndexMavenTests;
}
void SourceGroupSettingsJavaMaven::setShouldIndexMavenTests(bool value)
{
m_shouldIndexMavenTests = value;
}
@@ -0,0 +1,35 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
#define SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
#include "settings/SourceGroupSettingsJava.h"
class SourceGroupSettingsJavaMaven
: public SourceGroupSettingsJava
{
public:
SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsJavaMaven();
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
FilePath getMavenProjectFilePath() const;
FilePath getMavenProjectFilePathExpandedAndAbsolute() const;
void setMavenProjectFilePath(const FilePath& path);
FilePath getMavenDependenciesDirectory() const;
FilePath getMavenDependenciesDirectoryExpandedAndAbsolute() const;
void setMavenDependenciesDirectory(const FilePath& path);
bool getShouldIndexMavenTests() const;
void setShouldIndexMavenTests(bool value);
private:
FilePath m_mavenProjectFilePath;
FilePath m_mavenDependenciesDirectory;
bool m_shouldIndexMavenTests;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
+8
View File
@@ -16,6 +16,8 @@ std::string sourceGroupTypeToString(SourceGroupType v)
return "Java Source Group";
case SOURCE_GROUP_JAVA_MAVEN:
return "Java Source Group from Maven";
case SOURCE_GROUP_JAVA_GRADLE:
return "Java Source Group from Gradle";
case SOURCE_GROUP_UNKNOWN:
break;
}
@@ -38,6 +40,8 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
return "Empty Java Source Group";
case SOURCE_GROUP_JAVA_MAVEN:
return "Java Source Group from Maven";
case SOURCE_GROUP_JAVA_GRADLE:
return "Java Source Group from Gradle";
case SOURCE_GROUP_UNKNOWN:
break;
}
@@ -70,6 +74,10 @@ SourceGroupType stringToSourceGroupType(std::string v)
{
return SOURCE_GROUP_JAVA_MAVEN;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_JAVA_GRADLE))
{
return SOURCE_GROUP_JAVA_GRADLE;
}
return SOURCE_GROUP_UNKNOWN;
}
+1
View File
@@ -11,6 +11,7 @@ enum SourceGroupType
SOURCE_GROUP_CXX_VS,
SOURCE_GROUP_JAVA_EMPTY,
SOURCE_GROUP_JAVA_MAVEN,
SOURCE_GROUP_JAVA_GRADLE,
SOURCE_GROUP_UNKNOWN
};