64 lines
2.1 KiB
C++
64 lines
2.1 KiB
C++
#include "SourceGroupJava.h"
|
|
|
|
#include "IndexerCommandJava.h"
|
|
#include "FileManager.h"
|
|
#include "logging.h"
|
|
#include "SourceGroupSettings.h"
|
|
#include "SourceGroupSettingsWithExcludeFilters.h"
|
|
#include "SourceGroupSettingsWithJavaStandard.h"
|
|
#include "SourceGroupSettingsWithSourceExtensions.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(),
|
|
dynamic_cast<const SourceGroupSettingsWithExcludeFilters*>(getSourceGroupSettings().get())->getExcludeFiltersExpandedAndAbsolute(),
|
|
dynamic_cast<const SourceGroupSettingsWithSourceExtensions*>(getSourceGroupSettings().get())->getSourceExtensions()
|
|
);
|
|
return fileManager.getAllSourceFilePaths();
|
|
}
|
|
|
|
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
|
{
|
|
const std::wstring languageStandard =
|
|
dynamic_cast<const SourceGroupSettingsWithJavaStandard*>(getSourceGroupSettings().get())->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::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;
|
|
}
|