logic: maven project setup

* added option to create a Coati project from a Maven POM file
* show list of indexed file paths in maven project setup
* use FileManager to detect indexed files in project setup (except cdb)
* added Maven path to preferences window and added path detectors.
* fixed: QtDialogView::hideStatusDialog now also hides loader in status bar.
* refactored ProjectType

fortune cookie message = If you continually give, you will continually have.
This commit is contained in:
malte_langkabel
2017-03-08 14:55:42 +01:00
parent d6f3099981
commit 3cbe83f9e6
83 changed files with 1502 additions and 545 deletions
+10
View File
@@ -247,6 +247,16 @@ void ApplicationSettings::setJavaMaximumMemory(int size)
setValue<int>("indexing/java/java_maximum_memory", size);
}
std::string ApplicationSettings::getMavenPath() const
{
return getValue<std::string>("indexing/java/maven_path", "");
}
void ApplicationSettings::setMavenPath(const std::string path)
{
setValue<std::string>("indexing/java/maven_path", path);
}
std::vector<FilePath> ApplicationSettings::getHeaderSearchPaths() const
{
return getPathValues("indexing/cxx/header_search_paths/header_search_path");
+3
View File
@@ -76,6 +76,9 @@ public:
int getJavaMaximumMemory() const;
void setJavaMaximumMemory(int size);
std::string getMavenPath() const;
void setMavenPath(const std::string path);
std::vector<FilePath> getHeaderSearchPaths() const;
std::vector<FilePath> getHeaderSearchPathsExpanded() const;
bool setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths);
+25
View File
@@ -23,6 +23,31 @@ CxxProjectSettings::~CxxProjectSettings()
{
}
ProjectType CxxProjectSettings::getProjectType() const
{
if (!getVisualStudioSolutionPath().empty()) // I think this is crap. VS solution path is not used anymore.. so vs projects are handled like cdb projects
{
return PROJECT_CXX_VS;
}
else if (!getCompilationDatabasePath().empty())
{
return PROJECT_CXX_CDB;
}
else
{
switch (getLanguage())
{
case LANGUAGE_C:
return PROJECT_C_EMPTY;
case LANGUAGE_CPP:
return PROJECT_CPP_EMPTY;
default:
return PROJECT_UNKNOWN;
}
}
return PROJECT_UNKNOWN;
}
bool CxxProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other) const
{
if (other.getLanguage() == getLanguage())
+2
View File
@@ -11,6 +11,8 @@ public:
CxxProjectSettings(std::string projectName, const FilePath& projectFileLocation);
virtual ~CxxProjectSettings();
virtual ProjectType getProjectType() const;
virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const;
virtual std::vector<std::string> getLanguageStandards() const;
+46 -2
View File
@@ -23,6 +23,11 @@ JavaProjectSettings::~JavaProjectSettings()
{
}
ProjectType JavaProjectSettings::getProjectType() const
{
return PROJECT_JAVA_EMPTY;
}
bool JavaProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other) const
{
if (other.getLanguage() == getLanguage())
@@ -51,9 +56,48 @@ std::vector<FilePath> JavaProjectSettings::getAbsoluteClasspaths() const
return makePathsAbsolute(expandPaths(getClasspaths()));
}
bool JavaProjectSettings::setClasspaths(const std::vector<FilePath>& paths)
bool JavaProjectSettings::setClasspaths(const std::vector<FilePath>& classpaths)
{
return setPathValues("source/class_paths/class_path", paths);
return setPathValues("source/class_paths/class_path", classpaths);
}
FilePath JavaProjectSettings::getMavenProjectFilePath() const
{
return FilePath(getValue<std::string>("source/maven/project_root", ""));
}
FilePath JavaProjectSettings::getAbsoluteMavenProjectFilePath() const
{
return makePathAbsolute(expandPath(getMavenProjectFilePath()));
}
bool JavaProjectSettings::setMavenProjectFilePath(const FilePath& path)
{
return setValue("source/maven/project_root", path.str());
}
FilePath JavaProjectSettings::getMavenDependenciesDirectory() const
{
return FilePath(getValue<std::string>("source/maven/dependencies_directory", ""));
}
FilePath JavaProjectSettings::getAbsoluteMavenDependenciesDirectory() const
{
return makePathAbsolute(expandPath(getMavenDependenciesDirectory()));
}
bool JavaProjectSettings::setMavenDependenciesDirectory(const FilePath& path)
{
return setValue("source/maven/dependencies_directory", path.str());
}
bool JavaProjectSettings::getShouldIndexMavenTests() const
{
return getValue<bool>("source/maven/should_index_tests", false);
}
void JavaProjectSettings::setShouldIndexMavenTests(bool value)
{
setValue<bool>("source/maven/should_index_tests", value);
}
std::vector<std::string> JavaProjectSettings::getDefaultSourceExtensions() const
+14 -1
View File
@@ -12,13 +12,26 @@ public:
JavaProjectSettings(std::string projectName, const FilePath& projectFileLocation);
virtual ~JavaProjectSettings();
virtual ProjectType getProjectType() const;
virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const;
virtual std::vector<std::string> getLanguageStandards() const;
std::vector<FilePath> getClasspaths() const;
std::vector<FilePath> getAbsoluteClasspaths() const;
bool setClasspaths(const std::vector<FilePath>& headerSearchPaths);
bool setClasspaths(const std::vector<FilePath>& classpaths);
FilePath getMavenProjectFilePath() const;
FilePath getAbsoluteMavenProjectFilePath() const;
bool setMavenProjectFilePath(const FilePath& path);
FilePath getMavenDependenciesDirectory() const;
FilePath getAbsoluteMavenDependenciesDirectory() const;
bool setMavenDependenciesDirectory(const FilePath& path);
bool getShouldIndexMavenTests() const;
void setShouldIndexMavenTests(bool value);
private:
virtual std::vector<std::string> getDefaultSourceExtensions() const;
+22
View File
@@ -47,3 +47,25 @@ std::string getSymbolNameDelimiterForLanguage(LanguageType t)
}
return "@";
}
LanguageType getLanguageTypeForProjectType(ProjectType t)
{
switch (t)
{
case PROJECT_C_EMPTY:
return LANGUAGE_C;
case PROJECT_CPP_EMPTY:
return LANGUAGE_CPP;
case PROJECT_CXX_CDB:
return LANGUAGE_CPP;
case PROJECT_CXX_VS:
return LANGUAGE_CPP;
case PROJECT_JAVA_EMPTY:
return LANGUAGE_JAVA;
case PROJECT_JAVA_MAVEN:
return LANGUAGE_JAVA;
default:
break;
}
}
+3
View File
@@ -3,6 +3,8 @@
#include <string>
#include "settings/ProjectType.h"
enum LanguageType
{
LANGUAGE_C,
@@ -15,5 +17,6 @@ std::string languageTypeToString(LanguageType t);
LanguageType stringToLanguageType(std::string s);
std::string getSymbolNameDelimiterForLanguage(LanguageType t);
LanguageType getLanguageTypeForProjectType(ProjectType t);
#endif // LANGUAGE_TYPE_H
+5
View File
@@ -32,6 +32,11 @@ ProjectSettings::~ProjectSettings()
{
}
ProjectType ProjectSettings::getProjectType() const
{
return PROJECT_UNKNOWN;
}
bool ProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other) const
{
return (
+3 -1
View File
@@ -20,6 +20,8 @@ public:
ProjectSettings(std::string projectName, const FilePath& projectFileLocation);
virtual ~ProjectSettings();
virtual ProjectType getProjectType() const;
virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const;
virtual std::vector<std::string> getLanguageStandards() const;
@@ -36,7 +38,7 @@ public:
void setProjectFileLocation(const FilePath& location);
std::string getDescription() const;
LanguageType getLanguage() const;
bool setLanguage(LanguageType language);
+53
View File
@@ -0,0 +1,53 @@
#include "settings/ProjectType.h"
std::string projectTypeToString(ProjectType v)
{
switch (v)
{
case PROJECT_C_EMPTY:
return "Empty C Project";
case PROJECT_CPP_EMPTY:
return "Empty C++ Project";
case PROJECT_CXX_CDB:
return "C/C++ from Compilation Database";
case PROJECT_CXX_VS:
return "C/C++ from Visual Studio";
case PROJECT_JAVA_EMPTY:
return "Empty Java Project";
case PROJECT_JAVA_MAVEN:
return "Java Project from Maven";
case PROJECT_UNKNOWN:
break;
}
return "unknown";
}
ProjectType stringToProjectType(std::string v)
{
if (v == projectTypeToString(PROJECT_C_EMPTY))
{
return PROJECT_C_EMPTY;
}
else if (v == projectTypeToString(PROJECT_CPP_EMPTY))
{
return PROJECT_CPP_EMPTY;
}
else if (v == projectTypeToString(PROJECT_CXX_CDB))
{
return PROJECT_CXX_CDB;
}
else if (v == projectTypeToString(PROJECT_CXX_VS))
{
return PROJECT_CXX_VS;
}
else if (v == projectTypeToString(PROJECT_JAVA_EMPTY))
{
return PROJECT_JAVA_EMPTY;
}
else if (v == projectTypeToString(PROJECT_JAVA_MAVEN))
{
return PROJECT_JAVA_MAVEN;
}
return PROJECT_UNKNOWN;
}
+20
View File
@@ -0,0 +1,20 @@
#ifndef PROJECT_TYPE_H
#define PROJECT_TYPE_H
#include <string>
enum ProjectType
{
PROJECT_C_EMPTY,
PROJECT_CPP_EMPTY,
PROJECT_CXX_CDB,
PROJECT_CXX_VS,
PROJECT_JAVA_EMPTY,
PROJECT_JAVA_MAVEN,
PROJECT_UNKNOWN
};
std::string projectTypeToString(ProjectType v);
ProjectType stringToProjectType(std::string v);
#endif // PROJECT_TYPE_H