[Qbs] Conditionally adding a file tag
Alberto Mardegan
mardy at users.sourceforge.net
Tue Jul 28 21:30:49 CEST 2020
Hi all!
I have a Product consisting of static files (images, QML and JSON);
you can see the base item here:
https://gitlab.com/mardy/mappero/-/blob/fd935d58a55523bf7d6b281f2728f055704a2b26/qbs/imports/QmlPlugin.qbs
and a trivial QBS file in which it's used:
https://gitlab.com/mardy/mappero/-/blob/fd935d58a55523bf7d6b281f2728f055704a2b26/src/plugins/nominatim/plugin.qbs
It all works fine, the static files are installed in the filesystem in
the proper location.
Now, however, I'm building the Android version and I would like to embed
the same file as a resource, but only when building for Android. So,
I've changed the base item like this:
=======
Product {
type: embedAsResource ? "staticlibrary" : "qmlplugin"
property bool embedAsResource: true // logic is TODO
Depends { name: "Qt.core" }
...
FileTagger {
patterns: [ "*.png", "*.gif", "*.svg" ]
fileTags: "image"
}
FileTagger {
patterns: "*.qml"
fileTags: ["qml"]
}
Group {
fileTagsFilter: [ "qml", "image" ]
fileTags: embedAsResource ? ["qt.core.resource_data"] : []
qbs.install: !embedAsResource
qbs.installDir: "share/" + project.relativePluginDir
qbs.installSourceBase: "../"
}
=======
That is, if the embedAsResource property is true (and it always is,
currently), the product should be a static library, and the
"qt.core.resource_data" tag should be added to the static files.
But the above does not work. It appears that the new tag is not being
added. It all works if I add it directly into the FileTagger items, but
I would rather avoid doing that, since I have several of them and adding
a conditional would make the QBS file harder to read.
So, in short, the question is this: why isn't it possible to use the
Group's fileTags property to add a tag in this case? Or am I doing
something else wrong here?
Ciao,
Alberto
--
http://www.mardy.it - Geek in un lingua international
More information about the Qbs
mailing list