logic: cleaned up code for SourceGroupSettings and Wizzard
* Flattened sourcegroupsettings class hierarchy by moving cross compilation options to own base class * QtProjectWizzardContentFlags constructor required correct settings object to reduce the need for type casting * QtProjectWizzardContentPath constructors required correct settings objects * moved SourcePaths from SourceGroupSettingsJava to SourceGroupSettingsJavaEmpty because they are not required for Gradle and Maven projects * removed classpath from maven and gradle source group settings * reuse code of SourceGroup for "show source files" in wizard
This commit is contained in:
@@ -24,7 +24,7 @@ std::vector<FilePath> SourceGroupJavaEmpty::getAllSourcePaths() const
|
||||
|
||||
std::vector<FilePath> SourceGroupJavaEmpty::doGetClassPath() const
|
||||
{
|
||||
return utility::getClassPath(getSourceGroupSettingsJava(), getAllSourceFilePaths());
|
||||
return utility::getClassPath(m_settings->getClasspathExpandedAndAbsolute(), m_settings->getUseJreSystemLibrary(), getAllSourceFilePaths());
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsJava> SourceGroupJavaEmpty::getSourceGroupSettingsJava()
|
||||
|
||||
@@ -42,12 +42,16 @@ std::vector<FilePath> SourceGroupJavaGradle::getAllSourcePaths() const
|
||||
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO("Could not find any source paths because Gradle project path does not exist.");
|
||||
}
|
||||
return sourcePaths;
|
||||
}
|
||||
|
||||
std::vector<FilePath> SourceGroupJavaGradle::doGetClassPath() const
|
||||
{
|
||||
std::vector<FilePath> classPath = utility::getClassPath(getSourceGroupSettingsJava(), getAllSourceFilePaths());
|
||||
std::vector<FilePath> classPath = utility::getClassPath({}, true, getAllSourceFilePaths());
|
||||
|
||||
if (m_settings->getGradleDependenciesDirectoryExpandedAndAbsolute().exists())
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ std::vector<FilePath> SourceGroupJavaMaven::getAllSourcePaths() const
|
||||
|
||||
std::vector<FilePath> SourceGroupJavaMaven::doGetClassPath() const
|
||||
{
|
||||
std::vector<FilePath> classPath = utility::getClassPath(getSourceGroupSettingsJava(), getAllSourceFilePaths());
|
||||
std::vector<FilePath> classPath = utility::getClassPath({}, true, getAllSourceFilePaths());
|
||||
|
||||
if (m_settings && m_settings->getMavenDependenciesDirectoryExpandedAndAbsolute().exists())
|
||||
{
|
||||
|
||||
@@ -92,7 +92,10 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJavaSonargraph::getIndex
|
||||
|
||||
if (!indexerCommands.empty())
|
||||
{
|
||||
const std::vector<FilePath> classPath = utility::getClassPath(m_settings, getAllSourceFilePaths()); // TODO: remove this hack once sourcegroup and sourcegroupsettings are merged
|
||||
// TODO: remove this hack once sourcegroup and sourcegroupsettings are merged
|
||||
const std::vector<FilePath> classPath = utility::getClassPath(
|
||||
m_settings->getClasspathExpandedAndAbsolute(), m_settings->getUseJreSystemLibrary(), getAllSourceFilePaths()
|
||||
);
|
||||
for (std::shared_ptr<IndexerCommand> indexerCommand : indexerCommands)
|
||||
{
|
||||
if (std::shared_ptr<IndexerCommandJava> javaIndexerCommand = std::dynamic_pointer_cast<IndexerCommandJava>(indexerCommand))
|
||||
|
||||
@@ -149,11 +149,11 @@ namespace utility
|
||||
return rootDirectories;
|
||||
}
|
||||
|
||||
std::vector<FilePath> getClassPath(std::shared_ptr<const SourceGroupSettingsWithClasspath> settings, const std::set<FilePath>& sourceFilePaths)
|
||||
std::vector<FilePath> getClassPath(const std::vector<FilePath>& classpathItems, bool useJreSystemLibrary, const std::set<FilePath>& sourceFilePaths)
|
||||
{
|
||||
std::vector<FilePath> classPath;
|
||||
|
||||
for (const FilePath& classpath : settings->getClasspathExpandedAndAbsolute())
|
||||
for (const FilePath& classpath : classpathItems)
|
||||
{
|
||||
if (classpath.exists())
|
||||
{
|
||||
@@ -162,7 +162,7 @@ namespace utility
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->getUseJreSystemLibrary())
|
||||
if (useJreSystemLibrary)
|
||||
{
|
||||
for (const FilePath& systemLibraryPath : ApplicationSettings::getInstance()->getJreSystemLibraryPathsExpanded())
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace utility
|
||||
bool prepareJavaEnvironmentAndDisplayOccurringErrors();
|
||||
std::set<FilePath> fetchRootDirectories(const std::set<FilePath>& sourceFilePaths);
|
||||
std::vector<FilePath> getClassPath(
|
||||
std::shared_ptr<const SourceGroupSettingsWithClasspath> settings,
|
||||
const std::vector<FilePath>& classpathItems,
|
||||
bool useJreSystemLibrary,
|
||||
const std::set<FilePath>& sourceFilePaths);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user