logic: Reworked CDB project setup
* added separate step for project name, project location and cdb path * added description that project stays up-to-date under cdb path picker. * added include and framework paths to advanced settings * disregard source extensions for cdb projects bug id = 70
This commit is contained in:
+6
-2
@@ -250,15 +250,19 @@ void Project::updateFileManager()
|
||||
std::vector<FilePath> sourcePaths = projSettings->getAbsoluteSourcePaths();
|
||||
std::vector<FilePath> headerPaths = sourcePaths;
|
||||
|
||||
std::vector<std::string> sourceExtensions;
|
||||
|
||||
if (projSettings->getCompilationDatabasePath().exists())
|
||||
{
|
||||
sourcePaths = TaskParseCxx::getSourceFilesFromCDB(projSettings->getCompilationDatabasePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceExtensions = projSettings->getSourceExtensions();
|
||||
}
|
||||
|
||||
std::vector<FilePath> excludePaths = projSettings->getAbsoluteExcludePaths();
|
||||
|
||||
std::vector<std::string> sourceExtensions = projSettings->getSourceExtensions();
|
||||
|
||||
m_fileManager.setPaths(sourcePaths, headerPaths, excludePaths, sourceExtensions);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ void FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
|
||||
for (std::map<FilePath, FileInfo>::iterator it = m_files.begin(); it != m_files.end(); it++)
|
||||
{
|
||||
const FilePath& filePath = it->first;
|
||||
if (filePath.exists() && !hasSourceExtension(filePath))
|
||||
if (filePath.exists() && !hasSourceFilePath(filePath))
|
||||
{
|
||||
FileInfo fileInfo = FileSystem::getFileInfoForPath(filePath);
|
||||
|
||||
@@ -63,6 +63,8 @@ void FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
|
||||
}
|
||||
}
|
||||
|
||||
m_sourceFiles.clear();
|
||||
|
||||
std::vector<FileInfo> fileInfos = FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions);
|
||||
for (FileInfo fileInfo: fileInfos)
|
||||
{
|
||||
@@ -72,6 +74,8 @@ void FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
|
||||
continue;
|
||||
}
|
||||
|
||||
m_sourceFiles.insert(filePath);
|
||||
|
||||
std::map<FilePath, FileInfo>::iterator it = m_files.find(filePath);
|
||||
if (it != m_files.end())
|
||||
{
|
||||
@@ -112,7 +116,7 @@ std::set<FilePath> FileManager::getRemovedFilePaths() const
|
||||
|
||||
bool FileManager::hasFilePath(const FilePath& filePath) const
|
||||
{
|
||||
if (m_files.find(filePath) != m_files.end())
|
||||
if (hasSourceFilePath(filePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -133,9 +137,14 @@ bool FileManager::hasFilePath(const FilePath& filePath) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileManager::hasSourceExtension(const FilePath& filePath) const
|
||||
bool FileManager::hasSourceFilePath(const FilePath& filePath) const
|
||||
{
|
||||
return filePath.hasExtension(m_sourceExtensions);
|
||||
if (m_sourceFiles.find(filePath) != m_sourceFiles.end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const FileInfo FileManager::getFileInfo(const FilePath& filePath) const
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
std::set<FilePath> getRemovedFilePaths() const;
|
||||
|
||||
virtual bool hasFilePath(const FilePath& filePath) const;
|
||||
virtual bool hasSourceExtension(const FilePath& filePath) const;
|
||||
virtual bool hasSourceFilePath(const FilePath& filePath) const;
|
||||
|
||||
virtual const FileInfo getFileInfo(const FilePath& filePath) const;
|
||||
|
||||
@@ -47,6 +47,8 @@ private:
|
||||
std::set<FilePath> m_addedFiles;
|
||||
std::set<FilePath> m_updatedFiles;
|
||||
std::set<FilePath> m_removedFiles;
|
||||
|
||||
std::set<FilePath> m_sourceFiles;
|
||||
};
|
||||
|
||||
#endif // FILE_MANAGER_H
|
||||
|
||||
@@ -19,7 +19,7 @@ void FileRegister::setFilePaths(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
FilePath path = p.exists() ? p.absolute() : p;
|
||||
|
||||
if (m_fileManager->hasSourceExtension(path))
|
||||
if (m_fileManager->hasSourceFilePath(path))
|
||||
{
|
||||
m_sourceFilePaths.emplace(path, STATE_UNPARSED);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
|
||||
it.pop();
|
||||
continue;
|
||||
}
|
||||
if (boost::filesystem::is_regular_file(*it) && hasExtension(it->path().string(), fileExtensions))
|
||||
if (boost::filesystem::is_regular_file(*it) &&
|
||||
(!fileExtensions.size() || hasExtension(it->path().string(), fileExtensions)))
|
||||
{
|
||||
std::time_t t = boost::filesystem::last_write_time(*it);
|
||||
boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t);
|
||||
@@ -89,7 +90,7 @@ std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (path.exists() && path.hasExtension(fileExtensions))
|
||||
else if (path.exists() && (!fileExtensions.size() || path.hasExtension(fileExtensions)))
|
||||
{
|
||||
std::time_t t = boost::filesystem::last_write_time(path.path());
|
||||
boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t);
|
||||
|
||||
@@ -157,8 +157,10 @@ std::vector<std::string> SolutionParserVisualStudio::getCompileFlags()
|
||||
|
||||
std::vector<std::string> validExtensions;
|
||||
validExtensions.push_back(".c");
|
||||
validExtensions.push_back(".cc");
|
||||
validExtensions.push_back(".cpp");
|
||||
validExtensions.push_back(".h");
|
||||
validExtensions.push_back(".hh");
|
||||
validExtensions.push_back(".hpp");
|
||||
|
||||
for (unsigned int i = 0; i < projectFiles.size(); i++)
|
||||
@@ -301,8 +303,10 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
|
||||
|
||||
std::vector<std::string> validFileExtensions;
|
||||
validFileExtensions.push_back(".c");
|
||||
validFileExtensions.push_back(".cc");
|
||||
validFileExtensions.push_back(".cpp");
|
||||
validFileExtensions.push_back(".h");
|
||||
validFileExtensions.push_back(".hh");
|
||||
validFileExtensions.push_back(".hpp");
|
||||
|
||||
for (unsigned int i = 0; i < projectFilesNames.size(); i++)
|
||||
@@ -460,8 +464,10 @@ std::vector<std::string> SolutionParserVisualStudio::findIncludePaths()
|
||||
|
||||
std::vector<std::string> validExtensions;
|
||||
validExtensions.push_back(".c");
|
||||
validExtensions.push_back(".cc");
|
||||
validExtensions.push_back(".cpp");
|
||||
validExtensions.push_back(".h");
|
||||
validExtensions.push_back(".hh");
|
||||
validExtensions.push_back(".hpp");
|
||||
|
||||
for (unsigned int i = 0; i < projectFiles.size(); i++)
|
||||
|
||||
Reference in New Issue
Block a user