diff options
18 files changed, 153 insertions, 37 deletions
diff --git a/.qmake.conf b/.qmake.conf index f3c8954d0..bdaa3e036 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) DEFINES += QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST -MODULE_VERSION = 5.15.10 +MODULE_VERSION = 5.15.11 diff --git a/src/designer/src/plugins/plugins.pri b/src/designer/src/plugins/plugins.pri index c4613d1a6..b1902657a 100644 --- a/src/designer/src/plugins/plugins.pri +++ b/src/designer/src/plugins/plugins.pri @@ -1,5 +1,4 @@ QT += designer PLUGIN_TYPE = designer -CONFIG += tool_plugin load(qt_plugin) diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp index 175b1816d..af976eef5 100644 --- a/src/linguist/lupdate/cpp.cpp +++ b/src/linguist/lupdate/cpp.cpp @@ -1967,8 +1967,6 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac } else { notrfunc: prefix.clear(); - if (yyTok == Tok_Ident && !yyParenDepth) - prospectiveContext.clear(); } metaExpected = false; break; diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index 5e0c123de..b07b936df 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -208,6 +208,8 @@ OtoolInfo findDependencyInfo(const QString &binaryPath) for (const QString &outputLine : outputLines) { const auto match = regexp.match(outputLine); if (match.hasMatch()) { + if (match.captured(1) == info.installName) + continue; // Another arch reference to the same binary DylibInfo dylib; dylib.binaryPath = match.captured(1); dylib.compatibilityVersion = QVersionNumber::fromString(match.captured(2)); diff --git a/src/qtattributionsscanner/jsongenerator.cpp b/src/qtattributionsscanner/jsongenerator.cpp index 44fb784aa..188f8be7d 100644 --- a/src/qtattributionsscanner/jsongenerator.cpp +++ b/src/qtattributionsscanner/jsongenerator.cpp @@ -55,7 +55,13 @@ static QJsonObject generate(Package package) obj.insert(QStringLiteral("License"), package.license); obj.insert(QStringLiteral("LicenseId"), package.licenseId); - obj.insert(QStringLiteral("LicenseFile"), package.licenseFile); + if (package.licenseFiles.isEmpty()) + obj.insert(QStringLiteral("LicenseFile"), QString()); + else if (package.licenseFiles.size() == 1) + obj.insert(QStringLiteral("LicenseFile"), package.licenseFiles.first()); + else + obj.insert(QStringLiteral("LicenseFiles"), + QJsonArray::fromStringList(package.licenseFiles)); obj.insert(QStringLiteral("Copyright"), package.copyright); obj.insert(QStringLiteral("PackageComment"), package.packageComment); diff --git a/src/qtattributionsscanner/package.h b/src/qtattributionsscanner/package.h index 4a8a9e3e2..34f7a18ee 100644 --- a/src/qtattributionsscanner/package.h +++ b/src/qtattributionsscanner/package.h @@ -50,7 +50,7 @@ struct Package { QString license; // The license under which the package is distributed. Mandatory. QString licenseId; // see https://spdx.org/licenses/. Optional. - QString licenseFile; // path to file containing the license text. Optional. + QStringList licenseFiles; // path to files containing the license text. Optional. QString copyright; // A list of copyright owners. Mandatory. diff --git a/src/qtattributionsscanner/qdocgenerator.cpp b/src/qtattributionsscanner/qdocgenerator.cpp index a418dd199..949067006 100644 --- a/src/qtattributionsscanner/qdocgenerator.cpp +++ b/src/qtattributionsscanner/qdocgenerator.cpp @@ -140,20 +140,20 @@ static void generate(QTextStream &out, const Package &package, const QDir &baseD out << package.license << ".\n\n"; } - if (!package.licenseFile.isEmpty()) { - QFile file(package.licenseFile); + foreach (const QString &licenseFile, package.licenseFiles) { + QFile file(licenseFile); if (!file.open(QIODevice::ReadOnly)) { - if (logLevel != SilentLog) - std::cerr << qPrintable( - tr("Path %1 : cannot open license file %2.") - .arg(QDir::toNativeSeparators(package.path)) - .arg(QDir::toNativeSeparators(package.licenseFile)) - ) << "*/\n"; + if (logLevel != SilentLog) { + std::cerr << qPrintable(tr("Path %1 : cannot open license file %2.\n") + .arg(QDir::toNativeSeparators(package.path)) + .arg(QDir::toNativeSeparators(licenseFile))); + out << "*/\n"; + } return; } out << "\\badcode\n"; out << QString::fromUtf8(file.readAll()).trimmed(); - out << "\n\\endcode\n"; + out << "\n\\endcode\n\n"; } out << "*/\n"; } diff --git a/src/qtattributionsscanner/scanner.cpp b/src/qtattributionsscanner/scanner.cpp index 0b4330cf0..9e6832e6c 100644 --- a/src/qtattributionsscanner/scanner.cpp +++ b/src/qtattributionsscanner/scanner.cpp @@ -81,6 +81,19 @@ static void validatePackage(Package &p, const QString &filePath, LogLevel logLev } } +static QStringList toStringList(const QJsonValue &value) +{ + QStringList result; + for (auto iter : value.toArray()) { + if (iter.type() != QJsonValue::String) { + result.clear(); + return result; + } + result.push_back(iter.toString()); + } + return result; +} + // Transforms a JSON object into a Package object static Package readPackage(const QJsonObject &object, const QString &filePath, LogLevel logLevel) { @@ -91,7 +104,8 @@ static Package readPackage(const QJsonObject &object, const QString &filePath, L for (auto iter = object.constBegin(); iter != object.constEnd(); ++iter) { const QString key = iter.key(); - if (!iter.value().isString() && key != QLatin1String("QtParts")) { + if (!iter.value().isString() && key != QLatin1String("QtParts") + && key != QLatin1String("LicenseFiles")) { if (logLevel != SilentLog) std::cerr << qPrintable(tr("File %1: Expected JSON string as value of %2.").arg( QDir::toNativeSeparators(filePath), key)) << std::endl; @@ -117,7 +131,16 @@ static Package readPackage(const QJsonObject &object, const QString &filePath, L } else if (key == QLatin1String("LicenseId")) { p.licenseId = value; } else if (key == QLatin1String("LicenseFile")) { - p.licenseFile = QDir(directory).absoluteFilePath(value); + p.licenseFiles = QStringList(QDir(directory).absoluteFilePath(value)); + } else if (key == QLatin1String("LicenseFiles")) { + auto strings = toStringList(iter.value()); + if (strings.isEmpty() && (logLevel != SilentLog)) + std::cerr << qPrintable(tr("File %1: Expected JSON array of strings in %2.") + .arg(QDir::toNativeSeparators(filePath), key)) + << std::endl; + const QDir dir(directory); + for (auto iter : strings) + p.licenseFiles.push_back(dir.absoluteFilePath(iter)); } else if (key == QLatin1String("Copyright")) { p.copyright = value; } else if (key == QLatin1String("PackageComment")) { @@ -129,15 +152,12 @@ static Package readPackage(const QJsonObject &object, const QString &filePath, L } else if (key == QLatin1String("QtUsage")) { p.qtUsage = value; } else if (key == QLatin1String("QtParts")) { - const QVariantList variantList = iter.value().toArray().toVariantList(); - for (const QVariant &v: variantList) { - if (v.type() != QVariant::String && logLevel != SilentLog) { - std::cerr << qPrintable(tr("File %1: Expected JSON string in array of %2.").arg( - QDir::toNativeSeparators(filePath), key)) - << std::endl; - } - p.qtParts.append(v.toString()); - } + auto parts = toStringList(iter.value()); + if (parts.isEmpty() && (logLevel != SilentLog)) + std::cerr << qPrintable(tr("File %1: Expected JSON array of strings in %2.") + .arg(QDir::toNativeSeparators(filePath), key)) + << std::endl; + p.qtParts = parts; } else { if (logLevel != SilentLog) std::cerr << qPrintable(tr("File %1: Unknown key %2.").arg( @@ -207,7 +227,7 @@ static Package parseChromiumFile(QFile &file, const QString &filePath, LogLevel QString licenseFile = fields[QStringLiteral("License File")]; if (licenseFile != QString() && licenseFile != QLatin1String("NOT_SHIPPED")) { - p.licenseFile = QDir(directory).absoluteFilePath(licenseFile); + p.licenseFiles = QStringList(QDir(directory).absoluteFilePath(licenseFile)); } else { // Look for a LICENSE or COPYING file as a fallback QDir dir = directory; @@ -217,7 +237,7 @@ static Package parseChromiumFile(QFile &file, const QString &filePath, LogLevel const QFileInfoList entries = dir.entryInfoList(); if (!entries.empty()) - p.licenseFile = entries.at(0).absoluteFilePath(); + p.licenseFiles = QStringList(entries.at(0).absoluteFilePath()); } validatePackage(p, filePath, logLevel); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index d93f1bb1f..03d8d9f5a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -688,3 +688,14 @@ class testing { QT_TR_N_NOOP("%n test"); }; }; + + + +// QTBUG-99415: multiple specifiers after method parameter list +class QTBUG99415 : QObject { + Q_OBJECT + const QString text1() const noexcept { return tr("text1"); } + const QString text2() const noexcept; +}; + +const QString QTBUG99415::text2() const noexcept { return tr("text2"); } diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 7c500f6a3..cdda8897f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -417,6 +417,19 @@ backslashed \ stuff.</source> </message> </context> <context> + <name>QTBUG99415</name> + <message> + <location filename="main.cpp" line="697"/> + <source>text1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.cpp" line="701"/> + <source>text2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>QTranslator</name> <message numerus="yes"> <location filename="finddialog.cpp" line="168"/> diff --git a/tests/auto/qtattributionsscanner/qtattributionsscanner.pro b/tests/auto/qtattributionsscanner/qtattributionsscanner.pro index aa8442a88..9c17783e1 100644 --- a/tests/auto/qtattributionsscanner/qtattributionsscanner.pro +++ b/tests/auto/qtattributionsscanner/qtattributionsscanner.pro @@ -7,6 +7,9 @@ DISTFILES += \ testdata/good/expected.json \ testdata/good/expected.error \ testdata/warnings/incomplete/qt_attribution.json \ + testdata/good/variants/qt_attribution_test.json \ + testdata/good/variants/expected.json \ + testdata/good/variants/expected.error \ testdata/warnings/incomplete/expected.json \ testdata/warnings/incomplete/expected.error \ testdata/warnings/unknown/qt_attribution.json \ diff --git a/tests/auto/qtattributionsscanner/testdata/good/expected.json b/tests/auto/qtattributionsscanner/testdata/good/expected.json index 1f54c13e6..244687192 100644 --- a/tests/auto/qtattributionsscanner/testdata/good/expected.json +++ b/tests/auto/qtattributionsscanner/testdata/good/expected.json @@ -10,7 +10,7 @@ "LicenseFile": "", "LicenseId": "", "Name": "Test", - "PackageComment":"", + "PackageComment": "", "Path": "%{PWD}/chromium", "QDocModule": "qtwebengine", "QtParts": [ @@ -22,39 +22,64 @@ { "Copyright": "Copyright", "Description": "Multi\nLine\nDescription", + "DownloadLocation": "www.qt.io/1.0", + "Files": "", "Homepage": "www.qt.io", "Id": "complete", "License": "License", "LicenseFile": "%{PWD}/complete/LICENSE", "LicenseId": "xxx", "Name": "Complete", - "PackageComment":"just a test package", + "PackageComment": "just a test package", "Path": "%{PWD}/complete", - "Files": "", "QDocModule": "qtest", - "QtParts": [ "examples" ], + "QtParts": [ + "examples" + ], "QtUsage": "Multi\nLine\nUsage", - "Version": "1.0", - "DownloadLocation": "www.qt.io/1.0" + "Version": "1.0" }, { "Copyright": "Copyright", "Description": "", + "DownloadLocation": "", + "Files": "", "Homepage": "", "Id": "minimal", "License": "License", "LicenseFile": "", "LicenseId": "", "Name": "Minimal", - "PackageComment":"", + "PackageComment": "", "Path": "%{PWD}/minimal", + "QDocModule": "qtest", + "QtParts": [ + "libs" + ], + "QtUsage": "Usage", + "Version": "" + }, + { + "Copyright": "", + "Description": "", + "DownloadLocation": "", "Files": "", + "Homepage": "", + "Id": "variants", + "License": "License", + "LicenseFiles": [ + "%{PWD}/variants/LICENSE1.txt", + "%{PWD}/variants/LICENSE2.txt" + ], + "LicenseId": "", + "Name": "Variants Test", + "PackageComment": "", + "Path": "%{PWD}/variants", "QDocModule": "qtest", "QtParts": [ "libs" ], "QtUsage": "Usage", - "Version": "", - "DownloadLocation": "" + "Version": "" } ] diff --git a/tests/auto/qtattributionsscanner/testdata/good/variants/LICENSE1.txt b/tests/auto/qtattributionsscanner/testdata/good/variants/LICENSE1.txt new file mode 100644 index 000000000..716287c92 --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/variants/LICENSE1.txt @@ -0,0 +1 @@ +LICENSE1
\ No newline at end of file diff --git a/tests/auto/qtattributionsscanner/testdata/good/variants/LICENSE2.txt b/tests/auto/qtattributionsscanner/testdata/good/variants/LICENSE2.txt new file mode 100644 index 000000000..3671b8928 --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/variants/LICENSE2.txt @@ -0,0 +1 @@ +LICENSE2
\ No newline at end of file diff --git a/tests/auto/qtattributionsscanner/testdata/good/variants/expected.error b/tests/auto/qtattributionsscanner/testdata/good/variants/expected.error new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/variants/expected.error diff --git a/tests/auto/qtattributionsscanner/testdata/good/variants/expected.json b/tests/auto/qtattributionsscanner/testdata/good/variants/expected.json new file mode 100644 index 000000000..5300c6297 --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/variants/expected.json @@ -0,0 +1,25 @@ +[ + { + "Copyright": "", + "Description": "", + "DownloadLocation": "", + "Files": "", + "Homepage": "", + "Id": "variants", + "License": "License", + "LicenseFiles": [ + "%{PWD}/LICENSE1.txt", + "%{PWD}/LICENSE2.txt" + ], + "LicenseId": "", + "Name": "Variants Test", + "PackageComment": "", + "Path": "%{PWD}", + "QDocModule": "qtest", + "QtParts": [ + "libs" + ], + "QtUsage": "Usage", + "Version": "" + } +] diff --git a/tests/auto/qtattributionsscanner/testdata/good/variants/qt_attribution_test.json b/tests/auto/qtattributionsscanner/testdata/good/variants/qt_attribution_test.json new file mode 100644 index 000000000..072523114 --- /dev/null +++ b/tests/auto/qtattributionsscanner/testdata/good/variants/qt_attribution_test.json @@ -0,0 +1,9 @@ +{ + "Id": "variants", + "Name": "Variants Test", + + "QDocModule": "qtest", + "QtUsage": "Usage", + "License": "License", + "LicenseFiles": [ "LICENSE1.txt", "LICENSE2.txt" ] +} diff --git a/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp b/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp index e1c5e8f3e..31d7c7847 100644 --- a/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp +++ b/tests/auto/qtattributionsscanner/tst_qtattributionsscanner.cpp @@ -84,6 +84,9 @@ void tst_qtattributionsscanner::test_data() << QStringLiteral("good/minimal/qt_attribution_test.json") << QStringLiteral("good/minimal/expected.json") << QStringLiteral("good/minimal/expected.error"); + QTest::newRow("variants") << QStringLiteral("good/variants/qt_attribution_test.json") + << QStringLiteral("good/variants/expected.json") + << QStringLiteral("good/variants/expected.error"); } void tst_qtattributionsscanner::readExpectedFile(const QString &baseDir, const QString &fileName, QByteArray *content) |