aboutsummaryrefslogtreecommitdiffstats
path: root/doc/reference
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2017-03-03 14:47:25 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2017-03-07 16:18:01 +0000
commit1f9ce8ca32ba08a6f8ee28d71ab86067993271a3 (patch)
tree8d1b1823984852ff32d8c6375a3576735e6f936f /doc/reference
parent26d80be45024b80f3f8f871432a60eaea6c1d437 (diff)
Add a convenient replacement for moduleProperty()
In rules we can now write product.cpp.defines instead of product.moduleProperty("cpp", "defines") Before requesting a module's property one must check for module existence: if (product.xcode && product.xcode.sdkName === "TheBestSDK") ... The same syntax also works for artifact objects (e.g. from inputs). The old way of requesting module properties via moduleProperty stays intact for the time being. [ChangeLog] Added a convenient replacement for product.moduleProperty("module", "property"), namely product.module.property. Task-number: QBS-889 Change-Id: Ibf78329b8988b2ad632578848f4606dcc82f551c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/items/language/module.qdoc5
-rw-r--r--doc/reference/items/language/rule.qdoc11
2 files changed, 7 insertions, 9 deletions
diff --git a/doc/reference/items/language/module.qdoc b/doc/reference/items/language/module.qdoc
index 69d9d8896..27b3167a6 100644
--- a/doc/reference/items/language/module.qdoc
+++ b/doc/reference/items/language/module.qdoc
@@ -38,7 +38,7 @@
A \c Module item is a collection of properties and language items that are used for building a
product if the product has a \l{Depends Item}{dependency} on the module.
The following (somewhat artificial) module pre-processes text files by removing certain
- characters from them:
+ characters from them. The module's name is \a{txt_processor}.
\code
import qbs
@@ -65,8 +65,7 @@
var inFile = new TextFile(input.filePath, TextFile.ReadOnly);
var content = inFile.readAll();
inFile.close();
- var unwantedChars = product.moduleProperty("txt_processor",
- "unwantedCharacters");
+ var unwantedChars = product.txt_processor.unwantedCharacters;
for (var c in unwantedChars)
content = content.replace(unwantedChars[c], "");
var outFile = new TextFile(output.filePath, TextFile.WriteOnly);
diff --git a/doc/reference/items/language/rule.qdoc b/doc/reference/items/language/rule.qdoc
index e3e7c2987..eff9a95ff 100644
--- a/doc/reference/items/language/rule.qdoc
+++ b/doc/reference/items/language/rule.qdoc
@@ -141,14 +141,13 @@
\row
\li \c fileTags
\li The list of the artifact's file tags.
- \row
- \li \c moduleProperty
- \li A function taking two parameters. The first one is the name of a module,
- the second one is the name of a property in that module. For instance, for an
- artifact in a C++ product, a call to \c{moduleProperty("cpp", "defines")} returns the
- list of defines that will be passed when compiling the respective file.
\endtable
+ The artifact object contains a property for every module that is used in the product. That can
+ be used to access the module's properties. For instance, for an artifact in a C++ product,
+ \c{artifact.cpp.defines} is the list of defines that will be passed when compiling the
+ respective file.
+
But what about the variables \c input and \c output that appeared in our example? These
are simply convenience variables which are available in the case that the \c inputs
and \c outputs variables contain only one artifact, respectively. So in our example, instead