From 94e0ccc24874d2571e074da9e2198bb24b2fad77 Mon Sep 17 00:00:00 2001 From: Denis Klychkov Date: Fri, 25 Nov 2016 23:52:22 +0300 Subject: Add possibility to specify the base name of the generated qrc file Task-number: QBS-1043 Change-Id: I5f537f148792b0e2647d08d6e8004d79ae402f07 Reviewed-by: Leena Miettinen Reviewed-by: Christian Kandeler --- doc/reference/modules/qt-modules.qdoc | 7 +++++++ share/qbs/imports/qbs/ModUtils/utils.js | 7 +++++++ src/lib/qtprofilesetup/templates/core.qbs | 5 ++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/reference/modules/qt-modules.qdoc b/doc/reference/modules/qt-modules.qdoc index 5e40e7107..8effee5b6 100644 --- a/doc/reference/modules/qt-modules.qdoc +++ b/doc/reference/modules/qt-modules.qdoc @@ -346,6 +346,13 @@ \li \c{"/"} \li For files tagged as \c{qt.core.resource_data}, this property determines the prefix under which they will be available in the generated \c qrc file. + \row + \li resourceFileBaseName + \li \c{string} + \li \c{product.targetName} + \li For files tagged as \c{qt.core.resource_data}, this property determines the base name + of the generated \c qrc file. If this property needs to be changed, it must be set + in the corresponding product rather than in a Group. \row \li staticBuild \li \c{bool} diff --git a/share/qbs/imports/qbs/ModUtils/utils.js b/share/qbs/imports/qbs/ModUtils/utils.js index 30302e111..800a58bc0 100644 --- a/share/qbs/imports/qbs/ModUtils/utils.js +++ b/share/qbs/imports/qbs/ModUtils/utils.js @@ -355,6 +355,13 @@ var PropertyValidator = (function () { ? " component" : " components")); }; + PropertyValidator.prototype.addFileNameValidator = function (propertyName, propertyValue) { + this.addCustomValidator(propertyName, propertyValue, function (value) { + return !/[/?<>\\:*|"\u0000-\u001f\u0080-\u009f]/.test(propertyValue) + && propertyValue !== "." && propertyValue !== ".."; + }, "cannot contain reserved or control characters and cannot be \".\" or \"..\""); + }; + PropertyValidator.prototype.addCustomValidator = function (propertyName, propertyValue, validator, message) { this.propertyValidators.push({ propertyName: propertyName, diff --git a/src/lib/qtprofilesetup/templates/core.qbs b/src/lib/qtprofilesetup/templates/core.qbs index 98b3d3b3a..cd17e0eed 100644 --- a/src/lib/qtprofilesetup/templates/core.qbs +++ b/src/lib/qtprofilesetup/templates/core.qbs @@ -199,6 +199,8 @@ Module { }, " is '" + qtBuildVariant + "', but qbs.buildVariant is '" + qbs.buildVariant + "', which is not allowed when using MSVC"); + validator.addFileNameValidator("resourceFileBaseName", resourceFileBaseName); + validator.validate(); } @@ -278,11 +280,12 @@ Module { property path resourceSourceBase: product.sourceDirectory property string resourcePrefix: "/" + property string resourceFileBaseName: product.targetName Rule { multiplex: true inputs: ["qt.core.resource_data"] Artifact { - filePath: "__qbs_auto_" + product.name + ".qrc" + filePath: product.moduleProperty("Qt.core", "resourceFileBaseName") + ".qrc" fileTags: ["qrc"] } prepare: { -- cgit v1.2.3