logic: fix issue where Maven project did not show any source files (issue #428)

* fixed extraction of generated effective-pom from command line output
This commit is contained in:
malte_langkabel
2017-07-26 14:41:15 +02:00
parent 3a192c8089
commit 3f19a0393a
2 changed files with 48 additions and 14 deletions
+11 -3
View File
@@ -2,6 +2,8 @@
#include "tinyxml/tinyxml.h"
#include "utility/logging/logging.h"
namespace utility
{
@@ -54,13 +56,19 @@ namespace utility
}
else
{
// LOG_ERROR("Unable to load file.");
if (doc.Error())
{
LOG_ERROR(std::string("Error while parsing XML: ") + doc.ErrorDesc() + " (in line " + std::to_string(doc.ErrorRow()) + ": \"" + textAccess->getLine(doc.ErrorRow()) + "\")");
}
else
{
LOG_ERROR("Unable to load file.");
}
}
return values;
}
std::vector<std::string> getValuesOfAllXmlTagsByName(std::shared_ptr<TextAccess> textAccess, const std::string& tag)
{
std::vector<std::string> values;
+37 -11
View File
@@ -16,16 +16,18 @@ namespace
{
void fetchDirectories(std::vector<FilePath>& pathList, std::shared_ptr<TextAccess> xmlAccess, const std::vector<std::string>& tags, const FilePath& toAppend = FilePath())
{
std::string tagString = "";
for (size_t i = 0; i < tags.size(); i++)
{
if (i != 0)
std::string tagString = "";
for (size_t i = 0; i < tags.size(); i++)
{
tagString += " -> ";
if (i != 0)
{
tagString += " -> ";
}
tagString += tags[i];
}
tagString += tags[i];
LOG_INFO("Fetching source directories in \"" + tagString + "\".");
}
LOG_INFO("Fetching source directories in \"" + tagString + "\".");
std::vector<std::string> fetchedDirectories = utility::getValuesOfAllXmlElementsOnPath(
xmlAccess, tags
@@ -104,15 +106,39 @@ namespace utility
return std::vector<FilePath>();
}
std::string xmlContent = "";
for (std::string line: outputAccess->getAllLines())
size_t startLine = 0;
for (size_t i = 1; i <= outputAccess->getLineCount(); i++)
{
const std::string trimmedLine = utility::trim(line);
if (!trimmedLine.empty() && trimmedLine.front() == '<')
if (utility::isPrefix("<?xml", utility::trim(outputAccess->getLine(i))))
{
xmlContent.append(line);
startLine = i;
break;
}
}
size_t endLine = outputAccess->getLineCount();
for (size_t i = outputAccess->getLineCount(); i > 0 ; i--)
{
if (utility::isPrefix("<", utility::trim(outputAccess->getLine(i))))
{
endLine = i;
break;
}
}
for (size_t i = endLine + 1; i <= outputAccess->getLineCount(); i++)
{
if (utility::isPrefix("[", utility::trim(outputAccess->getLine(i))))
{
break;
}
endLine = i;
}
std::string xmlContent = "";
for (const std::string& line: outputAccess->getLines(startLine, endLine))
{
xmlContent.append(line);
}
std::shared_ptr<TextAccess> xmlAccess = TextAccess::createFromString(xmlContent);
std::vector<FilePath> uncheckedDirectories;