forked from qt-creator/qt-creator
Android: Use QRegularExpression instead of QRegExp
Task-number: QTCREATORBUG-24098 Change-Id: Ic19bd73dd2bac39b393bf87c4567193631b57c80 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -64,7 +64,6 @@
|
|||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QVersionNumber>
|
#include <QVersionNumber>
|
||||||
|
|
||||||
|
@@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
#include <proparser/profileevaluator.h>
|
#include <proparser/profileevaluator.h>
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
@@ -168,10 +170,11 @@ void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
|||||||
m_androidAbis = QStringList{evaluator->value("ANDROID_TARGET_ARCH")};
|
m_androidAbis = QStringList{evaluator->value("ANDROID_TARGET_ARCH")};
|
||||||
const QString androidPlatform = evaluator->value("ANDROID_PLATFORM");
|
const QString androidPlatform = evaluator->value("ANDROID_PLATFORM");
|
||||||
if (!androidPlatform.isEmpty()) {
|
if (!androidPlatform.isEmpty()) {
|
||||||
const QRegExp regex("android-(\\d+)");
|
const QRegularExpression regex("android-(\\d+)");
|
||||||
if (regex.exactMatch(androidPlatform)) {
|
const QRegularExpressionMatch match = regex.match(androidPlatform);
|
||||||
|
if (match.hasMatch()) {
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int tmp = regex.cap(1).toInt(&ok);
|
int tmp = match.captured(1).toInt(&ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
m_minNdk = tmp;
|
m_minNdk = tmp;
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QRegExp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@@ -55,14 +55,15 @@ Utils::OutputLineParser::Result JavaParser::handleLine(const QString &line,
|
|||||||
Utils::OutputFormat type)
|
Utils::OutputFormat type)
|
||||||
{
|
{
|
||||||
Q_UNUSED(type);
|
Q_UNUSED(type);
|
||||||
if (m_javaRegExp.indexIn(line) == -1)
|
const QRegularExpressionMatch match = m_javaRegExp.match(line);
|
||||||
|
if (!match.hasMatch())
|
||||||
return Status::NotHandled;
|
return Status::NotHandled;
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
int lineno = m_javaRegExp.cap(3).toInt(&ok);
|
int lineno = match.captured(3).toInt(&ok);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
lineno = -1;
|
lineno = -1;
|
||||||
Utils::FilePath file = Utils::FilePath::fromUserInput(m_javaRegExp.cap(2));
|
Utils::FilePath file = Utils::FilePath::fromUserInput(match.captured(2));
|
||||||
if (file.isChildOf(m_buildDirectory)) {
|
if (file.isChildOf(m_buildDirectory)) {
|
||||||
Utils::FilePath relativePath = file.relativeChildPath(m_buildDirectory);
|
Utils::FilePath relativePath = file.relativeChildPath(m_buildDirectory);
|
||||||
file = m_sourceDirectory.pathAppended(relativePath.toString());
|
file = m_sourceDirectory.pathAppended(relativePath.toString());
|
||||||
@@ -76,11 +77,11 @@ Utils::OutputLineParser::Result JavaParser::handleLine(const QString &line,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompileTask task(Task::Error,
|
CompileTask task(Task::Error,
|
||||||
m_javaRegExp.cap(4).trimmed(),
|
match.captured(4).trimmed(),
|
||||||
absoluteFilePath(file),
|
absoluteFilePath(file),
|
||||||
lineno);
|
lineno);
|
||||||
LinkSpecs linkSpecs;
|
LinkSpecs linkSpecs;
|
||||||
addLinkSpecForAbsoluteFilePath(linkSpecs, task.file, task.line, m_javaRegExp, 2);
|
addLinkSpecForAbsoluteFilePath(linkSpecs, task.file, task.line, match, 2);
|
||||||
scheduleTask(task, 1);
|
scheduleTask(task, 1);
|
||||||
return {Status::Done, linkSpecs};
|
return {Status::Done, linkSpecs};
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include <projectexplorer/ioutputparser.h>
|
#include <projectexplorer/ioutputparser.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Result handleLine(const QString &line, Utils::OutputFormat type) override;
|
Result handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
QRegExp m_javaRegExp;
|
QRegularExpression m_javaRegExp;
|
||||||
QStringList m_fileList;
|
QStringList m_fileList;
|
||||||
Utils::FilePath m_sourceDirectory;
|
Utils::FilePath m_sourceDirectory;
|
||||||
Utils::FilePath m_buildDirectory;
|
Utils::FilePath m_buildDirectory;
|
||||||
|
Reference in New Issue
Block a user