logic: added C/C++ project setup from Code::Blocks
* also changed xml elements in sourcegroup settings that specify the used language standard, so that one sourcegroup can maintain multiple language standards * added migration and migrated sample projects
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
</description>
|
||||
<source_groups>
|
||||
<source_group_7a9e75fc-2cad-42d5-8c5b-c86d02f7b4e4>
|
||||
<java_standard>8</java_standard>
|
||||
<name>Javaparser Source Group</name>
|
||||
<source_extensions>
|
||||
<source_extension>.java</source_extension>
|
||||
@@ -25,11 +26,10 @@
|
||||
<source_path>./src/main/java</source_path>
|
||||
<source_path>./target/generated-sources/javacc</source_path>
|
||||
</source_paths>
|
||||
<standard>8</standard>
|
||||
<status>enabled</status>
|
||||
<type>Java Source Group</type>
|
||||
<use_jre_system_library>1</use_jre_system_library>
|
||||
</source_group_7a9e75fc-2cad-42d5-8c5b-c86d02f7b4e4>
|
||||
</source_groups>
|
||||
<version>6</version>
|
||||
<version>7</version>
|
||||
</config>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<config>
|
||||
<source_groups>
|
||||
<source_group_afdfade2-4b42-49a6-961a-d4a563f2cf84>
|
||||
<cpp_standard>c++2a</cpp_standard>
|
||||
<cross_compilation>
|
||||
<target>
|
||||
<abi>unknown</abi>
|
||||
@@ -21,10 +22,9 @@
|
||||
<source_paths>
|
||||
<source_path>./src</source_path>
|
||||
</source_paths>
|
||||
<standard>c++2a</standard>
|
||||
<status>enabled</status>
|
||||
<type>C++ Source Group</type>
|
||||
</source_group_afdfade2-4b42-49a6-961a-d4a563f2cf84>
|
||||
</source_groups>
|
||||
<version>6</version>
|
||||
<version>7</version>
|
||||
</config>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
</description>
|
||||
<source_groups>
|
||||
<source_group_75041cb3-37c8-45c6-bb8a-1b8b79040f59>
|
||||
<cpp_standard>c++2a</cpp_standard>
|
||||
<cross_compilation>
|
||||
<target>
|
||||
<abi>unknown</abi>
|
||||
@@ -33,10 +34,9 @@
|
||||
<source_paths>
|
||||
<source_path>./src</source_path>
|
||||
</source_paths>
|
||||
<standard>c++2a</standard>
|
||||
<status>enabled</status>
|
||||
<type>C++ Source Group</type>
|
||||
</source_group_75041cb3-37c8-45c6-bb8a-1b8b79040f59>
|
||||
</source_groups>
|
||||
<version>6</version>
|
||||
<version>7</version>
|
||||
</config>
|
||||
|
||||
@@ -316,8 +316,14 @@ add_files(
|
||||
settings/SourceGroupSettings.h
|
||||
settings/SourceGroupSettingsCxx.cpp
|
||||
settings/SourceGroupSettingsCxx.h
|
||||
settings/SourceGroupSettingsCEmpty.cpp
|
||||
settings/SourceGroupSettingsCEmpty.h
|
||||
settings/SourceGroupSettingsCppEmpty.cpp
|
||||
settings/SourceGroupSettingsCppEmpty.h
|
||||
settings/SourceGroupSettingsCxxCdb.cpp
|
||||
settings/SourceGroupSettingsCxxCdb.h
|
||||
settings/SourceGroupSettingsCxxCodeblocks.cpp
|
||||
settings/SourceGroupSettingsCxxCodeblocks.h
|
||||
settings/SourceGroupSettingsCxxEmpty.cpp
|
||||
settings/SourceGroupSettingsCxxEmpty.h
|
||||
settings/SourceGroupSettingsCxxSonargraph.cpp
|
||||
@@ -334,12 +340,20 @@ add_files(
|
||||
settings/SourceGroupSettingsJavaSonargraph.h
|
||||
settings/SourceGroupSettingsWithClasspath.cpp
|
||||
settings/SourceGroupSettingsWithClasspath.h
|
||||
settings/SourceGroupSettingsWithCppStandard.cpp
|
||||
settings/SourceGroupSettingsWithCppStandard.h
|
||||
settings/SourceGroupSettingsWithCStandard.cpp
|
||||
settings/SourceGroupSettingsWithCStandard.h
|
||||
settings/SourceGroupSettingsWithExcludeFilters.cpp
|
||||
settings/SourceGroupSettingsWithExcludeFilters.h
|
||||
settings/SourceGroupSettingsWithIndexedHeaderPaths.cpp
|
||||
settings/SourceGroupSettingsWithIndexedHeaderPaths.h
|
||||
settings/SourceGroupSettingsWithJavaStandard.cpp
|
||||
settings/SourceGroupSettingsWithJavaStandard.h
|
||||
settings/SourceGroupSettingsWithSonargraphProjectPath.cpp
|
||||
settings/SourceGroupSettingsWithSonargraphProjectPath.h
|
||||
settings/SourceGroupSettingsWithSourceExtensions.cpp
|
||||
settings/SourceGroupSettingsWithSourceExtensions.h
|
||||
settings/SourceGroupSettingsWithSourcePaths.cpp
|
||||
settings/SourceGroupSettingsWithSourcePaths.h
|
||||
settings/SourceGroupStatusType.cpp
|
||||
|
||||
@@ -43,6 +43,8 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
#include "settings/migration/SettingsMigrationDeleteKey.h"
|
||||
#include "settings/migration/SettingsMigrationLambda.h"
|
||||
#include "settings/migration/SettingsMigrationMoveKey.h"
|
||||
#include "settings/SourceGroupSettingsCEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCppEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsJavaEmpty.h"
|
||||
#include "settings/SourceGroupSettingsJavaMaven.h"
|
||||
@@ -14,7 +16,7 @@
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/utilityUuid.h"
|
||||
|
||||
const size_t ProjectSettings::VERSION = 6;
|
||||
const size_t ProjectSettings::VERSION = 7;
|
||||
const wchar_t PROJECT_FILE_EXTENSION[] = L".srctrlprj";
|
||||
|
||||
LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
@@ -144,14 +146,17 @@ 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);
|
||||
settings = std::make_shared<SourceGroupSettingsCEmpty>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxEmpty>(id, SOURCE_GROUP_CPP_EMPTY, this);
|
||||
settings = std::make_shared<SourceGroupSettingsCppEmpty>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxCdb>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxCodeblocks>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxSonargraph>(id, this);
|
||||
break;
|
||||
@@ -337,6 +342,26 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings : getAllSourceGroupSettings())
|
||||
{
|
||||
std::string languageName;
|
||||
switch (getLanguageTypeForSourceGroupType(sourceGroupSettings->getType()))
|
||||
{
|
||||
case LANGUAGE_C:
|
||||
languageName = "c";
|
||||
break;
|
||||
case LANGUAGE_CPP:
|
||||
languageName = "cpp";
|
||||
break;
|
||||
case LANGUAGE_JAVA:
|
||||
languageName = "java";
|
||||
break;
|
||||
}
|
||||
|
||||
std::string key = SourceGroupSettings::s_keyPrefix + sourceGroupSettings->getId();
|
||||
migrator.addMigration(7, std::make_shared<SettingsMigrationMoveKey>(key + "/standard", key + "/" + languageName + "_standard"));
|
||||
}
|
||||
|
||||
return migrator;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ SourceGroupSettings::SourceGroupSettings(
|
||||
, m_name(sourceGroupTypeToString(type))
|
||||
, m_type(type)
|
||||
, m_status(SOURCE_GROUP_STATUS_ENABLED)
|
||||
, m_standard("")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,7 +28,6 @@ void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config)
|
||||
}
|
||||
|
||||
setStatus(stringToSourceGroupStatusType(config->getValueOrDefault(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED))));
|
||||
setStandard(config->getValueOrDefault<std::string>(key + "/standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
|
||||
@@ -38,7 +36,6 @@ void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
config->setValue(key + "/status", sourceGroupStatusTypeToString(getStatus()));
|
||||
config->setValue(key + "/name", getName());
|
||||
config->setValue(key + "/standard", getStandard());
|
||||
}
|
||||
|
||||
bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
@@ -47,8 +44,7 @@ bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) con
|
||||
m_id == other->m_id &&
|
||||
m_name == other->m_name &&
|
||||
m_type == other->m_type &&
|
||||
m_status == other->m_status &&
|
||||
m_standard == other->m_standard
|
||||
m_status == other->m_status
|
||||
);
|
||||
}
|
||||
|
||||
@@ -106,17 +102,3 @@ std::vector<FilePath> SourceGroupSettings::makePathsExpandedAndAbsolute(const st
|
||||
{
|
||||
return m_projectSettings->makePathsExpandedAndAbsolute(paths);
|
||||
}
|
||||
|
||||
std::string SourceGroupSettings::getStandard() const
|
||||
{
|
||||
if (m_standard.empty())
|
||||
{
|
||||
return getDefaultStandard();
|
||||
}
|
||||
return m_standard;
|
||||
}
|
||||
|
||||
void SourceGroupSettings::setStandard(const std::string& standard)
|
||||
{
|
||||
m_standard = standard;
|
||||
}
|
||||
|
||||
@@ -42,23 +42,14 @@ public:
|
||||
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
|
||||
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
|
||||
|
||||
virtual std::vector<std::string> getAvailableLanguageStandards() const = 0;
|
||||
|
||||
std::string getStandard() const;
|
||||
void setStandard(const std::string& standard);
|
||||
|
||||
protected:
|
||||
const ProjectSettings* m_projectSettings;
|
||||
|
||||
private:
|
||||
virtual std::string getDefaultStandard() const = 0;
|
||||
|
||||
std::string m_id;
|
||||
std::string m_name;
|
||||
const SourceGroupType m_type;
|
||||
SourceGroupStatusType m_status;
|
||||
|
||||
std::string m_standard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_H
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#include "settings/SourceGroupSettingsCEmpty.h"
|
||||
|
||||
SourceGroupSettingsCEmpty::SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsCxxEmpty(id, SOURCE_GROUP_C_EMPTY, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCEmpty::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCStandard::load(config, key);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCStandard::save(config, key);
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsCEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCEmpty> otherCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(other);
|
||||
|
||||
return (
|
||||
otherCxxEmpty &&
|
||||
SourceGroupSettingsCxxEmpty::equals(other) &&
|
||||
SourceGroupSettingsWithCStandard::equals(otherCxxEmpty)
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return { L".c" };
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_C_EMPTY_H
|
||||
#define SOURCE_GROUP_SETTINGS_C_EMPTY_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
|
||||
class SourceGroupSettingsCEmpty
|
||||
: public SourceGroupSettingsCxxEmpty
|
||||
, public SourceGroupSettingsWithCStandard
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings);
|
||||
|
||||
void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_C_EMPTY_H
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "settings/SourceGroupSettingsCppEmpty.h"
|
||||
|
||||
SourceGroupSettingsCppEmpty::SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsCxxEmpty(id, SOURCE_GROUP_CPP_EMPTY, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCppEmpty::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::load(config, key);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCppEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::save(config, key);
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsCppEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCppEmpty> otherCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(other);
|
||||
|
||||
return (
|
||||
otherCxxEmpty &&
|
||||
SourceGroupSettingsCxxEmpty::equals(other) &&
|
||||
SourceGroupSettingsWithCppStandard::equals(otherCxxEmpty)
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCppEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCppEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
L".cpp",
|
||||
L".cxx",
|
||||
L".cc"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
|
||||
#define SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
|
||||
class SourceGroupSettingsCppEmpty
|
||||
: public SourceGroupSettingsCxxEmpty
|
||||
, public SourceGroupSettingsWithCppStandard
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings);
|
||||
|
||||
void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
|
||||
@@ -47,60 +47,6 @@ bool SourceGroupSettingsCxx::equals(std::shared_ptr<SourceGroupSettings> other)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsCxx::getAvailableLanguageStandards() const
|
||||
{
|
||||
std::vector<std::string> standards;
|
||||
|
||||
switch (getType())
|
||||
{
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
standards.push_back("c++2a");
|
||||
standards.push_back("gnu++2a");
|
||||
|
||||
standards.push_back("c++17");
|
||||
standards.push_back("gnu++17");
|
||||
|
||||
standards.push_back("c++14");
|
||||
standards.push_back("gnu++14");
|
||||
|
||||
standards.push_back("c++11");
|
||||
standards.push_back("gnu++11");
|
||||
|
||||
standards.push_back("c++03");
|
||||
standards.push_back("gnu++03");
|
||||
|
||||
standards.push_back("c++98");
|
||||
standards.push_back("gnu++98");
|
||||
break;
|
||||
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
standards.push_back("c11");
|
||||
standards.push_back("gnu11");
|
||||
standards.push_back("iso9899:2011");
|
||||
|
||||
standards.push_back("c99");
|
||||
standards.push_back("gnu99");
|
||||
standards.push_back("iso9899:1999");
|
||||
|
||||
standards.push_back("iso9899:199409");
|
||||
|
||||
standards.push_back("c90");
|
||||
standards.push_back("gnu90");
|
||||
standards.push_back("iso9899:1990");
|
||||
|
||||
standards.push_back("c89");
|
||||
standards.push_back("gnu89");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return standards;
|
||||
}
|
||||
|
||||
std::vector<FilePath> SourceGroupSettingsCxx::getHeaderSearchPaths() const
|
||||
{
|
||||
return m_headerSearchPaths;
|
||||
@@ -140,20 +86,3 @@ void SourceGroupSettingsCxx::setCompilerFlags(const std::vector<std::wstring>& c
|
||||
{
|
||||
m_compilerFlags = compilerFlags;
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsCxx::getDefaultStandard() const
|
||||
{
|
||||
switch (getType())
|
||||
{
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return "c++17";
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
return "c11";
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
class SourceGroupSettingsCxx
|
||||
: public SourceGroupSettings
|
||||
{
|
||||
@@ -14,8 +16,6 @@ public:
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
std::vector<FilePath> getHeaderSearchPaths() const;
|
||||
std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const;
|
||||
void setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths);
|
||||
@@ -28,8 +28,6 @@ public:
|
||||
void setCompilerFlags(const std::vector<std::wstring>& compilerFlags);
|
||||
|
||||
private:
|
||||
std::string getDefaultStandard() const override;
|
||||
|
||||
std::vector<FilePath> m_headerSearchPaths;
|
||||
std::vector<FilePath> m_frameworkSearchPaths;
|
||||
std::vector<std::wstring> m_compilerFlags;
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "utility/ConfigManager.h"
|
||||
|
||||
SourceGroupSettingsCxxCodeblocks::SourceGroupSettingsCxxCodeblocks(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CXX_CODEBLOCKS, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCxxCodeblocks::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxx::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::load(config, key);
|
||||
SourceGroupSettingsWithCStandard::load(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
|
||||
setCodeblocksProjectPath(config->getValueOrDefault(key + "/codeblocks_project_path", FilePath(L"")));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCxxCodeblocks::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxx::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::save(config, key);
|
||||
SourceGroupSettingsWithCStandard::save(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::save(config, key);
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
|
||||
config->setValue(key + "/codeblocks_project_path", getCodeblocksProjectPath().wstr());
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsCxxCodeblocks::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> otherCxxCodeblocks = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(other);
|
||||
|
||||
return (
|
||||
otherCxxCodeblocks &&
|
||||
SourceGroupSettingsCxx::equals(other) &&
|
||||
SourceGroupSettingsWithCppStandard::equals(otherCxxCodeblocks) &&
|
||||
SourceGroupSettingsWithCStandard::equals(otherCxxCodeblocks) &&
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxCodeblocks) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherCxxCodeblocks) &&
|
||||
m_codeblocksProjectPath == otherCxxCodeblocks->m_codeblocksProjectPath
|
||||
);
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettingsCxxCodeblocks::getCodeblocksProjectPath() const
|
||||
{
|
||||
return m_codeblocksProjectPath;
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettingsCxxCodeblocks::getCodeblocksProjectPathExpandedAndAbsolute() const
|
||||
{
|
||||
return m_projectSettings->makePathExpandedAndAbsolute(getCodeblocksProjectPath());
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCxxCodeblocks::setCodeblocksProjectPath(const FilePath& compilationDatabasePath)
|
||||
{
|
||||
m_codeblocksProjectPath = compilationDatabasePath;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCxxCodeblocks::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCxxCodeblocks::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
L".c",
|
||||
L".cpp",
|
||||
L".cxx",
|
||||
L".cc"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
|
||||
#define SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
|
||||
class SourceGroupSettingsCxxCodeblocks
|
||||
: public SourceGroupSettingsCxx
|
||||
, public SourceGroupSettingsWithCppStandard
|
||||
, public SourceGroupSettingsWithCStandard
|
||||
, public SourceGroupSettingsWithIndexedHeaderPaths
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCxxCodeblocks(const std::string& id, const ProjectSettings* projectSettings);
|
||||
|
||||
void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
FilePath getCodeblocksProjectPath() const;
|
||||
FilePath getCodeblocksProjectPathExpandedAndAbsolute() const;
|
||||
void setCodeblocksProjectPath(const FilePath& compilationDatabasePath);
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
FilePath m_codeblocksProjectPath;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
|
||||
@@ -157,6 +157,7 @@ void SourceGroupSettingsCxxEmpty::load(std::shared_ptr<const ConfigManager> conf
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::load(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
|
||||
@@ -173,6 +174,7 @@ void SourceGroupSettingsCxxEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::save(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
|
||||
@@ -190,6 +192,7 @@ bool SourceGroupSettingsCxxEmpty::equals(std::shared_ptr<SourceGroupSettings> ot
|
||||
return (
|
||||
otherCxxEmpty &&
|
||||
SourceGroupSettingsCxx::equals(other) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherCxxEmpty) &&
|
||||
SourceGroupSettingsWithSourcePaths::equals(otherCxxEmpty) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherCxxEmpty) &&
|
||||
getTargetFlag() == otherCxxEmpty->getTargetFlag()
|
||||
@@ -258,30 +261,4 @@ std::wstring SourceGroupSettingsCxxEmpty::getTargetFlag() const
|
||||
targetFlag += L"-" + (m_targetAbi.empty() ? L"unknown" : m_targetAbi);
|
||||
}
|
||||
return targetFlag;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCxxEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
std::vector<std::wstring> defaultValues;
|
||||
|
||||
switch (getType())
|
||||
{
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
defaultValues.push_back(L".cpp");
|
||||
defaultValues.push_back(L".cxx");
|
||||
defaultValues.push_back(L".cc");
|
||||
break;
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
defaultValues.push_back(L".c");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return defaultValues;
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,13 @@
|
||||
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
|
||||
class SourceGroupSettingsCxxEmpty
|
||||
: public SourceGroupSettingsCxx
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
, public SourceGroupSettingsWithSourcePaths
|
||||
{
|
||||
public:
|
||||
@@ -41,9 +43,6 @@ public:
|
||||
std::wstring getTargetFlag() const;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
bool m_targetOptionsEnabled;
|
||||
std::wstring m_targetArch;
|
||||
std::wstring m_targetVendor;
|
||||
|
||||
@@ -11,6 +11,7 @@ void SourceGroupSettingsCxxSonargraph::load(std::shared_ptr<const ConfigManager>
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::load(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::load(config, key);
|
||||
}
|
||||
@@ -21,6 +22,7 @@ void SourceGroupSettingsCxxSonargraph::save(std::shared_ptr<ConfigManager> confi
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::save(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::save(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::save(config, key);
|
||||
}
|
||||
@@ -32,7 +34,8 @@ bool SourceGroupSettingsCxxSonargraph::equals(std::shared_ptr<SourceGroupSetting
|
||||
return (
|
||||
otherCxxSonargraph &&
|
||||
SourceGroupSettingsCxx::equals(other) &&
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxSonargraph) &&
|
||||
SourceGroupSettingsWithCppStandard::equals(otherCxxSonargraph) &&
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxSonargraph) &&
|
||||
SourceGroupSettingsWithSonargraphProjectPath::equals(otherCxxSonargraph)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
#define SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
|
||||
class SourceGroupSettingsCxxSonargraph
|
||||
: public SourceGroupSettingsCxx
|
||||
, public SourceGroupSettingsWithCppStandard
|
||||
, public SourceGroupSettingsWithIndexedHeaderPaths
|
||||
, public SourceGroupSettingsWithSonargraphProjectPath
|
||||
{
|
||||
|
||||
@@ -10,9 +10,11 @@ void SourceGroupSettingsJava::load(std::shared_ptr<const ConfigManager> config)
|
||||
SourceGroupSettings::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::load(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
SourceGroupSettingsWithJavaStandard::load(config, key);
|
||||
SourceGroupSettingsWithClasspath::load(config, key);
|
||||
}
|
||||
|
||||
@@ -22,8 +24,10 @@ void SourceGroupSettingsJava::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::save(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
SourceGroupSettingsWithJavaStandard::save(config, key);
|
||||
SourceGroupSettingsWithClasspath::save(config, key);
|
||||
}
|
||||
|
||||
@@ -34,17 +38,14 @@ bool SourceGroupSettingsJava::equals(std::shared_ptr<SourceGroupSettings> other)
|
||||
return (
|
||||
otherJava &&
|
||||
SourceGroupSettings::equals(other) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherJava) &&
|
||||
SourceGroupSettingsWithSourcePaths::equals(otherJava) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherJava) &&
|
||||
SourceGroupSettingsWithJavaStandard::equals(otherJava) &&
|
||||
SourceGroupSettingsWithClasspath::equals(otherJava)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsJava::getAvailableLanguageStandards() const
|
||||
{
|
||||
return std::vector<std::string>{"1", "2", "3", "4", "5", "6", "7", "8"};
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJava::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
@@ -54,8 +55,3 @@ std::vector<std::wstring> SourceGroupSettingsJava::getDefaultSourceExtensions()
|
||||
{
|
||||
return { L".java" };
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsJava::getDefaultStandard() const
|
||||
{
|
||||
return "8";
|
||||
}
|
||||
|
||||
@@ -7,12 +7,16 @@
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "settings/SourceGroupSettingsWithClasspath.h"
|
||||
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
|
||||
class SourceGroupSettingsJava
|
||||
: public SourceGroupSettings
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
, public SourceGroupSettingsWithSourcePaths
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithJavaStandard
|
||||
, public SourceGroupSettingsWithClasspath
|
||||
{
|
||||
public:
|
||||
@@ -23,12 +27,9 @@ public:
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
std::string getDefaultStandard() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_JAVA_H
|
||||
|
||||
@@ -12,6 +12,7 @@ void SourceGroupSettingsJavaSonargraph::load(std::shared_ptr<const ConfigManager
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithClasspath::load(config, key);
|
||||
SourceGroupSettingsWithJavaStandard::load(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::load(config, key);
|
||||
}
|
||||
|
||||
@@ -22,6 +23,7 @@ void SourceGroupSettingsJavaSonargraph::save(std::shared_ptr<ConfigManager> conf
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithClasspath::save(config, key);
|
||||
SourceGroupSettingsWithJavaStandard::save(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::save(config, key);
|
||||
}
|
||||
|
||||
@@ -33,20 +35,11 @@ bool SourceGroupSettingsJavaSonargraph::equals(std::shared_ptr<SourceGroupSettin
|
||||
otherJavaSonargraph &&
|
||||
SourceGroupSettings::equals(other) &&
|
||||
SourceGroupSettingsWithClasspath::equals(otherJavaSonargraph) &&
|
||||
SourceGroupSettingsWithJavaStandard::equals(otherJavaSonargraph) &&
|
||||
SourceGroupSettingsWithSonargraphProjectPath::equals(otherJavaSonargraph)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsJavaSonargraph::getAvailableLanguageStandards() const
|
||||
{
|
||||
return std::vector<std::string>{"1", "2", "3", "4", "5", "6", "7", "8"};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsJavaSonargraph::getDefaultStandard() const
|
||||
{
|
||||
return "8";
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJavaSonargraph::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "settings/SourceGroupSettingsWithClasspath.h"
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
|
||||
class SourceGroupSettingsJavaSonargraph
|
||||
: public SourceGroupSettings
|
||||
, public SourceGroupSettingsWithClasspath
|
||||
, public SourceGroupSettingsWithJavaStandard
|
||||
, public SourceGroupSettingsWithSonargraphProjectPath
|
||||
{
|
||||
public:
|
||||
@@ -18,10 +20,7 @@ public:
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
private:
|
||||
std::string getDefaultStandard() const override;
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
std::string SourceGroupSettingsWithCStandard::getDefaultCStandardStatic()
|
||||
{
|
||||
return "c11";
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithCStandard::equals(std::shared_ptr<SourceGroupSettingsWithCStandard> other) const
|
||||
{
|
||||
return (
|
||||
other &&
|
||||
m_cStandard == other->m_cStandard
|
||||
);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCStandard::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
|
||||
{
|
||||
setCStandard(config->getValueOrDefault<std::string>(key + "/c_standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/c_standard", getCStandard());
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCStandard::getCStandard() const
|
||||
{
|
||||
if (m_cStandard.empty())
|
||||
{
|
||||
return getDefaultCStandard();
|
||||
}
|
||||
return m_cStandard;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCStandard::setCStandard(const std::string& standard)
|
||||
{
|
||||
m_cStandard = standard;
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsWithCStandard::getAvailableCStandards() const
|
||||
{
|
||||
return {
|
||||
"c11",
|
||||
"gnu11",
|
||||
"iso9899:2011",
|
||||
"c99",
|
||||
"gnu99",
|
||||
"iso9899:1999",
|
||||
"iso9899:199409",
|
||||
"c90",
|
||||
"gnu90",
|
||||
"iso9899:1990",
|
||||
"c89",
|
||||
"gnu89"
|
||||
};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCStandard::getDefaultCStandard() const
|
||||
{
|
||||
return getDefaultCStandardStatic();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithCStandard
|
||||
{
|
||||
public:
|
||||
static std::string getDefaultCStandardStatic();
|
||||
|
||||
SourceGroupSettingsWithCStandard() = default;
|
||||
virtual ~SourceGroupSettingsWithCStandard() = default;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithCStandard> other) const;
|
||||
|
||||
std::string getCStandard() const;
|
||||
void setCStandard(const std::string& standard);
|
||||
|
||||
std::vector<std::string> getAvailableCStandards() const;
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::string getDefaultCStandard() const;
|
||||
|
||||
std::string m_cStandard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
std::string SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic()
|
||||
{
|
||||
return "c++17";
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithCppStandard::equals(std::shared_ptr<SourceGroupSettingsWithCppStandard> other) const
|
||||
{
|
||||
return (
|
||||
other &&
|
||||
m_cppStandard == other->m_cppStandard
|
||||
);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCppStandard::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
|
||||
{
|
||||
setCppStandard(config->getValueOrDefault<std::string>(key + "/cpp_standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCppStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/cpp_standard", getCppStandard());
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCppStandard::getCppStandard() const
|
||||
{
|
||||
if (m_cppStandard.empty())
|
||||
{
|
||||
return getDefaultCppStandard();
|
||||
}
|
||||
return m_cppStandard;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCppStandard::setCppStandard(const std::string& standard)
|
||||
{
|
||||
m_cppStandard = standard;
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsWithCppStandard::getAvailableCppStandards() const
|
||||
{
|
||||
return {
|
||||
"c++2a",
|
||||
"gnu++2a",
|
||||
"c++17",
|
||||
"gnu++17",
|
||||
"c++14",
|
||||
"gnu++14",
|
||||
"c++11",
|
||||
"gnu++11",
|
||||
"c++03",
|
||||
"gnu++03",
|
||||
"c++98",
|
||||
"gnu++98"
|
||||
};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCppStandard::getDefaultCppStandard() const
|
||||
{
|
||||
return getDefaultCppStandardStatic();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithCppStandard
|
||||
{
|
||||
public:
|
||||
static std::string getDefaultCppStandardStatic();
|
||||
|
||||
SourceGroupSettingsWithCppStandard() = default;
|
||||
virtual ~SourceGroupSettingsWithCppStandard() = default;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithCppStandard> other) const;
|
||||
|
||||
std::string getCppStandard() const;
|
||||
void setCppStandard(const std::string& standard);
|
||||
|
||||
std::vector<std::string> getAvailableCppStandards() const;
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::string getDefaultCppStandard() const;
|
||||
|
||||
std::string m_cppStandard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
std::string SourceGroupSettingsWithJavaStandard::getDefaultJavaStandardStatic()
|
||||
{
|
||||
return "8";
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithJavaStandard::equals(std::shared_ptr<SourceGroupSettingsWithJavaStandard> other) const
|
||||
{
|
||||
return (
|
||||
other &&
|
||||
m_javaStandard == other->m_javaStandard
|
||||
);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithJavaStandard::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
|
||||
{
|
||||
setJavaStandard(config->getValueOrDefault<std::string>(key + "/java_standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithJavaStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/java_standard", getJavaStandard());
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithJavaStandard::getJavaStandard() const
|
||||
{
|
||||
if (m_javaStandard.empty())
|
||||
{
|
||||
return getDefaultJavaStandard();
|
||||
}
|
||||
return m_javaStandard;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithJavaStandard::setJavaStandard(const std::string& standard)
|
||||
{
|
||||
m_javaStandard = standard;
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsWithJavaStandard::getAvailableJavaStandards() const
|
||||
{
|
||||
return {"1", "2", "3", "4", "5", "6", "7", "8"};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithJavaStandard::getDefaultJavaStandard() const
|
||||
{
|
||||
return getDefaultJavaStandardStatic();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithJavaStandard
|
||||
{
|
||||
public:
|
||||
static std::string getDefaultJavaStandardStatic();
|
||||
|
||||
SourceGroupSettingsWithJavaStandard() = default;
|
||||
virtual ~SourceGroupSettingsWithJavaStandard() = default;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithJavaStandard> other) const;
|
||||
|
||||
std::string getJavaStandard() const;
|
||||
void setJavaStandard(const std::string& standard);
|
||||
|
||||
std::vector<std::string> getAvailableJavaStandards() const;
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::string getDefaultJavaStandard() const;
|
||||
|
||||
std::string m_javaStandard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::SourceGroupSettingsWithSourceExtensions()
|
||||
: m_sourceExtensions(std::vector<std::wstring>())
|
||||
{
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithSourceExtensions::equals(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> other) const
|
||||
{
|
||||
return utility::isPermutation(m_sourceExtensions, other->m_sourceExtensions);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourceExtensions::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
|
||||
{
|
||||
setSourceExtensions(config->getValuesOrDefaults(key + "/source_extensions/source_extension", std::vector<std::wstring>()));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourceExtensions::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValues(key + "/source_extensions/source_extension", getSourceExtensions());
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsWithSourceExtensions::getSourceExtensions() const
|
||||
{
|
||||
if (m_sourceExtensions.empty())
|
||||
{
|
||||
return getDefaultSourceExtensions();
|
||||
}
|
||||
return m_sourceExtensions;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourceExtensions::setSourceExtensions(const std::vector<std::wstring>& sourceExtensions)
|
||||
{
|
||||
m_sourceExtensions = sourceExtensions;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class FilePath;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithSourceExtensions
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsWithSourceExtensions();
|
||||
virtual ~SourceGroupSettingsWithSourceExtensions() = default;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> other) const;
|
||||
|
||||
std::vector<std::wstring> getSourceExtensions() const;
|
||||
void setSourceExtensions(const std::vector<std::wstring>& sourceExtensions);
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
|
||||
|
||||
std::vector<std::wstring> m_sourceExtensions;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
|
||||
@@ -5,28 +5,22 @@
|
||||
|
||||
SourceGroupSettingsWithSourcePaths::SourceGroupSettingsWithSourcePaths()
|
||||
: m_sourcePaths(std::vector<FilePath>())
|
||||
, m_sourceExtensions(std::vector<std::wstring>())
|
||||
{
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithSourcePaths::equals(std::shared_ptr<SourceGroupSettingsWithSourcePaths> other) const
|
||||
{
|
||||
return (
|
||||
utility::isPermutation(m_sourcePaths, other->m_sourcePaths) &&
|
||||
utility::isPermutation(m_sourceExtensions, other->m_sourceExtensions)
|
||||
);
|
||||
return utility::isPermutation(m_sourcePaths, other->m_sourcePaths);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourcePaths::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
|
||||
{
|
||||
setSourcePaths(config->getValuesOrDefaults(key + "/source_paths/source_path", std::vector<FilePath>()));
|
||||
setSourceExtensions(config->getValuesOrDefaults(key + "/source_extensions/source_extension", std::vector<std::wstring>()));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourcePaths::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValues(key + "/source_paths/source_path", getSourcePaths());
|
||||
config->setValues(key + "/source_extensions/source_extension", getSourceExtensions());
|
||||
}
|
||||
|
||||
std::vector<FilePath> SourceGroupSettingsWithSourcePaths::getSourcePaths() const
|
||||
@@ -43,17 +37,3 @@ void SourceGroupSettingsWithSourcePaths::setSourcePaths(const std::vector<FilePa
|
||||
{
|
||||
m_sourcePaths = sourcePaths;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsWithSourcePaths::getSourceExtensions() const
|
||||
{
|
||||
if (m_sourceExtensions.empty())
|
||||
{
|
||||
return getDefaultSourceExtensions();
|
||||
}
|
||||
return m_sourceExtensions;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourcePaths::setSourceExtensions(const std::vector<std::wstring>& sourceExtensions)
|
||||
{
|
||||
m_sourceExtensions = sourceExtensions;
|
||||
}
|
||||
|
||||
@@ -21,19 +21,14 @@ public:
|
||||
std::vector<FilePath> getSourcePathsExpandedAndAbsolute() const;
|
||||
void setSourcePaths(const std::vector<FilePath>& sourcePaths);
|
||||
|
||||
std::vector<std::wstring> getSourceExtensions() const;
|
||||
void setSourceExtensions(const std::vector<std::wstring>& sourceExtensions);
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
|
||||
|
||||
std::vector<FilePath> m_sourcePaths;
|
||||
std::vector<std::wstring> m_sourceExtensions;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H
|
||||
|
||||
@@ -10,6 +10,8 @@ std::string sourceGroupTypeToString(SourceGroupType v)
|
||||
return "C++ Source Group";
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
return "C/C++ from Compilation Database";
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
return "C/C++ from Code::Blocks";
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return "C/C++ from Sonargraph";
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
@@ -38,6 +40,8 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
|
||||
return "Empty C++ Source Group";
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
return "C/C++ from Compilation Database";
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
return "C/C++ from Code::Blocks";
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return "C/C++ from Sonargraph";
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
@@ -70,6 +74,10 @@ SourceGroupType stringToSourceGroupType(const std::string& v)
|
||||
{
|
||||
return SOURCE_GROUP_CXX_CDB;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_CODEBLOCKS))
|
||||
{
|
||||
return SOURCE_GROUP_CXX_CODEBLOCKS;
|
||||
}
|
||||
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_SONARGRAPH))
|
||||
{
|
||||
return SOURCE_GROUP_CXX_SONARGRAPH;
|
||||
|
||||
@@ -8,6 +8,7 @@ enum SourceGroupType
|
||||
SOURCE_GROUP_C_EMPTY,
|
||||
SOURCE_GROUP_CPP_EMPTY,
|
||||
SOURCE_GROUP_CXX_CDB,
|
||||
SOURCE_GROUP_CXX_CODEBLOCKS,
|
||||
SOURCE_GROUP_CXX_SONARGRAPH,
|
||||
SOURCE_GROUP_CXX_VS,
|
||||
SOURCE_GROUP_JAVA_EMPTY,
|
||||
|
||||
@@ -344,7 +344,7 @@ FilePath FilePath::getLowerCase() const
|
||||
|
||||
bool FilePath::contains(const FilePath& other) const
|
||||
{
|
||||
if (!isDirectory())
|
||||
if (exists() && !isDirectory())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -60,11 +60,6 @@ namespace Sonargraph
|
||||
return m_softwareSystem->getModules().size();
|
||||
}
|
||||
|
||||
std::set<FilePath> Project::getAllSourcePaths() const
|
||||
{
|
||||
return m_softwareSystem->getAllSourcePaths();
|
||||
}
|
||||
|
||||
std::set<FilePath> Project::getAllSourceFilePathsCanonical() const
|
||||
{
|
||||
return m_softwareSystem->getAllSourceFilePathsCanonical();
|
||||
@@ -75,11 +70,6 @@ namespace Sonargraph
|
||||
return m_softwareSystem->getAllCxxHeaderSearchPathsCanonical();
|
||||
}
|
||||
|
||||
std::set<FilePath> Project::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
return m_softwareSystem->filterToContainedFilePaths(filePaths);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> Project::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
|
||||
@@ -32,10 +32,8 @@ namespace Sonargraph
|
||||
|
||||
int getLoadedModuleCount() const;
|
||||
|
||||
std::set<FilePath> getAllSourcePaths() const;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const;
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const;
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
|
||||
@@ -90,16 +90,6 @@ namespace Sonargraph
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SoftwareSystem::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
std::set<FilePath> containedFilePaths;
|
||||
for (std::shared_ptr<XsdAbstractModule> module : m_modules)
|
||||
{
|
||||
utility::append(containedFilePaths, module->filterToContainedFilePaths(filePaths));
|
||||
}
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SoftwareSystem::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace Sonargraph
|
||||
std::set<FilePath> getAllSourcePaths() const;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const;
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const;
|
||||
|
||||
template <typename ExtensionType>
|
||||
std::vector<std::shared_ptr<ExtensionType>> getSpecificSystemExtensions() const;
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace Sonargraph
|
||||
virtual std::set<FilePath> getAllSourcePaths() const = 0;
|
||||
virtual std::set<FilePath> getAllSourceFilePathsCanonical() const = 0;
|
||||
virtual std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const = 0;
|
||||
virtual std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const = 0;
|
||||
|
||||
std::shared_ptr<const SoftwareSystem> getSoftwareSystem() const;
|
||||
std::vector<FilePathFilter> getDerivedExcludeFilters() const;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "settings/LanguageType.h"
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/sonargraph/SonargraphSoftwareSystem.h"
|
||||
@@ -177,75 +179,45 @@ namespace Sonargraph
|
||||
return headerSearchPaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdCmakeJsonModule::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
const std::set<FilePath> indexedPaths = getAllSourcePaths();
|
||||
const std::vector<FilePathFilter> excludeFilters = getDerivedExcludeFilters();
|
||||
const std::vector<FilePathFilter> includeFilters = getDerivedIncludeFilters();
|
||||
|
||||
std::set<FilePath> containedFilePaths;
|
||||
for (const FilePath& filePath : filePaths)
|
||||
{
|
||||
bool isInIndexedPaths = false;
|
||||
for (const FilePath& indexedPath : indexedPaths)
|
||||
{
|
||||
if (indexedPath == filePath || indexedPath.contains(filePath))
|
||||
{
|
||||
isInIndexedPaths = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInIndexedPaths)
|
||||
{
|
||||
for (const FilePathFilter& excludeFilter : excludeFilters)
|
||||
{
|
||||
if (excludeFilter.isMatching(filePath))
|
||||
{
|
||||
isInIndexedPaths = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isInIndexedPaths)
|
||||
{
|
||||
for (const FilePathFilter& includeFilter : includeFilters)
|
||||
{
|
||||
if (includeFilter.isMatching(filePath))
|
||||
{
|
||||
isInIndexedPaths = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isInIndexedPaths)
|
||||
{
|
||||
containedFilePaths.insert(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> XsdCmakeJsonModule::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
std::string languageStandard = SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic();
|
||||
|
||||
if (std::shared_ptr<const SourceGroupSettingsCxxSonargraph> sonargraphSettings =
|
||||
std::dynamic_pointer_cast<const SourceGroupSettingsCxxSonargraph>(sourceGroupSettings))
|
||||
{
|
||||
indexedHeaderPaths = utility::toSet(sonargraphSettings->getIndexedHeaderPathsExpandedAndAbsolute());
|
||||
languageStandard = sonargraphSettings->getCppStandard();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Source group doesn't specify language standard. Falling back to \"" + languageStandard + "\".");
|
||||
LOG_ERROR("Source group doesn't specify any indexed header paths");
|
||||
}
|
||||
|
||||
const std::vector<FilePath> systemHeaderSearchPaths = (appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>());
|
||||
const std::vector<FilePath> frameworkSearchPaths = (appSettings ? appSettings->getFrameworkSearchPathsExpanded() : std::vector<FilePath>());
|
||||
|
||||
for (std::shared_ptr<XsdRootPath> rootPath : getRootPaths())
|
||||
{
|
||||
if (std::shared_ptr<XsdRootPathWithFiles> rootPathWithFiles = std::dynamic_pointer_cast<XsdRootPathWithFiles>(rootPath))
|
||||
{
|
||||
utility::append(indexerCommands, getIndexerCommandsForRootPath(rootPathWithFiles, sourceGroupSettings, appSettings));
|
||||
utility::append(indexerCommands, getIndexerCommandsForRootPath(
|
||||
rootPathWithFiles, indexedHeaderPaths, languageStandard, systemHeaderSearchPaths, frameworkSearchPaths
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<XsdRootPathWithFiles> rootPath : m_rootPathWithFiles)
|
||||
{
|
||||
utility::append(indexerCommands, getIndexerCommandsForRootPath(rootPath, sourceGroupSettings, appSettings));
|
||||
utility::append(indexerCommands, getIndexerCommandsForRootPath(
|
||||
rootPath, indexedHeaderPaths ,languageStandard, systemHeaderSearchPaths, frameworkSearchPaths
|
||||
));
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
@@ -321,8 +293,10 @@ namespace Sonargraph
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> XsdCmakeJsonModule::getIndexerCommandsForRootPath(
|
||||
std::shared_ptr<XsdRootPathWithFiles> rootPath,
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
const std::set<FilePath> indexedHeaderPaths,
|
||||
const std::string& languageStandard,
|
||||
const std::vector<FilePath> systemHeaderSearchPaths,
|
||||
const std::vector<FilePath> frameworkSearchPaths) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
if (rootPath)
|
||||
@@ -335,17 +309,8 @@ namespace Sonargraph
|
||||
|
||||
const FilePath baseDir = rootPath->getFilePath(softwareSystem->getBaseDirectory());
|
||||
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
if (std::shared_ptr<const SourceGroupSettingsCxxSonargraph> sonargraphSettings = std::dynamic_pointer_cast<const SourceGroupSettingsCxxSonargraph>(sourceGroupSettings))
|
||||
{
|
||||
indexedHeaderPaths = utility::toSet(sonargraphSettings->getIndexedHeaderPathsExpandedAndAbsolute());
|
||||
}
|
||||
|
||||
const std::set<FilePathFilter> excludeFilters = utility::toSet(getDerivedExcludeFilters());
|
||||
const std::set<FilePathFilter> includeFilters = utility::toSet(getDerivedIncludeFilters());
|
||||
const std::string languageStandard = sourceGroupSettings->getStandard();
|
||||
const std::vector<FilePath> systemHeaderSearchPaths = (appSettings ? appSettings->getHeaderSearchPathsExpanded() : std::vector<FilePath>());
|
||||
const std::vector<FilePath> frameworkSearchPaths = (appSettings ? appSettings->getFrameworkSearchPathsExpanded() : std::vector<FilePath>());
|
||||
|
||||
OrderedCache<Id, std::vector<std::wstring>> compilerOptionCache([&](const Id& id) {
|
||||
if (std::shared_ptr<const SoftwareSystem> softwareSystem = getSoftwareSystem())
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace Sonargraph
|
||||
std::set<FilePath> getAllSourcePaths() const override;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const override;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const override;
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const override;
|
||||
@@ -33,9 +32,11 @@ namespace Sonargraph
|
||||
const std::set<FilePathFilter>& includeFilters) const;
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommandsForRootPath(
|
||||
std::shared_ptr<XsdRootPathWithFiles> rootPath,
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const;
|
||||
std::shared_ptr<XsdRootPathWithFiles> rootPath,
|
||||
const std::set<FilePath> indexedHeaderPaths,
|
||||
const std::string& languageStandard,
|
||||
const std::vector<FilePath> systemHeaderSearchPaths,
|
||||
const std::vector<FilePath> frameworkSearchPaths) const;
|
||||
|
||||
std::vector<std::shared_ptr<XsdRootPathWithFiles>> m_rootPathWithFiles;
|
||||
};
|
||||
|
||||
@@ -102,58 +102,6 @@ namespace Sonargraph
|
||||
return std::set<FilePath>();
|
||||
}
|
||||
|
||||
std::set<FilePath> XsdJavaModule::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
const std::set<FilePath> indexedPaths = getAllSourcePaths();
|
||||
const std::vector<FilePathFilter> excludeFilters = getDerivedExcludeFilters();
|
||||
const std::vector<FilePathFilter> includeFilters = getDerivedIncludeFilters();
|
||||
|
||||
std::set<FilePath> containedFilePaths;
|
||||
for (const FilePath& filePath : filePaths)
|
||||
{
|
||||
bool isInIndexedPaths = false;
|
||||
for (const FilePath& indexedPath : indexedPaths)
|
||||
{
|
||||
if (indexedPath == filePath || indexedPath.contains(filePath))
|
||||
{
|
||||
isInIndexedPaths = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInIndexedPaths)
|
||||
{
|
||||
for (const FilePathFilter& excludeFilter : excludeFilters)
|
||||
{
|
||||
if (excludeFilter.isMatching(filePath))
|
||||
{
|
||||
isInIndexedPaths = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isInIndexedPaths)
|
||||
{
|
||||
for (const FilePathFilter& includeFilter : includeFilters)
|
||||
{
|
||||
if (includeFilter.isMatching(filePath))
|
||||
{
|
||||
isInIndexedPaths = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isInIndexedPaths)
|
||||
{
|
||||
containedFilePaths.insert(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> XsdJavaModule::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
@@ -161,7 +109,16 @@ namespace Sonargraph
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
|
||||
{
|
||||
const std::string languageStandard = sourceGroupSettings->getStandard();
|
||||
std::string languageStandard = SourceGroupSettingsWithJavaStandard::getDefaultJavaStandardStatic();
|
||||
if (std::shared_ptr<const SourceGroupSettingsJavaSonargraph> settings =
|
||||
std::dynamic_pointer_cast<const SourceGroupSettingsJavaSonargraph>(sourceGroupSettings))
|
||||
{
|
||||
languageStandard = settings->getJavaStandard();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Source group doesn't specify language standard. Falling back to \"" + languageStandard + "\".");
|
||||
}
|
||||
|
||||
for (const FilePath& sourceFilePath : getAllSourceFilePathsCanonical())
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace Sonargraph
|
||||
std::set<FilePath> getAllSourcePaths() const override;
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical() const override;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const override;
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettings> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const override;
|
||||
|
||||
@@ -78,6 +78,8 @@ add_files(
|
||||
|
||||
project/SourceGroupCxxCdb.cpp
|
||||
project/SourceGroupCxxCdb.h
|
||||
project/SourceGroupCxxCodeblocks.cpp
|
||||
project/SourceGroupCxxCodeblocks.h
|
||||
project/SourceGroupCxxEmpty.cpp
|
||||
project/SourceGroupCxxEmpty.h
|
||||
project/SourceGroupCxxSonargraph.cpp
|
||||
@@ -85,6 +87,18 @@ add_files(
|
||||
project/SourceGroupFactoryModuleCxx.cpp
|
||||
project/SourceGroupFactoryModuleCxx.h
|
||||
|
||||
utility/codeblocks/CodeblocksCompiler.cpp
|
||||
utility/codeblocks/CodeblocksCompiler.h
|
||||
utility/codeblocks/CodeblocksCompilerVarType.cpp
|
||||
utility/codeblocks/CodeblocksCompilerVarType.h
|
||||
utility/codeblocks/CodeblocksProject.cpp
|
||||
utility/codeblocks/CodeblocksProject.h
|
||||
utility/codeblocks/CodeblocksTarget.cpp
|
||||
utility/codeblocks/CodeblocksTarget.h
|
||||
utility/codeblocks/CodeblocksTargetRelationType.cpp
|
||||
utility/codeblocks/CodeblocksTargetRelationType.h
|
||||
utility/codeblocks/CodeblocksUnit.cpp
|
||||
utility/codeblocks/CodeblocksUnit.h
|
||||
utility/CompilationDatabase.cpp
|
||||
utility/CompilationDatabase.h
|
||||
utility/IncludeDirective.cpp
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "project/SourceGroupCxxCodeblocks.h"
|
||||
|
||||
#include "data/indexer/IndexerCommand.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/codeblocks/CodeblocksProject.h"
|
||||
#include "utility/utility.h"
|
||||
#include "Application.h"
|
||||
|
||||
SourceGroupCxxCodeblocks::SourceGroupCxxCodeblocks(std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
}
|
||||
|
||||
bool SourceGroupCxxCodeblocks::prepareIndexing()
|
||||
{
|
||||
FilePath codeblocksProjectPath = m_settings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.empty() && !codeblocksProjectPath.exists())
|
||||
{
|
||||
MessageStatus(L"Can't refresh project").dispatch();
|
||||
|
||||
if (std::shared_ptr<Application> application = Application::getInstance())
|
||||
{
|
||||
if (application->hasGUI())
|
||||
{
|
||||
application->handleDialog(
|
||||
L"Can't refresh. The referenced Code::Blocks project does not exist anymore: " + codeblocksProjectPath.wstr(),
|
||||
{ L"Ok" }
|
||||
);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupCxxCodeblocks::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
std::set<FilePath> containedFilePaths;
|
||||
|
||||
const std::set<FilePath> indexedPaths = utility::concat(
|
||||
getAllSourceFilePaths(),
|
||||
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute())
|
||||
);
|
||||
|
||||
for (const FilePath& filePath : filePaths)
|
||||
{
|
||||
for (const FilePath& indexedPath : indexedPaths)
|
||||
{
|
||||
if (indexedPath == filePath || indexedPath.contains(filePath))
|
||||
{
|
||||
containedFilePaths.insert(filePath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupCxxCodeblocks::getAllSourceFilePaths() const
|
||||
{
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
if (std::shared_ptr<Codeblocks::Project> project = Codeblocks::Project::load(
|
||||
m_settings->getCodeblocksProjectPathExpandedAndAbsolute()
|
||||
))
|
||||
{
|
||||
for (const FilePath& filePath : project->getAllSourceFilePathsCanonical(m_settings))
|
||||
{
|
||||
if (filePath.exists())
|
||||
{
|
||||
sourceFilePaths.insert(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCodeblocks::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
if (std::shared_ptr<Codeblocks::Project> project = Codeblocks::Project::load(
|
||||
m_settings->getCodeblocksProjectPathExpandedAndAbsolute()
|
||||
))
|
||||
{
|
||||
for (std::shared_ptr<IndexerCommand> indexerCommand: project->getIndexerCommands(m_settings, ApplicationSettings::getInstance()))
|
||||
{
|
||||
if (filesToIndex.find(indexerCommand->getSourceFilePath()) != filesToIndex.end())
|
||||
{
|
||||
indexerCommands.push_back(indexerCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
return indexerCommands;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettings> SourceGroupCxxCodeblocks::getSourceGroupSettings()
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
std::shared_ptr<const SourceGroupSettings> SourceGroupCxxCodeblocks::getSourceGroupSettings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef SOURCE_GROUP_CXX_CODEBLOCKS_H
|
||||
#define SOURCE_GROUP_CXX_CODEBLOCKS_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "project/SourceGroup.h"
|
||||
|
||||
class SourceGroupSettingsCxxCodeblocks;
|
||||
|
||||
class SourceGroupCxxCodeblocks
|
||||
: public SourceGroup
|
||||
{
|
||||
public:
|
||||
SourceGroupCxxCodeblocks(std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings);
|
||||
|
||||
bool prepareIndexing() override;
|
||||
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
|
||||
std::set<FilePath> getAllSourceFilePaths() const override;
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
|
||||
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> m_settings;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_CXX_CODEBLOCKS_H
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "data/indexer/IndexerCommandCxxEmpty.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
@@ -98,6 +100,22 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerComm
|
||||
const std::set<FilePath> indexedPaths = utility::toSet(m_settings->getSourcePathsExpandedAndAbsolute());
|
||||
const std::set<FilePathFilter> excludeFilters = utility::toSet(m_settings->getExcludeFiltersExpandedAndAbsolute());
|
||||
|
||||
std::string languageStandard = SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic();
|
||||
if (std::shared_ptr<SourceGroupSettingsWithCStandard> cSettings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsWithCStandard>(m_settings))
|
||||
{
|
||||
languageStandard = cSettings->getCStandard();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsWithCppStandard> cppSettisngs =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsWithCppStandard>(m_settings))
|
||||
{
|
||||
languageStandard = cppSettisngs->getCppStandard();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Source group doesn't specify language standard. Falling back to \"" + languageStandard + "\".");
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
for (const FilePath& sourcePath: getAllSourceFilePaths())
|
||||
{
|
||||
@@ -112,7 +130,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerComm
|
||||
systemHeaderSearchPaths,
|
||||
frameworkSearchPaths,
|
||||
compilerFlags,
|
||||
m_settings->getStandard()
|
||||
languageStandard
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/sonargraph/SonargraphProject.h"
|
||||
#include "utility/utility.h"
|
||||
#include "Application.h"
|
||||
|
||||
SourceGroupCxxSonargraph::SourceGroupCxxSonargraph(std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings)
|
||||
@@ -36,28 +37,44 @@ bool SourceGroupCxxSonargraph::prepareIndexing()
|
||||
|
||||
std::set<FilePath> SourceGroupCxxSonargraph::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
std::set<FilePath> containedFilePaths;
|
||||
|
||||
const std::set<FilePath> indexedPaths = utility::concat(
|
||||
getAllSourceFilePaths(),
|
||||
utility::toSet(m_settings->getIndexedHeaderPathsExpandedAndAbsolute())
|
||||
);
|
||||
|
||||
for (const FilePath& filePath : filePaths)
|
||||
{
|
||||
return project->filterToContainedFilePaths(filePaths);
|
||||
for (const FilePath& indexedPath : indexedPaths)
|
||||
{
|
||||
if (indexedPath == filePath || indexedPath.contains(filePath))
|
||||
{
|
||||
containedFilePaths.insert(filePath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to load Sonargraph project to check the containment of file paths.");
|
||||
}
|
||||
return std::set<FilePath>();
|
||||
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupCxxSonargraph::getAllSourceFilePaths() const
|
||||
{
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
{
|
||||
return project->getAllSourceFilePathsCanonical();
|
||||
for (const FilePath& filePath : project->getAllSourceFilePathsCanonical())
|
||||
{
|
||||
if (filePath.exists())
|
||||
{
|
||||
sourceFilePaths.insert(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::set<FilePath>();
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxSonargraph::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "project/SourceGroupFactoryModuleCxx.h"
|
||||
|
||||
#include "project/SourceGroupCxxCdb.h"
|
||||
#include "project/SourceGroupCxxCodeblocks.h"
|
||||
#include "project/SourceGroupCxxEmpty.h"
|
||||
#include "project/SourceGroupCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
|
||||
@@ -18,6 +20,7 @@ bool SourceGroupFactoryModuleCxx::supports(SourceGroupType type) const
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return true;
|
||||
default:
|
||||
@@ -33,6 +36,10 @@ std::shared_ptr<SourceGroup> SourceGroupFactoryModuleCxx::createSourceGroup(std:
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxCdb(cxxSettings));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(settings))
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxCodeblocks(cxxSettings));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(settings))
|
||||
{
|
||||
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxEmpty(cxxSettings));
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "utility/codeblocks/CodeblocksCompiler.h"
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
std::string Compiler::getXmlElementName()
|
||||
{
|
||||
return "Compiler";
|
||||
}
|
||||
|
||||
std::shared_ptr<Compiler> Compiler::create(const TiXmlElement* element)
|
||||
{
|
||||
if (!element || element->Value() != getXmlElementName())
|
||||
{
|
||||
return std::shared_ptr<Compiler>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Compiler> compiler(new Compiler());
|
||||
|
||||
{
|
||||
const TiXmlElement* addElement = element->FirstChildElement("Add");
|
||||
while (addElement)
|
||||
{
|
||||
{
|
||||
const char* value = addElement->Attribute("option");
|
||||
if (value)
|
||||
{
|
||||
compiler->m_options.push_back(utility::decodeFromUtf8(value));
|
||||
}
|
||||
}
|
||||
{
|
||||
const char* value = addElement->Attribute("directory");
|
||||
if (value)
|
||||
{
|
||||
compiler->m_directories.push_back(utility::decodeFromUtf8(value));
|
||||
}
|
||||
}
|
||||
|
||||
addElement = addElement->NextSiblingElement("Add");
|
||||
}
|
||||
}
|
||||
|
||||
return compiler;
|
||||
}
|
||||
|
||||
const std::vector<std::wstring>& Compiler::getOptions() const
|
||||
{
|
||||
return m_options;
|
||||
}
|
||||
|
||||
const std::vector<std::wstring>& Compiler::getDirectories() const
|
||||
{
|
||||
return m_directories;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef CODEBLOCKS_COMPILER_H
|
||||
#define CODEBLOCKS_COMPILER_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
class TiXmlElement;
|
||||
|
||||
class ApplicationSettings;
|
||||
class FilePath;
|
||||
class IndexerCommand;
|
||||
class SourceGroupSettings;
|
||||
class TextAccess;
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
class Compiler
|
||||
{
|
||||
public:
|
||||
static std::string getXmlElementName();
|
||||
static std::shared_ptr<Compiler> create(const TiXmlElement* element);
|
||||
|
||||
const std::vector<std::wstring>& getOptions() const;
|
||||
const std::vector<std::wstring>& getDirectories() const;
|
||||
|
||||
private:
|
||||
Compiler() = default;
|
||||
|
||||
std::vector<std::wstring> m_options;
|
||||
std::vector<std::wstring> m_directories;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CODEBLOCKS_COMPILER_H
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "utility/codeblocks/CodeblocksCompilerVarType.h"
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
std::string compilerVarTypeToString(CompilerVarType v)
|
||||
{
|
||||
switch (v)
|
||||
{
|
||||
case COMPILER_VAR_CPP:
|
||||
return "CPP";
|
||||
case COMPILER_VAR_C:
|
||||
return "C";
|
||||
case COMPILER_VAR_WINDRES:
|
||||
return "WINDRES";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
CompilerVarType stringToCompilerVarType(const std::string& v)
|
||||
{
|
||||
if (v == compilerVarTypeToString(COMPILER_VAR_CPP))
|
||||
{
|
||||
return COMPILER_VAR_CPP;
|
||||
}
|
||||
else if (v == compilerVarTypeToString(COMPILER_VAR_C))
|
||||
{
|
||||
return COMPILER_VAR_C;
|
||||
}
|
||||
else if (v == compilerVarTypeToString(COMPILER_VAR_WINDRES))
|
||||
{
|
||||
return COMPILER_VAR_WINDRES;
|
||||
}
|
||||
return COMPILER_VAR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef CODEBLOCKS_COMPILER_VAR_TYPE_H
|
||||
#define CODEBLOCKS_COMPILER_VAR_TYPE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
enum CompilerVarType
|
||||
{
|
||||
COMPILER_VAR_CPP,
|
||||
COMPILER_VAR_C,
|
||||
COMPILER_VAR_WINDRES,
|
||||
COMPILER_VAR_UNKNOWN
|
||||
};
|
||||
|
||||
std::string compilerVarTypeToString(CompilerVarType v);
|
||||
CompilerVarType stringToCompilerVarType(const std::string& v);
|
||||
}
|
||||
|
||||
#endif // CODEBLOCKS_COMPILER_VAR_TYPE_H
|
||||
@@ -0,0 +1,255 @@
|
||||
#include "utility/codeblocks/CodeblocksProject.h"
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
|
||||
#include "data/indexer/IndexerCommandCxxEmpty.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "utility/codeblocks/CodeblocksCompiler.h"
|
||||
#include "utility/codeblocks/CodeblocksTarget.h"
|
||||
#include "utility/codeblocks/CodeblocksUnit.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/OrderedCache.h"
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
std::shared_ptr<Project> Project::load(const FilePath& projectFilePath)
|
||||
{
|
||||
return load(TextAccess::createFromFile(projectFilePath));
|
||||
}
|
||||
|
||||
std::shared_ptr<Project> Project::load(std::shared_ptr<TextAccess> xmlAccess)
|
||||
{
|
||||
if (!xmlAccess)
|
||||
{
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Project> project(new Project());
|
||||
|
||||
TiXmlDocument doc;
|
||||
doc.Parse(xmlAccess->getText().c_str(), 0, TIXML_ENCODING_UTF8);
|
||||
if (doc.Error())
|
||||
{
|
||||
LOG_ERROR(
|
||||
"Unable to parse Code::Blocks project because of an error in row " + std::to_string(doc.ErrorRow()) + ", col " +
|
||||
std::to_string(doc.ErrorCol()) + ": " + std::string(doc.ErrorDesc())
|
||||
);
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
TiXmlElement* codeBlocksProjectFileElement;
|
||||
TiXmlHandle docHandle(&doc);
|
||||
{
|
||||
codeBlocksProjectFileElement = docHandle.FirstChildElement("CodeBlocks_project_file").ToElement();
|
||||
if (codeBlocksProjectFileElement == nullptr)
|
||||
{
|
||||
codeBlocksProjectFileElement = docHandle.FirstChildElement("Code::Blocks_project_file").ToElement();
|
||||
}
|
||||
if (codeBlocksProjectFileElement == nullptr)
|
||||
{
|
||||
LOG_ERROR("Unable to find root node in Code::Blocks project.");
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
TiXmlElement* versionElement = codeBlocksProjectFileElement->FirstChildElement("FileVersion");
|
||||
|
||||
if (versionElement->QueryIntAttribute("major", &project->m_versionMajor) != TIXML_SUCCESS)
|
||||
{
|
||||
LOG_ERROR("Unable to find \"Project\" node in Code::Blocks project.");
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
if (versionElement->QueryIntAttribute("minor", &project->m_versionMinor) != TIXML_SUCCESS)
|
||||
{
|
||||
LOG_ERROR("Unable to find \"Project\" node in Code::Blocks project.");
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
}
|
||||
|
||||
const TiXmlElement* projectElement = codeBlocksProjectFileElement->FirstChildElement("Project");
|
||||
if (codeBlocksProjectFileElement == nullptr)
|
||||
{
|
||||
LOG_ERROR("Unable to find \"Project\" node in Code::Blocks project.");
|
||||
return std::shared_ptr<Project>();
|
||||
}
|
||||
|
||||
{
|
||||
const TiXmlElement* optionElement = projectElement->FirstChildElement("Option");
|
||||
while (optionElement)
|
||||
{
|
||||
{
|
||||
const char* value = optionElement->Attribute("title");
|
||||
if (value)
|
||||
{
|
||||
project->m_title = stringToCompilerVarType(value);
|
||||
}
|
||||
}
|
||||
|
||||
optionElement = optionElement->NextSiblingElement("Option");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const TiXmlElement* buildElement = projectElement->FirstChildElement("Build");
|
||||
const TiXmlElement* targetElement = buildElement->FirstChildElement(Target::getXmlElementName().c_str());
|
||||
while (targetElement)
|
||||
{
|
||||
if (std::shared_ptr<Target> unit = Target::create(targetElement))
|
||||
{
|
||||
project->m_targets.push_back(unit);
|
||||
}
|
||||
|
||||
targetElement = targetElement->NextSiblingElement(Target::getXmlElementName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const TiXmlElement* unitElement = projectElement->FirstChildElement(Unit::getXmlElementName().c_str());
|
||||
while (unitElement)
|
||||
{
|
||||
if (std::shared_ptr<Unit> unit = Unit::create(unitElement))
|
||||
{
|
||||
project->m_units.push_back(unit);
|
||||
}
|
||||
|
||||
unitElement = unitElement->NextSiblingElement(Unit::getXmlElementName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
std::set<FilePath> Project::getAllSourceFilePathsCanonical(
|
||||
std::shared_ptr<const SourceGroupSettingsWithSourceExtensions> sourceGroupSettings
|
||||
) const
|
||||
{
|
||||
const std::set<std::wstring> sourceExtensions = utility::toSet(sourceGroupSettings->getSourceExtensions());
|
||||
|
||||
std::set<FilePath> filePaths;
|
||||
for (std::shared_ptr<const Unit> unit : m_units)
|
||||
{
|
||||
if (unit && unit->getCompile())
|
||||
{
|
||||
FilePath filePath(unit->getFilename());
|
||||
if (sourceExtensions.find(filePath.getLowerCase().extension()) != sourceExtensions.end())
|
||||
{
|
||||
filePaths.insert(filePath.makeCanonical());
|
||||
}
|
||||
}
|
||||
}
|
||||
return filePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> Project::getAllCxxHeaderSearchPathsCanonical() const
|
||||
{
|
||||
std::set<FilePath> paths;
|
||||
for (std::shared_ptr<const Target> target : m_targets)
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
if (std::shared_ptr<const Compiler> compiler = target->getCompiler())
|
||||
{
|
||||
for (const std::wstring& directory : compiler->getDirectories())
|
||||
{
|
||||
paths.insert(FilePath(directory).makeCanonical());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> Project::getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const
|
||||
{
|
||||
const std::set<std::wstring> sourceExtensions = utility::toSet(sourceGroupSettings->getSourceExtensions());
|
||||
|
||||
const std::set<FilePath> indexedHeaderPaths = utility::toSet(sourceGroupSettings->getIndexedHeaderPathsExpandedAndAbsolute());
|
||||
|
||||
const std::vector<std::wstring> compilerFlags = sourceGroupSettings->getCompilerFlags();
|
||||
|
||||
const std::vector<FilePath> systemHeaderSearchPaths = utility::concat(
|
||||
sourceGroupSettings->getHeaderSearchPathsExpandedAndAbsolute(),
|
||||
appSettings->getHeaderSearchPathsExpanded()
|
||||
);
|
||||
|
||||
const std::vector<FilePath> frameworkSearchPaths = utility::concat(
|
||||
sourceGroupSettings->getFrameworkSearchPathsExpandedAndAbsolute(),
|
||||
appSettings->getFrameworkSearchPathsExpanded()
|
||||
);
|
||||
|
||||
OrderedCache<std::wstring, std::vector<std::wstring>> optionsCache([&](const std::wstring& targetName) {
|
||||
for (std::shared_ptr<Target> target : m_targets)
|
||||
{
|
||||
if (target->getTitle() == targetName)
|
||||
{
|
||||
return target->getCompiler()->getOptions();
|
||||
}
|
||||
}
|
||||
return std::vector<std::wstring>();
|
||||
});
|
||||
|
||||
OrderedCache<std::wstring, std::vector<FilePath>> headerSearchPathsCache([&](const std::wstring& targetName) {
|
||||
for (std::shared_ptr<Target> target : m_targets)
|
||||
{
|
||||
if (target->getTitle() == targetName)
|
||||
{
|
||||
return utility::convert<std::wstring, FilePath>(target->getCompiler()->getDirectories());
|
||||
}
|
||||
}
|
||||
return std::vector<FilePath>();
|
||||
});
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
|
||||
for (std::shared_ptr<Unit> unit : m_units)
|
||||
{
|
||||
if (!unit || !unit->getCompile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const FilePath filePath = FilePath(unit->getFilename()).makeCanonical();
|
||||
if (sourceExtensions.find(filePath.getLowerCase().extension()) == sourceExtensions.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string languageStandard;
|
||||
switch (unit->getCompilerVar())
|
||||
{
|
||||
case COMPILER_VAR_C:
|
||||
languageStandard = sourceGroupSettings->getCStandard();
|
||||
break;
|
||||
case COMPILER_VAR_CPP:
|
||||
languageStandard = sourceGroupSettings->getCppStandard();
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const std::wstring& targetName : unit->getTargetNames())
|
||||
{
|
||||
indexerCommands.push_back(std::make_shared<IndexerCommandCxxEmpty>(
|
||||
filePath,
|
||||
utility::concat(indexedHeaderPaths, { filePath }),
|
||||
std::set<FilePathFilter>(),
|
||||
std::set<FilePathFilter>(),
|
||||
sourceGroupSettings->getCodeblocksProjectPathExpandedAndAbsolute().getParentDirectory(),
|
||||
utility::concat(systemHeaderSearchPaths, headerSearchPathsCache.getValue(targetName)),
|
||||
frameworkSearchPaths,
|
||||
utility::concat(compilerFlags, optionsCache.getValue(targetName)),
|
||||
languageStandard
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return indexerCommands;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef CODEBLOCKS_PROJECT_H
|
||||
#define CODEBLOCKS_PROJECT_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
class ApplicationSettings;
|
||||
class FilePath;
|
||||
class IndexerCommand;
|
||||
class SourceGroupSettingsCxxCodeblocks;
|
||||
class SourceGroupSettingsWithSourceExtensions;
|
||||
class TextAccess;
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
class Target;
|
||||
class Unit;
|
||||
|
||||
class Project
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Project> load(const FilePath& projectFilePath);
|
||||
static std::shared_ptr<Project> load(std::shared_ptr<TextAccess> xmlAccess);
|
||||
|
||||
std::set<FilePath> getAllSourceFilePathsCanonical(
|
||||
std::shared_ptr<const SourceGroupSettingsWithSourceExtensions> sourceGroupSettings
|
||||
) const;
|
||||
std::set<FilePath> getAllCxxHeaderSearchPathsCanonical() const;
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> sourceGroupSettings,
|
||||
std::shared_ptr<const ApplicationSettings> appSettings) const;
|
||||
|
||||
private:
|
||||
Project() = default;
|
||||
|
||||
int m_versionMajor;
|
||||
int m_versionMinor;
|
||||
|
||||
std::wstring m_title;
|
||||
|
||||
std::vector<std::shared_ptr<Target>> m_targets;
|
||||
std::vector<std::shared_ptr<Unit>> m_units;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CODEBLOCKS_PROJECT_H
|
||||
@@ -0,0 +1,80 @@
|
||||
#include "utility/codeblocks/CodeblocksTarget.h"
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
|
||||
#include "utility/codeblocks/CodeblocksCompiler.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
std::string Target::getXmlElementName()
|
||||
{
|
||||
return "Target";
|
||||
}
|
||||
|
||||
std::shared_ptr<Target> Target::create(const TiXmlElement* element)
|
||||
{
|
||||
if (!element || element->Value() != getXmlElementName())
|
||||
{
|
||||
return std::shared_ptr<Target>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Target> target(new Target());
|
||||
|
||||
{
|
||||
const char* value = element->Attribute("title");
|
||||
if (!value)
|
||||
{
|
||||
return std::shared_ptr<Target>();
|
||||
}
|
||||
target->m_title = utility::decodeFromUtf8(value);
|
||||
}
|
||||
|
||||
{
|
||||
const TiXmlElement* optionElement = element->FirstChildElement("Option");
|
||||
while (optionElement)
|
||||
{
|
||||
{
|
||||
int value = 0;
|
||||
if (optionElement->QueryIntAttribute("projectCompilerOptionsRelation", &value) == TIXML_SUCCESS)
|
||||
{
|
||||
target->m_projectCompilerOptionsRelation = intToTargetRelationType(value);
|
||||
}
|
||||
}
|
||||
{
|
||||
int value = 0;
|
||||
if (optionElement->QueryIntAttribute("projectIncludeDirsRelation", &value) == TIXML_SUCCESS)
|
||||
{
|
||||
target->m_projectIncludeDirsRelation = intToTargetRelationType(value);
|
||||
}
|
||||
}
|
||||
|
||||
optionElement = optionElement->NextSiblingElement("Option");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const TiXmlElement* compilerElement = element->FirstChildElement(Compiler::getXmlElementName().c_str());
|
||||
target->m_compiler = Compiler::create(compilerElement);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
std::wstring Target::getTitle() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
std::shared_ptr<const Compiler> Target::getCompiler() const
|
||||
{
|
||||
return m_compiler;
|
||||
}
|
||||
|
||||
Target::Target()
|
||||
: m_title()
|
||||
, m_projectCompilerOptionsRelation(CODEBLOCKS_TARGET_RELATION_TARGET_AFTER_PROJECT)
|
||||
, m_projectIncludeDirsRelation(CODEBLOCKS_TARGET_RELATION_TARGET_AFTER_PROJECT)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef CODEBLOCKS_TARGET_H
|
||||
#define CODEBLOCKS_TARGET_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "utility/codeblocks/CodeblocksTargetRelationType.h"
|
||||
|
||||
class TiXmlElement;
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
class Compiler;
|
||||
|
||||
class Target
|
||||
{
|
||||
public:
|
||||
static std::string getXmlElementName();
|
||||
static std::shared_ptr<Target> create(const TiXmlElement* element);
|
||||
|
||||
std::wstring getTitle() const;
|
||||
std::shared_ptr<const Compiler> getCompiler() const;
|
||||
|
||||
private:
|
||||
Target();
|
||||
|
||||
std::wstring m_title;
|
||||
TargetRelationType m_projectCompilerOptionsRelation;
|
||||
TargetRelationType m_projectIncludeDirsRelation;
|
||||
std::shared_ptr<Compiler> m_compiler;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CODEBLOCKS_TARGET_H
|
||||
@@ -0,0 +1,41 @@
|
||||
#include "utility/codeblocks/CodeblocksTargetRelationType.h"
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
int targetRelationTypeToInt(TargetRelationType v)
|
||||
{
|
||||
switch (v)
|
||||
{
|
||||
case CODEBLOCKS_TARGET_RELATION_IGNORE_TARGET:
|
||||
return 0;
|
||||
case CODEBLOCKS_TARGET_RELATION_IGNORE_PROJECT:
|
||||
return 1;
|
||||
case CODEBLOCKS_TARGET_RELATION_TARGET_BEFORE_PROJECT:
|
||||
return 2;
|
||||
case CODEBLOCKS_TARGET_RELATION_TARGET_AFTER_PROJECT:
|
||||
return 3;
|
||||
}
|
||||
return 99;
|
||||
}
|
||||
|
||||
TargetRelationType intToTargetRelationType(int v)
|
||||
{
|
||||
if (v == targetRelationTypeToInt(CODEBLOCKS_TARGET_RELATION_IGNORE_TARGET))
|
||||
{
|
||||
return CODEBLOCKS_TARGET_RELATION_IGNORE_TARGET;
|
||||
}
|
||||
else if (v == targetRelationTypeToInt(CODEBLOCKS_TARGET_RELATION_IGNORE_PROJECT))
|
||||
{
|
||||
return CODEBLOCKS_TARGET_RELATION_IGNORE_PROJECT;
|
||||
}
|
||||
else if (v == targetRelationTypeToInt(CODEBLOCKS_TARGET_RELATION_TARGET_BEFORE_PROJECT))
|
||||
{
|
||||
return CODEBLOCKS_TARGET_RELATION_TARGET_BEFORE_PROJECT;
|
||||
}
|
||||
else if (v == targetRelationTypeToInt(CODEBLOCKS_TARGET_RELATION_TARGET_AFTER_PROJECT))
|
||||
{
|
||||
return CODEBLOCKS_TARGET_RELATION_TARGET_AFTER_PROJECT;
|
||||
}
|
||||
return CODEBLOCKS_TARGET_RELATION_UNKNOWN;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef CODEBLOCKS_TARGET_RELATION_TYPE_H
|
||||
#define CODEBLOCKS_TARGET_RELATION_TYPE_H
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
enum TargetRelationType
|
||||
{
|
||||
CODEBLOCKS_TARGET_RELATION_IGNORE_TARGET,
|
||||
CODEBLOCKS_TARGET_RELATION_IGNORE_PROJECT,
|
||||
CODEBLOCKS_TARGET_RELATION_TARGET_BEFORE_PROJECT,
|
||||
CODEBLOCKS_TARGET_RELATION_TARGET_AFTER_PROJECT,
|
||||
CODEBLOCKS_TARGET_RELATION_UNKNOWN
|
||||
};
|
||||
|
||||
int targetRelationTypeToInt(TargetRelationType v);
|
||||
TargetRelationType intToTargetRelationType(int v);
|
||||
}
|
||||
|
||||
#endif // CODEBLOCKS_TARGET_RELATION_TYPE_H
|
||||
@@ -0,0 +1,89 @@
|
||||
#include "utility/codeblocks/CodeblocksUnit.h"
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
std::string Unit::getXmlElementName()
|
||||
{
|
||||
return "Unit";
|
||||
}
|
||||
|
||||
std::shared_ptr<Unit> Unit::create(const TiXmlElement* element)
|
||||
{
|
||||
if (!element || element->Value() != getXmlElementName())
|
||||
{
|
||||
return std::shared_ptr<Unit>();
|
||||
}
|
||||
|
||||
std::shared_ptr<Unit> unit(new Unit());
|
||||
|
||||
{
|
||||
const char* value = element->Attribute("filename");
|
||||
if (!value)
|
||||
{
|
||||
return std::shared_ptr<Unit>();
|
||||
}
|
||||
unit->m_filename = utility::decodeFromUtf8(value);
|
||||
}
|
||||
|
||||
const TiXmlElement* optionElement = element->FirstChildElement("Option");
|
||||
while (optionElement)
|
||||
{
|
||||
{
|
||||
const char* value = optionElement->Attribute("compilerVar");
|
||||
if (value)
|
||||
{
|
||||
unit->m_compilerVar = stringToCompilerVarType(value);
|
||||
}
|
||||
}
|
||||
{
|
||||
int value = 0;
|
||||
if (optionElement->QueryIntAttribute("compile", &value) == TIXML_SUCCESS)
|
||||
{
|
||||
unit->m_compile = (value == 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
const char* value = optionElement->Attribute("target");
|
||||
if (value)
|
||||
{
|
||||
unit->m_targetNames.insert(utility::decodeFromUtf8(value));
|
||||
}
|
||||
}
|
||||
|
||||
optionElement = optionElement->NextSiblingElement("Option");
|
||||
}
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
||||
std::wstring Unit::getFilename() const
|
||||
{
|
||||
return m_filename;
|
||||
}
|
||||
|
||||
CompilerVarType Unit::getCompilerVar() const
|
||||
{
|
||||
return m_compilerVar;
|
||||
}
|
||||
|
||||
bool Unit::getCompile() const
|
||||
{
|
||||
return m_compile;
|
||||
}
|
||||
|
||||
std::set<std::wstring> Unit::getTargetNames() const
|
||||
{
|
||||
return m_targetNames;
|
||||
}
|
||||
|
||||
Unit::Unit()
|
||||
: m_filename()
|
||||
, m_compilerVar(COMPILER_VAR_CPP)
|
||||
, m_compile(true)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef CODEBLOCKS_UNIT_H
|
||||
#define CODEBLOCKS_UNIT_H
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "utility/codeblocks/CodeblocksCompilerVarType.h"
|
||||
|
||||
class TiXmlElement;
|
||||
|
||||
namespace Codeblocks
|
||||
{
|
||||
class Unit
|
||||
{
|
||||
public:
|
||||
static std::string getXmlElementName();
|
||||
static std::shared_ptr<Unit> create(const TiXmlElement* element);
|
||||
|
||||
std::wstring getFilename() const;
|
||||
CompilerVarType getCompilerVar() const;
|
||||
bool getCompile() const;
|
||||
std::set<std::wstring> getTargetNames() const;
|
||||
|
||||
private:
|
||||
Unit();
|
||||
|
||||
std::wstring m_filename;
|
||||
CompilerVarType m_compilerVar;
|
||||
bool m_compile;
|
||||
std::set<std::wstring> m_targetNames;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CODEBLOCKS_UNIT_H
|
||||
@@ -187,16 +187,20 @@ add_files(
|
||||
qt/window/project_wizzard/QtProjectWizzard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContent.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContent.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCppStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCppStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentGroup.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentGroup.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPath.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPath.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
#include <QSysInfo>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCppStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentExtensions.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentFlags.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPath.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentProjectData.h"
|
||||
@@ -19,8 +21,10 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceGroupInfoText.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentGroup.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentVS.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCppEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsJavaEmpty.h"
|
||||
#include "settings/SourceGroupSettingsJavaGradle.h"
|
||||
@@ -235,7 +239,7 @@ void QtProjectWizzard::windowReady()
|
||||
|
||||
updateSourceGroupList();
|
||||
|
||||
if (m_allSourceGroupSettings.size())
|
||||
if (!m_allSourceGroupSettings.empty())
|
||||
{
|
||||
m_sourceGroupList->setCurrentRow(0);
|
||||
}
|
||||
@@ -407,7 +411,7 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsJava> settingsJava = std::dynamic_pointer_cast<SourceGroupSettingsJava>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentJavaStandard(settingsJava, this));
|
||||
summary->addSpace();
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settingsJavaEmpty = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(group))
|
||||
@@ -443,7 +447,7 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settingsJavaSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaSonargraph, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
|
||||
summary->addSpace();
|
||||
@@ -456,7 +460,14 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
bool indicateSearchPathsAsAdditional = false;
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> settingsCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
if (std::shared_ptr<SourceGroupSettingsCEmpty> settingsCEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentCStandard(settingsCEmpty, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settingsCppEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCppEmpty, this));
|
||||
}
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentCrossCompilationOptions(group, this));
|
||||
summary->addSpace();
|
||||
@@ -477,11 +488,25 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
|
||||
summary->addSpace();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settingsCxxCodeblocks = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(group))
|
||||
{
|
||||
indicateSearchPathsAsAdditional = true;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCxxCodeblocks, this));
|
||||
summary->addContent(new QtProjectWizzardContentCStandard(settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentCodeblocksProjectPath(settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Code::Blocks project", settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentExtensions(settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(group))
|
||||
{
|
||||
indicateSearchPathsAsAdditional = true;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCxxSonargraph, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
|
||||
summary->addSpace();
|
||||
@@ -579,12 +604,17 @@ void QtProjectWizzard::duplicateSelectedSourceGroup()
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsJavaSonargraph>(*dynamic_cast<SourceGroupSettingsJavaSonargraph*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCEmpty>(*dynamic_cast<SourceGroupSettingsCEmpty*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxEmpty>(*dynamic_cast<SourceGroupSettingsCxxEmpty*>(oldSourceGroup.get()));
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCppEmpty>(*dynamic_cast<SourceGroupSettingsCppEmpty*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxCdb>(*dynamic_cast<SourceGroupSettingsCxxCdb*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxCodeblocks>(*dynamic_cast<SourceGroupSettingsCxxCodeblocks*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxSonargraph>(*dynamic_cast<SourceGroupSettingsCxxSonargraph*>(oldSourceGroup.get()));
|
||||
break;
|
||||
@@ -700,7 +730,14 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
{
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxEmpty>(sourceGroupId, sourceGroupType, m_projectSettings.get());
|
||||
if (sourceGroupType == SOURCE_GROUP_C_EMPTY)
|
||||
{
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCppEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
}
|
||||
if (applicationSettingsContainVisualStudioHeaderSearchPaths())
|
||||
{
|
||||
std::vector<std::wstring> flags;
|
||||
@@ -715,6 +752,10 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCdb>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCDB();
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCodeblocks>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCxxCodeblocks();
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCxxSonargraph();
|
||||
@@ -749,7 +790,18 @@ void QtProjectWizzard::emptySourceGroup()
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, window));
|
||||
if (std::shared_ptr<SourceGroupSettingsCEmpty> settingsCEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCStandard(settingsCEmpty, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settingsCppEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCppStandard(settingsCppEmpty, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settingsJavaEmpty = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaEmpty, this));
|
||||
}
|
||||
if (m_newSourceGroupSettings->getType() == SOURCE_GROUP_C_EMPTY ||
|
||||
m_newSourceGroupSettings->getType() == SOURCE_GROUP_CPP_EMPTY)
|
||||
{
|
||||
@@ -810,16 +862,42 @@ void QtProjectWizzard::emptySourceGroupCDB()
|
||||
window->updateSubTitle("Compilation Database Path");
|
||||
}
|
||||
|
||||
void QtProjectWizzard::emptySourceGroupCxxCodeblocks()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
|
||||
{
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCppStandard(settings, this));
|
||||
contentGroup->addContent(new QtProjectWizzardContentCStandard(settings, this));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentCodeblocksProjectPath(settings, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Code::Blocks project", settings, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentExtensions(settings, window));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::createSourceGroup);
|
||||
window->updateSubTitle("Code::Blocks Project Path");
|
||||
}
|
||||
|
||||
void QtProjectWizzard::emptySourceGroupCxxSonargraph()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, this));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Sonargraph project", m_newSourceGroupSettings, window));
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCppStandard(settings, this));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Sonargraph project", m_newSourceGroupSettings, window));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -832,7 +910,12 @@ void QtProjectWizzard::emptySourceGroupJavaSonargraph()
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
|
||||
if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settings, this));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -850,10 +933,11 @@ void QtProjectWizzard::sourcePaths()
|
||||
contentGroup->addContent(new QtProjectWizzardContentPathsSource(settingsCxx, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(settingsCxx, window));
|
||||
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> settingsSourcePath = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_newSourceGroupSettings))
|
||||
if (std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settingsSourceExtension =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsSourcePath, window));
|
||||
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsSourceExtension, window));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ private slots:
|
||||
void emptySourceGroup();
|
||||
void emptySourceGroupCDBVS();
|
||||
void emptySourceGroupCDB();
|
||||
void emptySourceGroupCxxCodeblocks();
|
||||
void emptySourceGroupCxxSonargraph();
|
||||
void emptySourceGroupJavaSonargraph();
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
|
||||
QtProjectWizzardContentCStandard::QtProjectWizzardContentCStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("C Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCStandard::load()
|
||||
{
|
||||
m_standard->clear();
|
||||
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableCStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getCStandard()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCStandard::save()
|
||||
{
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
m_sourceGroupSettings->setCStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_C_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_C_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class SourceGroupSettingsWithCStandard;
|
||||
|
||||
class QtProjectWizzardContentCStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithCStandard> m_sourceGroupSettings;
|
||||
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_C_STANDARD
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCppStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
|
||||
QtProjectWizzardContentCppStandard::QtProjectWizzardContentCppStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCppStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCppStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("C++ Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCppStandard::load()
|
||||
{
|
||||
m_standard->clear();
|
||||
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableCppStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getCppStandard()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCppStandard::save()
|
||||
{
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
m_sourceGroupSettings->setCppStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_CPP_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_CPP_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class SourceGroupSettingsWithCppStandard;
|
||||
|
||||
class QtProjectWizzardContentCppStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCppStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCppStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithCppStandard> m_sourceGroupSettings;
|
||||
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_CPP_STANDARD
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
#include <QFormLayout>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "qt/element/QtStringListBox.h"
|
||||
|
||||
QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> settings, QtProjectWizzardWindow* window
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_settings(settings)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QtStringListBox;
|
||||
class SourceGroupSettingsWithSourcePaths;
|
||||
class SourceGroupSettingsWithSourceExtensions;
|
||||
|
||||
class QtProjectWizzardContentExtensions
|
||||
: public QtProjectWizzardContent
|
||||
@@ -14,7 +14,7 @@ class QtProjectWizzardContentExtensions
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettingsWithSourcePaths> settings, QtProjectWizzardWindow* window);
|
||||
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> m_settings;
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> m_settings;
|
||||
|
||||
QtStringListBox* m_listBox;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
|
||||
QtProjectWizzardContentJavaStandard::QtProjectWizzardContentJavaStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithJavaStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentJavaStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("Java Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentJavaStandard::load()
|
||||
{
|
||||
m_standard->clear();
|
||||
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableJavaStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getJavaStandard()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentJavaStandard::save()
|
||||
{
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
m_sourceGroupSettings->setJavaStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_JAVA_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_JAVA_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class SourceGroupSettingsWithJavaStandard;
|
||||
|
||||
class QtProjectWizzardContentJavaStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentJavaStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithJavaStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithJavaStandard> m_sourceGroupSettings;
|
||||
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_JAVA_STANDARD
|
||||
@@ -1,70 +0,0 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
QtProjectWizzardContentLanguageAndStandard::QtProjectWizzardContentLanguageAndStandard(
|
||||
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_language(nullptr)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentLanguageAndStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_language = new QLabel();
|
||||
layout->addWidget(createFormLabel("Language"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentLanguageAndStandard::load()
|
||||
{
|
||||
const LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
|
||||
|
||||
if (type == LANGUAGE_UNKNOWN)
|
||||
{
|
||||
LOG_ERROR("No language type defined");
|
||||
return;
|
||||
}
|
||||
|
||||
m_language->setText(languageTypeToString(type).c_str());
|
||||
|
||||
m_standard->clear();
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableLanguageStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getStandard()));
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentLanguageAndStandard::save()
|
||||
{
|
||||
m_sourceGroupSettings->setStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class SourceGroupSettings;
|
||||
|
||||
class QtProjectWizzardContentLanguageAndStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentLanguageAndStandard(
|
||||
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> m_sourceGroupSettings;
|
||||
|
||||
QLabel* m_language;
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
|
||||
@@ -16,9 +16,11 @@
|
||||
#include "settings/SourceGroupSettingsJavaMaven.h"
|
||||
#include "settings/SourceGroupSettingsJavaGradle.h"
|
||||
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/sonargraph/SonargraphProject.h"
|
||||
#include "utility/codeblocks/CodeblocksProject.h"
|
||||
#include "utility/ScopedFunctor.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityGradle.h"
|
||||
@@ -261,6 +263,132 @@ void QtProjectWizzardContentPathCDB::pickedPath()
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentCodeblocksProjectPath::QtProjectWizzardContentCodeblocksProjectPath(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPath(settings, window)
|
||||
{
|
||||
setTitleString("Code::Blocks Project (.cbp)");
|
||||
setHelpString(
|
||||
"Select the Code::Blocks file for the project. Sourcetrail will index your project based on the settings "
|
||||
"this file. It contains using all include paths and compiler flags required. The Sourcetrail project "
|
||||
"will stay up to date with changes in the Code::Blocks project on every refresh.<br />"
|
||||
"<br />"
|
||||
"You can make use of environment variables with ${ENV_VAR}."
|
||||
);
|
||||
setFileEndings({ L".cbp" });
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCodeblocksProjectPath::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
QtProjectWizzardContentPath::populate(layout, row);
|
||||
m_picker->setPickDirectory(false);
|
||||
m_picker->setFileFilter("Code::Blocks Project (*.cbp)");
|
||||
connect(m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizzardContentCodeblocksProjectPath::pickedPath);
|
||||
|
||||
QLabel* description = new QLabel(
|
||||
"Sourcetrail will use all settings from the Code::Blocks project and stay up-to-date with changes on refresh.", this);
|
||||
description->setObjectName("description");
|
||||
description->setWordWrap(true);
|
||||
layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
QLabel* title = createFormLabel("Source Files to Index");
|
||||
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
layout->setRowStretch(row, 0);
|
||||
|
||||
m_fileCountLabel = new QLabel("");
|
||||
m_fileCountLabel->setWordWrap(true);
|
||||
layout->addWidget(m_fileCountLabel, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
|
||||
row++;
|
||||
|
||||
addFilesButton("show source files", layout, row);
|
||||
row++;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCodeblocksProjectPath::load()
|
||||
{
|
||||
m_filePaths.clear();
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
m_picker->setText(QString::fromStdWString(settings->getCodeblocksProjectPath().wstr()));
|
||||
|
||||
const FilePath codeblocksProjectPath = settings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.empty() && codeblocksProjectPath.exists())
|
||||
{
|
||||
if (std::shared_ptr<Codeblocks::Project> codeblocksProject = Codeblocks::Project::load(
|
||||
codeblocksProjectPath
|
||||
))
|
||||
{
|
||||
m_filePaths = utility::toVector(codeblocksProject->getAllSourceFilePathsCanonical(settings));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_fileCountLabel)
|
||||
{
|
||||
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the Code::Blocks project.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCodeblocksProjectPath::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setCodeblocksProjectPath(FilePath(m_picker->getText().toStdWString()));
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentCodeblocksProjectPath::check()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizzardContentCodeblocksProjectPath::getFilePaths() const
|
||||
{
|
||||
const_cast<QtProjectWizzardContentCodeblocksProjectPath*>(this)->load();
|
||||
|
||||
return m_filePaths;
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentCodeblocksProjectPath::getFileNamesTitle() const
|
||||
{
|
||||
return "Source Files";
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentCodeblocksProjectPath::getFileNamesDescription() const
|
||||
{
|
||||
return " source files will be indexed.";
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCodeblocksProjectPath::pickedPath()
|
||||
{
|
||||
m_window->saveContent();
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
|
||||
{
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCodeblocksProject(codeblocksSettings))
|
||||
{
|
||||
if (projectPath.contains(path))
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
|
||||
}
|
||||
}
|
||||
codeblocksSettings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
|
||||
}
|
||||
|
||||
m_window->loadContent();
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentSonargraphProjectPath::QtProjectWizzardContentSonargraphProjectPath(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
@@ -500,26 +628,23 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceMaven::getFilePaths() con
|
||||
settings->getShouldIndexMavenTests()
|
||||
);
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings))
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
sourceDirectories,
|
||||
settings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
settings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
|
||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
sourceDirectories,
|
||||
settings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
|
||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||
if (projectPath.exists())
|
||||
{
|
||||
if (projectPath.exists())
|
||||
{
|
||||
path.makeRelativeTo(projectPath);
|
||||
}
|
||||
|
||||
list.push_back(path);
|
||||
path.makeRelativeTo(projectPath);
|
||||
}
|
||||
|
||||
list.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +766,7 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceGradle::getFilePaths() co
|
||||
settings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
const FilePath projectPath = settings->getProjectDirectoryPath();
|
||||
|
||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||
{
|
||||
|
||||
@@ -71,6 +71,34 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentCodeblocksProjectPath
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCodeblocksProjectPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
virtual bool check() override;
|
||||
|
||||
virtual std::vector<FilePath> getFilePaths() const override;
|
||||
virtual QString getFileNamesTitle() const override;
|
||||
virtual QString getFileNamesDescription() const override;
|
||||
|
||||
private slots:
|
||||
void pickedPath();
|
||||
|
||||
private:
|
||||
QLabel* m_fileCountLabel;
|
||||
std::vector<FilePath> m_filePaths;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentSonargraphProjectPath
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
|
||||
@@ -16,14 +16,17 @@
|
||||
#include "qt/window/QtSelectPathsDialog.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsWithClasspath.h"
|
||||
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
#include "utility/CompilationDatabase.h"
|
||||
#include "utility/codeblocks/CodeblocksProject.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/sonargraph/SonargraphProject.h"
|
||||
#include "utility/CompilationDatabase.h"
|
||||
#include "utility/ScopedFunctor.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityFile.h"
|
||||
@@ -241,16 +244,17 @@ std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
|
||||
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> extensionSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
|
||||
|
||||
if (pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
if (extensionSettings && pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
pathSettings->getSourcePathsExpandedAndAbsolute(),
|
||||
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
extensionSettings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const std::set<FilePath> filePaths = fileManager.getAllSourceFilePathsRelative(m_settings->getProjectDirectoryPath());
|
||||
@@ -283,7 +287,7 @@ std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths
|
||||
{
|
||||
for (const FilePath& path : sonargraphProject->getAllSourceFilePathsCanonical())
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getParentDirectory());
|
||||
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
|
||||
}
|
||||
utility::append(indexedHeaderPaths, sonargraphProject->getAllCxxHeaderSearchPathsCanonical());
|
||||
}
|
||||
@@ -296,6 +300,32 @@ std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths
|
||||
return utility::getTopLevelPaths(indexedHeaderPaths);
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCodeblocksProject(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> settings)
|
||||
{
|
||||
const FilePath projectPath = settings->getProjectDirectoryPath();
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
{
|
||||
const FilePath codeblocksProjectPath = settings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.empty() && codeblocksProjectPath.exists())
|
||||
{
|
||||
if (std::shared_ptr<Codeblocks::Project> codeblocksProject = Codeblocks::Project::load(codeblocksProjectPath))
|
||||
{
|
||||
for (const FilePath& path : codeblocksProject->getAllSourceFilePathsCanonical(settings))
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
|
||||
}
|
||||
utility::append(indexedHeaderPaths, codeblocksProject->getAllCxxHeaderSearchPathsCanonical());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unable to fetch indexed header paths. The provided Sonargraph project path does not exist.");
|
||||
}
|
||||
}
|
||||
return utility::getTopLevelPaths(indexedHeaderPaths);
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxCdb> settings)
|
||||
{
|
||||
@@ -306,13 +336,13 @@ std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths
|
||||
{
|
||||
for (const FilePath& path : IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath))
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getParentDirectory());
|
||||
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
|
||||
}
|
||||
for (const FilePath& path : utility::CompilationDatabase(cdbPath).getAllHeaderPaths())
|
||||
{
|
||||
if (path.exists())
|
||||
{
|
||||
indexedHeaderPaths.insert(path);
|
||||
indexedHeaderPaths.insert(path.getCanonical());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,6 +467,38 @@ void QtProjectWizzardContentIndexedHeaderPaths::buttonClicked()
|
||||
m_settings->getProjectDirectoryPath()
|
||||
);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
|
||||
{
|
||||
const FilePath codeblocksProjectPath = codeblocksSettings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.exists())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The provided Code::Blocks project path does not exist.");
|
||||
msgBox.setDetailedText(QString::fromStdWString(codeblocksProjectPath.wstr()));
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
m_filesDialog = std::make_shared<QtSelectPathsDialog>(
|
||||
"Select from Include Paths",
|
||||
"The list contains all Include Paths found in the Code::Blocks project. Red paths do not exist. Select the "
|
||||
"paths containing the header files you want to index with Sourcetrail.");
|
||||
m_filesDialog->setup();
|
||||
|
||||
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog);
|
||||
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentIndexedHeaderPaths::closedFilesDialog);
|
||||
|
||||
const FilePath projectPath = codeblocksSettings->getProjectDirectoryPath();
|
||||
|
||||
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
|
||||
utility::convert<FilePath, FilePath>(
|
||||
getIndexedPathsDerivedFromCodeblocksProject(codeblocksSettings),
|
||||
[&](const FilePath& path) { return path.getRelativeTo(projectPath); }
|
||||
),
|
||||
codeblocksSettings->getIndexedHeaderPaths(),
|
||||
m_settings->getProjectDirectoryPath()
|
||||
);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
|
||||
{
|
||||
const FilePath cdbPath = cdbSettings->getCompilationDatabasePathExpandedAndAbsolute();
|
||||
@@ -471,8 +533,11 @@ void QtProjectWizzardContentIndexedHeaderPaths::buttonClicked()
|
||||
}
|
||||
}
|
||||
|
||||
m_filesDialog->showWindow();
|
||||
m_filesDialog->raise();
|
||||
if (m_filesDialog)
|
||||
{
|
||||
m_filesDialog->showWindow();
|
||||
m_filesDialog->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog()
|
||||
@@ -627,10 +692,11 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
|
||||
|
||||
std::thread([&]()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> extensionSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
|
||||
|
||||
if (pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
if (extensionSettings && pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
{
|
||||
std::vector<IncludeDirective> unresolvedIncludes;
|
||||
{
|
||||
@@ -651,7 +717,7 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
|
||||
fileManager.update(
|
||||
pathSettings->getSourcePathsExpandedAndAbsolute(),
|
||||
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
extensionSettings->getSourceExtensions()
|
||||
);
|
||||
sourceFilePaths = fileManager.getAllSourceFilePaths();
|
||||
|
||||
@@ -695,13 +761,14 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
// TODO: regard Force Includes here, too!
|
||||
const std::vector<FilePath> searchedPaths = m_settings->makePathsExpandedAndAbsolute(m_pathsDialog->getPaths());
|
||||
closedPathsDialog();
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
|
||||
|
||||
if (pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
|
||||
std::thread([=]()
|
||||
{
|
||||
std::thread([=]()
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> extensionSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
|
||||
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
|
||||
|
||||
if (extensionSettings && pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
{
|
||||
std::set<FilePath> detectedHeaderSearchPaths;
|
||||
{
|
||||
@@ -720,7 +787,7 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
fileManager.update(
|
||||
pathSettings->getSourcePathsExpandedAndAbsolute(),
|
||||
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
extensionSettings->getSourceExtensions()
|
||||
);
|
||||
sourceFilePaths = fileManager.getAllSourceFilePaths();
|
||||
|
||||
@@ -753,8 +820,8 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
}
|
||||
|
||||
m_showDetectedIncludesResultFunctor(detectedHeaderSearchPaths);
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePathsDialog()
|
||||
|
||||
@@ -14,6 +14,7 @@ class QPushButton;
|
||||
class QtPathListDialog;
|
||||
class SourceGroupSettings;
|
||||
class SourceGroupSettingsCxxCdb;
|
||||
class SourceGroupSettingsCxxCodeblocks;
|
||||
class SourceGroupSettingsCxxSonargraph;
|
||||
|
||||
class QtProjectWizzardContentPaths
|
||||
@@ -88,6 +89,7 @@ class QtProjectWizzardContentIndexedHeaderPaths
|
||||
|
||||
public:
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromSonargraphProject(std::shared_ptr<const SourceGroupSettingsCxxSonargraph> settings);
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromCodeblocksProject(std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> settings);
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromCDB(std::shared_ptr<const SourceGroupSettingsCxxCdb> settings);
|
||||
|
||||
QtProjectWizzardContentIndexedHeaderPaths(
|
||||
|
||||
@@ -32,10 +32,12 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CDB));
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_VS));
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_SONARGRAPH));
|
||||
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CODEBLOCKS));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CPP_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CDB));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_VS));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_SONARGRAPH));
|
||||
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CODEBLOCKS));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_EMPTY));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_MAVEN));
|
||||
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_GRADLE));
|
||||
@@ -47,6 +49,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_CDB] = L"cdb_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_VS] = L"vs_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_SONARGRAPH] = L"sonargraph_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_CODEBLOCKS] = L"empty_icon"; // TODO: change this
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_EMPTY] = L"empty_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_MAVEN] = L"mvn_icon";
|
||||
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_GRADLE] = L"gradle_icon";
|
||||
@@ -62,6 +65,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
"<b>Note: Requires a running Visual Studio instance with the "
|
||||
"<a href=\"https://sourcetrail.com/documentation/index.html#VisualStudio\">Visual Studio plugin</a> installed.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_SONARGRAPH] = "Create a new Source Group from an existing Sonargraph project file.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_CODEBLOCKS] = "Create a new Source Group from an existing Code::Blocks project file.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_EMPTY] = "Create a new Sourcetrail Source Group by defining which Java files will be indexed.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_MAVEN] = "Create a new Source Group from an existing Maven project.";
|
||||
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_GRADLE] = "Create a new Source Group from an existing Gradle project.";
|
||||
|
||||
@@ -32,7 +32,7 @@ std::set<FilePath> SourceGroupJava::getAllSourceFilePaths() const
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
{
|
||||
const std::string languageStandard = getSourceGroupSettingsJava()->getStandard();
|
||||
const std::string languageStandard = getSourceGroupSettingsJava()->getJavaStandard();
|
||||
|
||||
std::vector<FilePath> classPath = getClassPath();
|
||||
|
||||
|
||||
@@ -42,17 +42,23 @@ bool SourceGroupJavaSonargraph::prepareIndexing()
|
||||
|
||||
std::set<FilePath> SourceGroupJavaSonargraph::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
|
||||
{
|
||||
if (std::shared_ptr<Sonargraph::Project> project = Sonargraph::Project::load(
|
||||
m_settings->getSonargraphProjectPathExpandedAndAbsolute(), getLanguage()
|
||||
))
|
||||
std::set<FilePath> containedFilePaths;
|
||||
|
||||
const std::set<FilePath> indexedPaths = getAllSourceFilePaths();
|
||||
|
||||
for (const FilePath& filePath : filePaths)
|
||||
{
|
||||
return project->filterToContainedFilePaths(filePaths);
|
||||
for (const FilePath& indexedPath : indexedPaths)
|
||||
{
|
||||
if (indexedPath == filePath || indexedPath.contains(filePath))
|
||||
{
|
||||
containedFilePaths.insert(filePath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unable to load Sonargraph project to check the containment of file paths.");
|
||||
}
|
||||
return std::set<FilePath>();
|
||||
|
||||
return containedFilePaths;
|
||||
}
|
||||
|
||||
std::set<FilePath> SourceGroupJavaSonargraph::getAllSourceFilePaths() const
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef UTILITY_STRING_H
|
||||
#define UTILITY_STRING_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@@ -425,17 +425,6 @@ private:
|
||||
: SourceGroupSettings("TEST_ID", SOURCE_GROUP_UNKNOWN, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::string> getAvailableLanguageStandards() const override
|
||||
{
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string getDefaultStandard() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
class SourceGroupTest : public SourceGroup
|
||||
|
||||
Reference in New Issue
Block a user