Logic: VS Solution Parsing update

Updated vs solution parsing, fixed some issues. Also fixed some issues with corresponding unit tests.
This commit is contained in:
Manuel Dobusch
2016-02-15 17:55:01 +01:00
parent 1113544b6b
commit d31557cb66
10 changed files with 636 additions and 18 deletions
+185 -4
View File
@@ -1,5 +1,177 @@
ConfigManager.cpp WARNING: value path/to/nowhere is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
Token.cpp ERROR: Location Id was not referenced by this Token.
Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class
Edge.cpp ERROR: Nodes are not plain copies.
@@ -48,7 +220,20 @@ Edge.cpp ERROR: Nodes are not plain copies.
NetworkProtocolHelper.cpp ERROR: Failed to parse message, invalid type token
NetworkProtocolHelper.cpp ERROR: Failed to parse setActiveToken message, invalid token count
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
ConfigManager.cpp WARNING: value Bool is not present in config.
ConfigManager.cpp WARNING: value Int is not present in config.
ConfigManager.cpp WARNING: value Float is not present in config.
ConfigManager.cpp WARNING: value String is not present in config.
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
ConfigManager.cpp WARNING: value Bool is not present in config.
ConfigManager.cpp WARNING: value Int is not present in config.
ConfigManager.cpp WARNING: value Float is not present in config.
ConfigManager.cpp WARNING: value String is not present in config.
ConfigManager.cpp WARNING: value Bool is not present in config.
ConfigManager.cpp WARNING: value Int is not present in config.
ConfigManager.cpp WARNING: value Float is not present in config.
ConfigManager.cpp WARNING: value String is not present in config.
ConfigManager.cpp WARNING: value NewBool is not present in config.
INFO: file: file.cpp < 0:0 0:0>
TextAccess.cpp ERROR: Could not open file file.cpp
INFO: typedef: type -> int <file.cpp 1:1 1:1>
@@ -150,7 +335,3 @@ TextAccess.cpp WARNING: Line numbers start with one, is 0
TextAccess.cpp WARNING: Line numbers start with one, is 0
TokenLocationCollection.cpp ERROR: Can't create TokenLocation with wrong boundaries.
TokenLocationCollection.cpp ERROR: Can't create TokenLocation with wrong boundaries.
SolutionParserVisualStudio.cpp WARNING: boost::filesystem::canonical: No such file or directory: "C:\Users\Manuel\FH\MSc\Masterproject\Project\bin\test\data/vsSolutionParserTestSuite/..\src\lib\utility\solution\SolutionParserCMake.cpp"
SolutionParserVisualStudio.cpp WARNING: boost::filesystem::canonical: No such file or directory: "C:\Users\Manuel\FH\MSc\Masterproject\Project\bin\test\data/vsSolutionParserTestSuite/..\src\lib\utility\solution\SolutionParserCMake.h"
SolutionParserVisualStudio.cpp WARNING: boost::filesystem::canonical: No such file or directory: "C:\Users\Manuel\FH\MSc\Masterproject\Project\src\lib\utility\messaging\type\MessageShowFile.h"
SolutionParserVisualStudio.cpp WARNING: boost::filesystem::canonical: No such file or directory: "C:\Users\Manuel\FH\MSc\Masterproject\Project\src\lib\utility\messaging\type\MessageShowSnippets.h"
@@ -3428,14 +3428,14 @@
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Coati"
"ProductCode" = "8:{2A3B2FF5-A114-4CAB-88FB-DE8942D5B8EB}"
"PackageCode" = "8:{5D9BE539-F957-474F-BAA8-12F8EF1CC46A}"
"PackageCode" = "8:{C87131CC-CFB6-458C-BDD9-281ECEC192EF}"
"UpgradeCode" = "8:{CFF09D53-87AF-4241-960D-98C21ED9D358}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:0.1"
"ProductVersion" = "8:0.4"
"Manufacturer" = "8:Coati Software"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:www.coati.io/support"
@@ -42,7 +42,7 @@ namespace SetupCreateStartMenuShortcutLib
}
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress + _appShortcutName);
shortcut.Description = "Fast source code reading and navigation";
shortcut.Description = "Fast source code navigation and visualization";
shortcut.TargetPath = app;
shortcut.WorkingDirectory = appDirectory;
shortcut.IconLocation = appDirectory + "data\\gui\\icon\\coati.ico";
@@ -35,7 +35,7 @@ namespace SetupRemoveCacheFiles
{
try
{
string appDataCoatiPath = Environment.GetEnvironmentVariable("APPDATA") + "\\..\\local\\Coati Software\\Coati\\";
string appDataCoatiPath = Environment.GetEnvironmentVariable("APPDATA") + "\\..\\local\\Coati Software"; // \\Coati\\";
Directory.Delete(appDataCoatiPath, true);
}
+2
View File
@@ -67,3 +67,5 @@ if [ $PLATFORM == "Linux" ] || [ $PLATFORM == "MacOS" ]; then
fi
echo -e $SUCCESS "setup complete"
sleep 5
@@ -92,7 +92,7 @@ void IDECommunicationController::handleCreateProjectMessage(const NetworkProtoco
std::vector<std::string> includePaths = parser.getIncludePaths();
std::vector<std::string> projectItems = parser.getProjectItems();
std::vector<FilePath> projectFPs;
/*std::vector<FilePath> projectFPs;
std::vector<FilePath> includeFPs;
for (unsigned int i = 0; i < projectItems.size(); i++)
@@ -103,7 +103,7 @@ void IDECommunicationController::handleCreateProjectMessage(const NetworkProtoco
for (unsigned int i = 0; i < includePaths.size(); i++)
{
includeFPs.push_back(FilePath(includePaths[i]));
}
}*/
/*ProjectSettings* projSettings = ProjectSettings::getInstance().get();
projSettings->clear();
@@ -73,6 +73,34 @@ std::vector<std::string> SolutionParserVisualStudio::getProjectFiles()
}
std::vector<std::string> SolutionParserVisualStudio::getProjectItems()
{
std::vector<std::string> projectItems = findProjectItems();
projectItems = makePathsCanonical(projectItems);
return projectItems;
}
std::vector<std::string> SolutionParserVisualStudio::getIncludePaths()
{
std::vector<std::string> includePaths = findIncludePaths();
includePaths = makePathsCanonical(includePaths);
return includePaths;
}
std::vector<std::string> SolutionParserVisualStudio::getProjectItemsNonCanonical()
{
return findProjectItems();
}
std::vector<std::string> SolutionParserVisualStudio::getIncludePathsNonCanonical()
{
return findIncludePaths();
}
std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
{
std::vector<std::string> projectItems;
@@ -81,6 +109,12 @@ std::vector<std::string> SolutionParserVisualStudio::getProjectItems()
std::vector<std::string> relativeProjectPaths;
std::vector<std::string> validFileExtensions;
validFileExtensions.push_back(".c");
validFileExtensions.push_back(".cpp");
validFileExtensions.push_back(".h");
validFileExtensions.push_back(".hpp");
for (unsigned int i = 0; i < projectFilesNames.size(); i++)
{
size_t pos = projectFilesNames[i].find_last_of("/");
@@ -157,7 +191,10 @@ std::vector<std::string> SolutionParserVisualStudio::getProjectItems()
filePath = relativeProjectPaths[i] + "/" + filePath;
}
projectItems.push_back(filePath);
if (checkValidFileExtension(filePath, validFileExtensions))
{
projectItems.push_back(filePath);
}
}
}
}
@@ -167,17 +204,22 @@ std::vector<std::string> SolutionParserVisualStudio::getProjectItems()
projectItems = resolveEnvironmentVariables(projectItems);
projectItems = makePathsAbsolute(projectItems);
projectItems = makePathsCanonical(projectItems);
return projectItems;
}
std::vector<std::string> SolutionParserVisualStudio::getIncludePaths()
std::vector<std::string> SolutionParserVisualStudio::findIncludePaths()
{
std::vector<std::string> includePaths;
std::vector<std::string> projectFiles = getProjectFiles();
std::vector<std::string> validExtensions;
validExtensions.push_back(".c");
validExtensions.push_back(".cpp");
validExtensions.push_back(".h");
validExtensions.push_back(".hpp");
for (unsigned int i = 0; i < projectFiles.size(); i++)
{
TiXmlDocument doc;
@@ -195,7 +237,9 @@ std::vector<std::string> SolutionParserVisualStudio::getIncludePaths()
for (unsigned int j = 0; j < nodes.size(); j++)
{
includePaths.push_back(nodes[j]->GetText());
std::string path = nodes[j]->GetText();
includePaths.push_back(path);
}
}
@@ -206,11 +250,25 @@ std::vector<std::string> SolutionParserVisualStudio::getIncludePaths()
includePaths = resolveEnvironmentVariables(includePaths);
includePaths = makePathsAbsolute(includePaths);
includePaths = makePathsCanonical(includePaths);
return includePaths;
}
bool SolutionParserVisualStudio::checkValidFileExtension(const std::string& file, const std::vector<std::string>& validExtensions)
{
for (unsigned int i = 0; i < validExtensions.size(); i++)
{
size_t pos = file.find(validExtensions[i]);
if (pos != std::string::npos)
{
return true;
}
}
return false;
}
std::vector<std::string> SolutionParserVisualStudio::getProjectBlocks(const std::string& solution) const
{
std::vector<std::string> blocks;
@@ -596,6 +654,7 @@ std::vector<std::string> SolutionParserVisualStudio::makePathsCanonical(const st
}
catch (std::exception& e)
{
std::string what = e.what();
LOG_WARNING_STREAM(<< e.what());
}
}
@@ -18,7 +18,15 @@ public:
virtual std::vector<std::string> getProjectItems();
virtual std::vector<std::string> getIncludePaths();
std::vector<std::string> getProjectItemsNonCanonical(); // for testing purposes, paths returned are non canonical, don't use if you don't know what that means
std::vector<std::string> getIncludePathsNonCanonical(); // for testing purposes, paths returned are non canonical, don't use if you don't know what that means
private:
std::vector<std::string> findProjectItems();
std::vector<std::string> findIncludePaths();
bool checkValidFileExtension(const std::string& file, const std::vector<std::string>& validExtensions);
std::vector<std::string> getProjectBlocks(const std::string& solution) const;
std::string getProjectFilePath(const std::string& projectBlock) const;
@@ -0,0 +1,368 @@
#include "qt/window/QtProjectSetupScreen.h"
#include <QFileDialog>
#include <QFormLayout>
#include <QLineEdit>
#include <QMessageBox>
#include <QSysInfo>
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/utility.h"
#include "settings/ProjectSettings.h"
QtTextLine::QtTextLine(QWidget *parent)
: QWidget(parent)
{
QBoxLayout* layout = new QHBoxLayout();
layout->setSpacing(0);
layout->setContentsMargins(1, 1, 1, 1);
layout->setAlignment(Qt::AlignTop);
setLayout(layout);
m_data = new QtLineEdit(this);
m_data->setAttribute(Qt::WA_MacShowFocusRect, 0);
m_data->setObjectName("locationField");
m_button = new QPushButton("...");
m_button->setObjectName("moreButton");
layout->addWidget(m_data);
layout->addWidget(m_button);
connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress()));
}
QString QtTextLine::getText()
{
return m_data->text();
}
void QtTextLine::setText(QString text)
{
m_data->setText(text);
}
void QtTextLine::clearText()
{
m_data->clear();
}
void QtTextLine::handleButtonPress()
{
QString file = QFileDialog::getExistingDirectory(this, tr("Select Directory"), "");
if (!file.isEmpty())
{
m_data->setText(file);
}
}
QtProjectSetupScreen::QtProjectSetupScreen(QWidget *parent)
: QtSettingsWindow(parent)
, m_frameworkPaths(nullptr)
{
}
QSize QtProjectSetupScreen::sizeHint() const
{
return QSize(600,600);
}
void QtProjectSetupScreen::clear()
{
m_projectName->clear();
m_projectFileLocation->clearText();
m_language->setCurrentIndex(0);
m_cppStandard->setCurrentIndex(0);
m_cStandard->setCurrentIndex(0);
m_sourcePaths->clear();
m_includePaths->clear();
if (m_frameworkPaths)
{
m_frameworkPaths->clear();
}
}
void QtProjectSetupScreen::setup()
{
setupForm();
QPushButton* preferencesButton = new QPushButton("Preferences");
preferencesButton->setObjectName("windowButton");
connect(preferencesButton, SIGNAL(clicked()), this, SLOT(handlePreferencesButtonPress()));
m_buttonsLayout->insertWidget(2, preferencesButton);
m_buttonsLayout->insertStretch(3);
}
void QtProjectSetupScreen::loadEmpty()
{
updateTitle("NEW PROJECT");
updateDoneButton("Create");
clear();
}
void QtProjectSetupScreen::loadProjectSettings()
{
updateTitle("EDIT PROJECT");
updateDoneButton("Save");
ProjectSettings* projSettings = ProjectSettings::getInstance().get();
m_projectName->setText(QString::fromStdString(projSettings->getFilePath().withoutExtension().fileName()));
m_projectFileLocation->setText(QString::fromStdString(projSettings->getFilePath().parentDirectory().str()));
if (projSettings->getLanguage().length() > 0)
{
m_language->setCurrentText(QString::fromStdString(projSettings->getLanguage()));
}
if (projSettings->getStandard().length() > 0)
{
if (m_language->currentIndex() == 0) // c++
{
m_cppStandard->setCurrentText(QString::fromStdString(projSettings->getStandard()));
}
else if (m_language->currentIndex() == 1) // c
{
m_cStandard->setCurrentText(QString::fromStdString(projSettings->getStandard()));
}
}
m_sourcePaths->setList(projSettings->getSourcePaths());
m_includePaths->setList(projSettings->getHeaderSearchPaths());
if (m_frameworkPaths)
{
m_frameworkPaths->setList(projSettings->getFrameworkSearchPaths());
}
}
void QtProjectSetupScreen::setPresets(const std::string& name, const std::string& location,
const std::vector<std::string>& sourceFiles, const std::vector<std::string>& includePaths)
{
m_projectName->setText(QString::fromStdString(name));
m_projectFileLocation->setText(QString::fromStdString(location));
std::vector<FilePath> sourceFilePaths;
for (unsigned int i = 0; i < sourceFiles.size(); i++)
{
sourceFilePaths.push_back(FilePath(sourceFiles[i]));
}
std::vector<FilePath> includePathsPaths;
for (unsigned int i = 0; i < includePaths.size(); i++)
{
includePathsPaths.push_back(FilePath(includePaths[i]));
}
m_sourcePaths->setList(sourceFilePaths);
m_includePaths->setList(includePathsPaths);
}
void QtProjectSetupScreen::populateForm(QFormLayout* layout)
{
int minimumWidthForSecondCol = 360;
QLabel* nameLabel = new QLabel("Name");
m_projectName = new QLineEdit();
m_projectName->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
m_projectName->setMinimumWidth(minimumWidthForSecondCol);
m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0);
layout->addRow(nameLabel, m_projectName);
QLabel* locationLabel = new QLabel("Location");
m_projectFileLocation = new QtTextLine(this);
m_projectFileLocation->setMinimumWidth(minimumWidthForSecondCol);
layout->addRow(locationLabel, m_projectFileLocation);
QLabel* languageLabel = new QLabel("Language");
m_language = new QComboBox();
m_language->insertItem(0, "C++");
m_language->insertItem(1, "C");
connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
layout->addRow(languageLabel, m_language);
m_cppStandardLabel = new QLabel("Standard");
m_cppStandard = new QComboBox();
m_cppStandard->insertItem(0, "1z");
m_cppStandard->insertItem(1, "14");
m_cppStandard->insertItem(2, "1y");
m_cppStandard->insertItem(3, "11");
m_cppStandard->insertItem(4, "0x");
m_cppStandard->insertItem(5, "03");
m_cppStandard->insertItem(6, "98");
layout->addRow(m_cppStandardLabel, m_cppStandard);
m_cStandardLabel = new QLabel("Standard");
m_cStandard = new QComboBox();
m_cStandard->insertItem(0, "1x");
m_cStandard->insertItem(1, "11");
m_cStandard->insertItem(2, "9x");
m_cStandard->insertItem(3, "99");
m_cStandard->insertItem(4, "90");
m_cStandard->insertItem(5, "89");
layout->addRow(m_cStandardLabel, m_cStandard);
m_cStandardLabel->hide();
m_cStandard->hide();
QPushButton* helpButton;
QWidget* sourcePathsWidget = createLabelWithHelpButton("Analyzed Paths", &helpButton);
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleSourcePathHelpPress()));
m_sourcePaths = new QtDirectoryListBox(this);
m_sourcePaths->setMinimumWidth(minimumWidthForSecondCol);
layout->addRow(sourcePathsWidget, m_sourcePaths);
QWidget* includePathsWidget = createLabelWithHelpButton("Header\nSearch Paths", &helpButton);
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleIncludePathHelpPress()));
m_includePaths = new QtDirectoryListBox(this);
m_includePaths->setMinimumWidth(minimumWidthForSecondCol);
layout->addRow(includePathsWidget, m_includePaths);
if (QSysInfo::macVersion() != QSysInfo::MV_None)
{
QWidget* frameworkPathsWidget = createLabelWithHelpButton("Framework\nSearch Paths", &helpButton);
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleFrameworkPathHelpPress()));
m_frameworkPaths = new QtDirectoryListBox(this);
m_frameworkPaths->setMinimumWidth(minimumWidthForSecondCol);
layout->addRow(frameworkPathsWidget, m_frameworkPaths);
}
}
void QtProjectSetupScreen::handleCancelButtonPress()
{
emit canceled();
}
void QtProjectSetupScreen::handleUpdateButtonPress()
{
if (m_projectName->text().isEmpty())
{
QMessageBox msgBox;
msgBox.setText("Please enter a project name.");
msgBox.exec();
return;
}
if (m_projectFileLocation->getText().isEmpty())
{
QMessageBox msgBox;
msgBox.setText("Please define the location of the project file.");
msgBox.exec();
return;
}
if (!m_sourcePaths->getList().size())
{
QMessageBox msgBox;
msgBox.setText("Please add at least one source path to your project.");
msgBox.exec();
return;
}
std::shared_ptr<ProjectSettings> projectSettings = ProjectSettings::getInstance();
std::string newLanguage = m_language->currentText().toStdString();
std::string newStandard = "";
if (m_cppStandard->isVisible())
{
newStandard = m_cppStandard->currentText().toStdString();
}
else if (m_cStandard->isVisible())
{
newStandard = m_cStandard->currentText().toStdString();
}
std::vector<FilePath> newSourcePaths = m_sourcePaths->getList();
std::vector<FilePath> newHeaderSearchPaths = m_includePaths->getList();
std::vector<FilePath> newFrameworkPaths = m_frameworkPaths ? m_frameworkPaths->getList() : std::vector<FilePath>();
bool somethingChanged = !(
newLanguage == projectSettings->getLanguage() &&
newStandard == projectSettings->getStandard() &&
utility::isPermutation<FilePath>(newSourcePaths, projectSettings->getSourcePaths()) &&
utility::isPermutation<FilePath>(newHeaderSearchPaths, projectSettings->getHeaderSearchPaths()) &&
utility::isPermutation<FilePath>(newFrameworkPaths, projectSettings->getFrameworkSearchPaths())
);
projectSettings->clear();
projectSettings->setLanguage(newLanguage);
projectSettings->setStandard(newStandard);
projectSettings->setSourcePaths(newSourcePaths);
projectSettings->setHeaderSearchPaths(newHeaderSearchPaths);
projectSettings->setFrameworkSearchPaths(newFrameworkPaths);
std::string projectFilePath =
m_projectFileLocation->getText().toStdString() + "/" + m_projectName->text().toStdString() + ".coatiproject";
projectSettings->save(projectFilePath);
if (m_title->text() == "NEW PROJECT")
{
MessageLoadProject(projectFilePath, false).dispatch();
}
else if (somethingChanged)
{
MessageLoadProject(projectFilePath, true).dispatch();
}
emit finished();
}
void QtProjectSetupScreen::handleSourcePathHelpPress()
{
showHelpMessage(
"Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the source "
"and header files of your project or a subset of them."
);
}
void QtProjectSetupScreen::handleIncludePathHelpPress()
{
showHelpMessage(
"Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
"header files of frameworks or libraries that your project uses. These files won't be analysed, but Coati needs "
"them for correct analysis.\n\n"
"Please note that you can define Header Search Paths for all your projects in Coati's preferences."
);
}
void QtProjectSetupScreen::handleFrameworkPathHelpPress()
{
showHelpMessage(
"Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
"Please note that you can define Framework Search Paths for all your projects in Coati's preferences."
);
}
void QtProjectSetupScreen::handlePreferencesButtonPress()
{
emit showPreferences();
}
void QtProjectSetupScreen::handleSelectionChanged(int index)
{
if (index != 0)
{
m_cStandardLabel->show();
m_cStandard->show();
m_cppStandardLabel->hide();
m_cppStandard->hide();
}
else
{
m_cppStandardLabel->show();
m_cppStandard->show();
m_cStandardLabel->hide();
m_cStandard->hide();
}
}
+3 -3
View File
@@ -45,7 +45,7 @@ public:
{
SolutionParserVisualStudio parser;
parser.openSolutionFile("data/vsSolutionParserTestSuite/Coati.sln");
std::vector<std::string> includePaths = parser.getIncludePaths();
std::vector<std::string> includePaths = parser.getIncludePathsNonCanonical();
TS_ASSERT_EQUALS(23, includePaths.size());
}
@@ -54,8 +54,8 @@ public:
{
SolutionParserVisualStudio parser;
parser.openSolutionFile("data/vsSolutionParserTestSuite/Coati.sln");
std::vector<std::string> projectItems = parser.getProjectItems();
std::vector<std::string> projectItems = parser.getProjectItemsNonCanonical();
TS_ASSERT_EQUALS(447, projectItems.size());
TS_ASSERT_EQUALS(450, projectItems.size());
}
};