aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Klychkov <kd.snake@gmail.com>2016-11-29 13:06:30 +0300
committerChristian Kandeler <christian.kandeler@qt.io>2016-12-02 09:38:12 +0000
commitfddd6ffc3b43e9fc5a50ab7d46c94422071ad20a (patch)
tree6b35745c81b5be50a1587d3020c9fbbc9a1f538e
parent94e0ccc24874d2571e074da9e2198bb24b2fad77 (diff)
Change the default value and behavior of Qt.core.resourceSourceBase
The default value "undefined" tells the qrc file generator to use only the input file name as a resource alias. The benefits of changing the default value are as follows: 1) It's a bit weird to reset a normal value to undefined in qbs code. 2) This simplifies feature usage for output Artifacts and single files. 3) If one wants to put a hierarchical structure into a qrc file there are a lot of cases in which they have to specify resourceSourceBase manually. 4) When a Group with a wildcard and a prefix is used this makes user's intention a bit clearer. This strongly separates "I want this set of files" from "I want this directory structure". Task-number: QBS-1053 Change-Id: Ib6413643398dca475b4b71ad884202c9e7fb823a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--doc/reference/modules/qt-modules.qdoc5
-rw-r--r--src/lib/qtprofilesetup/templates/core.qbs7
2 files changed, 7 insertions, 5 deletions
diff --git a/doc/reference/modules/qt-modules.qdoc b/doc/reference/modules/qt-modules.qdoc
index 8effee5b6..4b375d90f 100644
--- a/doc/reference/modules/qt-modules.qdoc
+++ b/doc/reference/modules/qt-modules.qdoc
@@ -337,9 +337,10 @@
\row
\li resourceSourceBase
\li \c{path}
- \li \c{product.sourceDirectory}
+ \li \c{undefined}
\li For files tagged as \c{qt.core.resource_data}, this property determines which part of
- their path will end up in the generated \c qrc file.
+ their path will end up in the generated \c qrc file. If this property is set to
+ \c undefined, only the file name is used.
\row
\li resourcePrefix
\li \c{string}
diff --git a/src/lib/qtprofilesetup/templates/core.qbs b/src/lib/qtprofilesetup/templates/core.qbs
index cd17e0eed..a5cfb9f0d 100644
--- a/src/lib/qtprofilesetup/templates/core.qbs
+++ b/src/lib/qtprofilesetup/templates/core.qbs
@@ -278,7 +278,7 @@ Module {
}
}
- property path resourceSourceBase: product.sourceDirectory
+ property path resourceSourceBase
property string resourcePrefix: "/"
property string resourceFileBaseName: product.targetName
Rule {
@@ -312,8 +312,9 @@ Module {
var inp = inputsByPrefix[prefix][i];
var fullResPath = inp.filePath;
var baseDir = inp.moduleProperty("Qt.core", "resourceSourceBase");
- var relResPath = FileInfo.relativePath(baseDir, fullResPath);
- qrcFile.writeLine('<file alias = "' + relResPath + '">'
+ var resAlias = baseDir
+ ? FileInfo.relativePath(baseDir, fullResPath) : inp.fileName;
+ qrcFile.writeLine('<file alias="' + resAlias + '">'
+ fullResPath + '</file>');
}
qrcFile.writeLine('</qresource>');