Files
Sourcetrail/src/lib_java/project/SourceGroupJava.cpp
T
mlangkabel 9998855527 logic: generate indexer commands on demand to reduce shared memory consumption
* implemented task for sending IndexerCommands to shared memory on demand
* SourceGroups now return IndexerCommandProviders instead of just a list of indexer commands. This way information can be stored in a compressed format
* merged IndexerCommandCxxEmpty and IndexerCommandCxxCdb
* moved sorting of indexer commands by file size from IndexerCommandList to TaskFillIndexerCommandQueue
* removed obsolete IndexerCommandList class
* wait for IndexerCommandQueue to be filled before starting the indexers
* restart finished indexer processes while indexerCommandQueue is still running
* restart indexer threads as long as there are indexer commands to process
* removed Blackboard::getMutex() and added an atomic update() method
2018-09-10 12:40:30 +02:00

70 lines
2.0 KiB
C++

#include "project/SourceGroupJava.h"
#include "data/indexer/IndexerCommandJava.h"
#include "settings/SourceGroupSettingsJava.h"
#include "utility/file/FileManager.h"
#include "utility/logging/logging.h"
std::set<FilePath> SourceGroupJava::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
{
std::set<FilePath> containedFilePaths;
const std::set<FilePath> allSourceFilePaths = getAllSourceFilePaths();
for (const FilePath& filePath : filePaths)
{
if (allSourceFilePaths.find(filePath) != allSourceFilePaths.end())
{
containedFilePaths.insert(filePath);
}
}
return containedFilePaths;
}
std::set<FilePath> SourceGroupJava::getAllSourceFilePaths() const
{
FileManager fileManager;
fileManager.update(
getAllSourcePaths(),
getSourceGroupSettingsJava()->getExcludeFiltersExpandedAndAbsolute(),
getSourceGroupSettingsJava()->getSourceExtensions()
);
return fileManager.getAllSourceFilePaths();
}
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
{
const std::wstring languageStandard = getSourceGroupSettingsJava()->getJavaStandard();
std::vector<FilePath> classPath = getClassPath();
std::vector<std::shared_ptr<IndexerCommand>> indexerCommands;
for (const FilePath& sourcePath: getAllSourceFilePaths())
{
if (filesToIndex.find(sourcePath) != filesToIndex.end())
{
indexerCommands.push_back(std::make_shared<IndexerCommandJava>(
sourcePath, languageStandard, classPath
));
}
}
return indexerCommands;
}
std::shared_ptr<SourceGroupSettings> SourceGroupJava::getSourceGroupSettings()
{
return getSourceGroupSettingsJava();
}
std::shared_ptr<const SourceGroupSettings> SourceGroupJava::getSourceGroupSettings() const
{
return getSourceGroupSettingsJava();
}
std::vector<FilePath> SourceGroupJava::getClassPath() const
{
LOG_INFO("Retrieving classpath for indexer commands");
std::vector<FilePath> classPath = doGetClassPath();
LOG_INFO("Found " + std::to_string(classPath.size()) + " paths for classpath.");
return classPath;
}