diff options
author | Kai Koehne <kai.koehne@qt.io> | 2019-03-18 14:03:49 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2019-03-25 13:59:42 +0000 |
commit | e9662ddd86f027bdbe617f5171cd63cae13b3845 (patch) | |
tree | 8ba70fd2476cfb19b0dd0b4f9aaf69ebedc58ec9 /src | |
parent | 9c7502b0e5056da021ace0195e53d5b7b410120b (diff) | |
download | qttools-e9662ddd86f027bdbe617f5171cd63cae13b3845.tar.gz |
qtattributionsscanner: Add "PackageComment" field
Add a new field that can be used for general purpose comments
about the package, not to be included in the generated qdoc
documentation.
JSON does not support comments as a first-class concept. A common
workaround is to use duplicated key entries, so that the first
one can be used as a comment field. Anyhow, this is arguably a
hack and not common knowledge.
The name is inspired by the "PackageComment" field in SPDX. The
new feature should already be made part of 5.12 so we can clean
up version information that recently became more prominently
visible as part of the qdoc title -
see https://doc.qt.io/qt-5/licenses-used-in-qt.html
Change-Id: Icfe843d1d725618114442687222c24122d0dd6b9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qtattributionsscanner/jsongenerator.cpp | 1 | ||||
-rw-r--r-- | src/qtattributionsscanner/package.h | 2 | ||||
-rw-r--r-- | src/qtattributionsscanner/scanner.cpp | 2 |
3 files changed, 5 insertions, 0 deletions
diff --git a/src/qtattributionsscanner/jsongenerator.cpp b/src/qtattributionsscanner/jsongenerator.cpp index 37d0426af..44fb784aa 100644 --- a/src/qtattributionsscanner/jsongenerator.cpp +++ b/src/qtattributionsscanner/jsongenerator.cpp @@ -58,6 +58,7 @@ static QJsonObject generate(Package package) obj.insert(QStringLiteral("LicenseFile"), package.licenseFile); obj.insert(QStringLiteral("Copyright"), package.copyright); + obj.insert(QStringLiteral("PackageComment"), package.packageComment); return obj; } diff --git a/src/qtattributionsscanner/package.h b/src/qtattributionsscanner/package.h index a0cb82fdd..4a8a9e3e2 100644 --- a/src/qtattributionsscanner/package.h +++ b/src/qtattributionsscanner/package.h @@ -53,6 +53,8 @@ struct Package { QString licenseFile; // path to file containing the license text. Optional. QString copyright; // A list of copyright owners. Mandatory. + + QString packageComment; // Further comments about the package. Optional. }; #endif // PACKAGE_H diff --git a/src/qtattributionsscanner/scanner.cpp b/src/qtattributionsscanner/scanner.cpp index fe59d9942..0604dc988 100644 --- a/src/qtattributionsscanner/scanner.cpp +++ b/src/qtattributionsscanner/scanner.cpp @@ -83,6 +83,8 @@ static Package readPackage(const QJsonObject &object, const QString &filePath, L p.licenseFile = QDir(directory).absoluteFilePath(value); } else if (key == QLatin1String("Copyright")) { p.copyright = value; + } else if (key == QLatin1String("PackageComment")) { + p.packageComment = value; } else if (key == QLatin1String("QDocModule")) { p.qdocModule = value; } else if (key == QLatin1String("Description")) { |