logic: source groups for project settings

* project can not have multiple source groups with different types
* language of a project is now inferred from source groups
* setting global NameHierarchy delimiter of first sourceGroup in project
* added project settings migrations for source groups
* Add Settings Migration classes (MoveKey, DeleteKey, Lambda)
* Update sample projects with migrations
* added method to config to retrieve sublevel key names
* implemented recursive removing of keys in settings
* moved project files out of top level
* removed solution parsing code as it is not used anymore

fortune cookie message = The secret of getting ahead is getting started.
This commit is contained in:
malte_langkabel
2017-03-31 16:11:37 +02:00
parent 25f3c4666a
commit 7b30ac18de
133 changed files with 2545 additions and 3386 deletions
+13 -100
View File
@@ -1,10 +1,8 @@
#include "utility/file/FileManager.h"
#include <functional>
#include <set>
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/utility.h"
FileManager::FileManager()
@@ -15,51 +13,18 @@ FileManager::~FileManager()
{
}
void FileManager::setPaths(
std::vector<FilePath> sourcePaths,
std::vector<FilePath> headerPaths,
std::vector<FilePath> excludePaths,
std::vector<std::string> sourceExtensions
void FileManager::update(
const std::vector<FilePath>& sourcePaths,
const std::vector<FilePath>& excludePaths,
const std::vector<std::string>& sourceExtensions
){
m_sourcePaths = sourcePaths;
m_headerPaths = makeCanonical(headerPaths);
m_excludePaths = makeCanonical(excludePaths);
m_sourceExtensions = sourceExtensions;
}
FileManager::FileSets FileManager::fetchFilePaths(const std::vector<FileInfo>& oldFileInfos)
{
m_filesInfos.clear();
for (FileInfo oldFileInfo: oldFileInfos)
{
m_filesInfos.emplace(oldFileInfo.path, oldFileInfo);
}
m_allSourceFilePaths.clear();
FileSets fileSets;
// update old files that have been modified
// remove old files that don't exist anymore
for (std::map<FilePath, FileInfo>::iterator it = m_filesInfos.begin(); it != m_filesInfos.end(); it++)
{
const FilePath& filePath = it->first;
if (filePath.exists() && !hasSourceFilePath(filePath))
{
FileInfo newFileInfo = FileSystem::getFileInfoForPath(filePath);
if (newFileInfo.lastWriteTime > it->second.lastWriteTime)
{
it->second.lastWriteTime = newFileInfo.lastWriteTime;
fileSets.updatedFiles.insert(filePath);
}
}
else
{
fileSets.removedFiles.insert(filePath);
}
}
std::vector<FileInfo> fileInfos = FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions);
for (FileInfo fileInfo: fileInfos)
for (FileInfo fileInfo: FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
{
const FilePath& filePath = fileInfo.path;
if (isExcluded(filePath))
@@ -67,33 +32,8 @@ FileManager::FileSets FileManager::fetchFilePaths(const std::vector<FileInfo>& o
continue;
}
fileSets.allSourceFilePaths.insert(filePath);
std::map<FilePath, FileInfo>::iterator it = m_filesInfos.find(filePath);
if (it != m_filesInfos.end())
{
fileSets.removedFiles.erase(filePath);
if (fileInfo.lastWriteTime > it->second.lastWriteTime)
{
it->second.lastWriteTime = fileInfo.lastWriteTime;
fileSets.updatedFiles.insert(filePath);
}
}
else
{
m_filesInfos.insert(std::pair<FilePath, FileInfo>(filePath, fileInfo));
fileSets.addedFiles.insert(filePath);
}
m_allSourceFilePaths.insert(filePath);
}
for (const FilePath& filePath : fileSets.removedFiles)
{
m_filesInfos.erase(filePath);
}
m_sourceFilePaths = fileSets.allSourceFilePaths;
return fileSets;
}
std::vector<FilePath> FileManager::getSourcePaths() const
@@ -101,48 +41,21 @@ std::vector<FilePath> FileManager::getSourcePaths() const
return m_sourcePaths;
}
std::set<FilePath> FileManager::getSourceFilePaths() const
{
std::set<FilePath> sourceFilePaths;
for (const FileInfo& fileInfo: FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
{
const FilePath& path = fileInfo.path;
bool excluded = false;
for (FilePath p: m_excludePaths)
{
if (p == path || p.contains(path))
{
excluded = true;
break;
}
}
if (!excluded)
{
sourceFilePaths.emplace(path);
}
}
return sourceFilePaths;
}
bool FileManager::hasSourceFilePath(const FilePath& filePath) const
{
if (m_sourceFilePaths.find(filePath) != m_sourceFilePaths.end())
if (m_allSourceFilePaths.find(filePath) != m_allSourceFilePaths.end())
{
for (FilePath p: m_excludePaths)
{
if (p == filePath || p.contains(filePath))
{
return false;
}
}
return true;
}
return false;
}
std::set<FilePath> FileManager::getAllSourceFilePaths() const
{
return m_allSourceFilePaths;
}
std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& filePaths)
{
std::vector<FilePath> ret;