diff options
author | Radovan Zivkovic <pivonroll@gmail.com> | 2013-06-04 01:58:12 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-03-11 19:54:54 +0100 |
commit | 18037f1760df2f210c514ed1a58d480c986c0101 (patch) | |
tree | ca81259b18afb98e1703f0588a440a7f883b8dc7 | |
parent | 7a4ec98711d693a29e3fa65ff85ee460d54b819c (diff) |
Fixed fatal error handling when parsing build output.
Change-Id: Iab67369e858f673045e4bdfd49f0fc2cf208fa63
Reviewed-by: Bojan Petrovic <bojan85@gmail.com>
-rw-r--r-- | src/plugins/vcprojectmanager/msbuildoutputparser.cpp | 42 | ||||
-rw-r--r-- | src/plugins/vcprojectmanager/vcmakestep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/vcprojectmanager/vcproject.cpp | 2 |
3 files changed, 42 insertions, 6 deletions
diff --git a/src/plugins/vcprojectmanager/msbuildoutputparser.cpp b/src/plugins/vcprojectmanager/msbuildoutputparser.cpp index 5943f924ad..31377b4287 100644 --- a/src/plugins/vcprojectmanager/msbuildoutputparser.cpp +++ b/src/plugins/vcprojectmanager/msbuildoutputparser.cpp @@ -63,11 +63,12 @@ void MsBuildOutputParser::stdOutput(const QString &line) // if line contains both ': warning ' and ': error ' check if warning comes after error if (line.contains(QLatin1String(": warning ")) && line.contains(QLatin1String(": error "))) { - if (line.indexOf(QLatin1String(": error ")) < line.indexOf(QLatin1String(": warning "))) + if (line.indexOf(QLatin1String(": error ")) < line.indexOf(QLatin1String(": warning ")) || + line.indexOf(QLatin1String(": fatal error ")) < line.indexOf(QLatin1String(": warning "))) warningBeforeError = false; } // else, use warningBeforeError as a sign that line doesn't contain no warning - else if (line.contains(QLatin1String(": error "))) + else if (line.contains(QLatin1String(": error ")) || line.contains(QLatin1String(": fatal error "))) warningBeforeError = false; if (!m_buildAttempFinished && warningBeforeError && line.contains(QLatin1String(": warning "))) { @@ -142,6 +143,43 @@ void MsBuildOutputParser::stdOutput(const QString &line) Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); } + if (!m_buildAttempFinished && !warningBeforeError && line.contains(QLatin1String(": fatal error "))) { + QString leftover = line; + leftover = leftover.trimmed(); + QStringList splits = leftover.split(QLatin1String(": fatal error ")); + // get file path + QString filePath = splits.at(0).trimmed(); + leftover = splits.at(1); + + // check if the file path contains line number, example D:\blabla\gggg.cpp(55) + QRegExp errorLineRegExp(QLatin1String(".*\\((\\d+)\\)$")); + if (errorLineRegExp.exactMatch(filePath)) { + filePath.resize(filePath.length() - errorLineRegExp.cap(1).length() - 2); + } + + // get error code + int splitIndex = leftover.indexOf(QLatin1String(": ")); + QString errorCode = leftover.left(splitIndex).trimmed(); + leftover.remove(0, splitIndex); + leftover.remove(0, 2); // error description remains + leftover = leftover.trimmed(); + + QString description(errorCode + + QLatin1String(" ") + + leftover); + // if line where error has originated is present + if (errorLineRegExp.captureCount() == 2 && !errorLineRegExp.cap(1).isEmpty()) { + description.append(QLatin1String(" line: ") + + errorLineRegExp.cap(1)); + } + + emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, + description, + Utils::FileName::fromUserInput(filePath), + errorLineRegExp.cap(1).toInt(), + Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); + } + if (m_doneTargetBuildRegExp.indexIn(line) != -1) emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Unknown, m_doneTargetBuildRegExp.cap(0).trimmed(), diff --git a/src/plugins/vcprojectmanager/vcmakestep.cpp b/src/plugins/vcprojectmanager/vcmakestep.cpp index f074afa5c7..d57bb298be 100644 --- a/src/plugins/vcprojectmanager/vcmakestep.cpp +++ b/src/plugins/vcprojectmanager/vcmakestep.cpp @@ -92,10 +92,6 @@ bool VcMakeStep::init() m_processParams->setEnvironment(bc->environment()); m_processParams->setWorkingDirectory(bc->buildDirectory()); - ProjectExplorer::Project *project = bc->target()->project(); - VcProjectFile* document = static_cast<VcProjectFile *>(project->document()); - m_processParams->setArguments(document->filePath()); - if (!m_buildArguments.isEmpty()) m_processParams->setArguments(m_buildArguments.join(QLatin1String(" "))); diff --git a/src/plugins/vcprojectmanager/vcproject.cpp b/src/plugins/vcprojectmanager/vcproject.cpp index 0ee6bb1980..684c3acdb1 100644 --- a/src/plugins/vcprojectmanager/vcproject.cpp +++ b/src/plugins/vcprojectmanager/vcproject.cpp @@ -358,6 +358,7 @@ void VcProject::addBuildConfiguration(Target *target, QSharedPointer<Configurati ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); VcMakeStep *makeStep = new VcMakeStep(buildSteps); QString argument(QLatin1String("/p:configuration=\"") + config->name() + QLatin1String("\"")); + makeStep->addBuildArgument(m_projectFile->filePath()); makeStep->addBuildArgument(argument); buildSteps->insertStep(0, makeStep); @@ -365,6 +366,7 @@ void VcProject::addBuildConfiguration(Target *target, QSharedPointer<Configurati ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); makeStep = new VcMakeStep(cleanSteps); argument = QLatin1String("/p:configuration=\"") + config->name() + QLatin1String("\" /t:Clean"); + makeStep->addBuildArgument(m_projectFile->filePath()); makeStep->addBuildArgument(argument); cleanSteps->insertStep(0, makeStep); |