aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2016-05-10 09:11:46 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2016-05-11 14:30:39 +0000
commit860522715cb851f56cd8b2133bf6035d0558dede (patch)
tree8ab50bb503dd64058680dfd9914b4d4595f7bcec /doc
parent86572158878c00450e054886a95ecd1d435d957e (diff)
Deprecate the Transformer item.
When dynamic rules were introduced, transformers became second-class citizens. They do not play well with rules, they introduce annoying additional code paths in the implementation and they are plain broken in several aspects. Now that rules with no inputs are supported, we don't need transformers anymore. Task-number: QBS-885 Change-Id: I316d8cffc91bb529f82350edc0b08358a80ae3fd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'doc')
-rw-r--r--doc/reference/commands.qdoc7
-rw-r--r--doc/reference/items/artifact.qdoc5
-rw-r--r--doc/reference/items/rule.qdoc37
-rw-r--r--doc/reference/items/subproject.qdoc2
-rw-r--r--doc/reference/items/transformer.qdoc115
-rw-r--r--doc/reference/items/xpcservice.qdoc2
6 files changed, 42 insertions, 126 deletions
diff --git a/doc/reference/commands.qdoc b/doc/reference/commands.qdoc
index 39ea99eb9..1a364658d 100644
--- a/doc/reference/commands.qdoc
+++ b/doc/reference/commands.qdoc
@@ -35,12 +35,11 @@
\page commands.html
\title Command and JavaScriptCommand
- \brief Types of commands to be used in rules and transformers
+ \brief Types of commands to be used in rules
A \e command is what \QBS executes at build time. It is represented in the language by an object
of type \c Command, which runs a process, or \c JavaScriptCommand, which executes arbitrary
- JavaScript code. A command is always created in the prepare script of a \c Rule or
- \c Transformer.
+ JavaScript code. A command is always created in the prepare script of a \c Rule.
\section1 Command
@@ -69,7 +68,7 @@
\c outputs are available. As the example shows, arbitrary properties can be set on the command
object and then used within the source code. This technique is typically used to forward values
from the prepare script to the command.
- The \l{Transformer Item} documentation shows a \c JavaScriptCommand in context.
+ The \l{Rule Item} documentation shows a \c JavaScriptCommand in context.
\section1 Properties
diff --git a/doc/reference/items/artifact.qdoc b/doc/reference/items/artifact.qdoc
index e9a6330a7..e0639088d 100644
--- a/doc/reference/items/artifact.qdoc
+++ b/doc/reference/items/artifact.qdoc
@@ -35,10 +35,9 @@
\ingroup list-of-items
\title Artifact Item
- \brief Describes a file produced by a \c Rule or \c Transformer.
+ \brief Describes a file produced by a \c Rule.
- An \c Artifact represents a single file produced by a \l{Rule Item}{Rule} or
- \l{Transformer Item}{Transformer}.
+ An \c Artifact represents a single file produced by a \l{Rule Item}{Rule}.
For example, if a rule produces three files, it needs to contain three Artifact items.
diff --git a/doc/reference/items/rule.qdoc b/doc/reference/items/rule.qdoc
index e74b6fd3d..3c599104e 100644
--- a/doc/reference/items/rule.qdoc
+++ b/doc/reference/items/rule.qdoc
@@ -42,6 +42,39 @@
one or more artifacts (e.g. C++ linker).
A \e {simplex rule} creates one transformer per matching input file
(e.g. C++ compiler).
+ For instance, the following rule transforms text files:
+ \code
+ Rule {
+ inputs: ["txt_input"]
+ Artifact {
+ filePath: "output.txt"
+ fileTags: "txt_output"
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.description = "Processing '" + input.filePath + "'";
+ cmd.highlight = "codegen";
+ cmd.sourceCode = function() {
+ var file = new TextFile(input.filePath);
+ var content = file.readAll();
+ file.close()
+ content = content.replace(/\r\n/g, "\n");
+ file = new TextFile(output.filePath, TextFile.WriteOnly);
+ file.write(content);
+ file.close();
+ }
+ return cmd;
+ }
+ }
+ \endcode
+ This example exhibits some interesting features of rules:
+ \list
+ \li If there is only one input file, the property \c input is available as syntactic sugar
+ for \c inputs[0].
+ \li The filenames of the output artifacts are available as \c outputs. If there is only one
+ of these, it can be referred to it as \c output.
+ \endlist
+
As a real-world example of a simplex rule, here is a simplified version
of \QBS' rule for transforming C++ sources into object files using gcc:
\code
@@ -114,8 +147,8 @@
\li auxiliaryInputs
\li string list
\li undefined
- \li A list of file tags. This rule will be dependent on every other rule and
- transformer that produces artifacts that are compatible with \a{auxiliaryInputs}.
+ \li A list of file tags. This rule will be dependent on every other rule
+ that produces artifacts that are compatible with \a{auxiliaryInputs}.
Unlike \a{inputs}, the property \a{auxiliaryInputs} has no effect on the content of the
\a{inputs} variable in the \a{prepare} script.
\row
diff --git a/doc/reference/items/subproject.qdoc b/doc/reference/items/subproject.qdoc
index 21cbeaa39..f3b227164 100644
--- a/doc/reference/items/subproject.qdoc
+++ b/doc/reference/items/subproject.qdoc
@@ -31,7 +31,7 @@
\contentspage list-of-items.html
\previouspage staticlibrary-item.html
\page subproject-item.html
- \nextpage transformer-item.html
+ \nextpage xpcservice-item.html
\ingroup list-of-items
\title SubProject Item
diff --git a/doc/reference/items/transformer.qdoc b/doc/reference/items/transformer.qdoc
deleted file mode 100644
index 68e34a0b1..000000000
--- a/doc/reference/items/transformer.qdoc
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing
-**
-** This file is part of the Qt Build Suite.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms and
-** conditions see http://www.qt.io/terms-conditions. For further information
-** use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-/*!
- \contentspage list-of-items.html
- \page transformer-item.html
- \previouspage subproject-item.html
- \nextpage xpcservice-item.html
- \ingroup list-of-items
-
- \title Transformer Item
- \brief Creates files, typically from other files.
-
- A \e transformer takes zero or more inputs and produces one or more output artifacts
- from them. The following transformer creates one output file from one input file:
- \code
- Transformer {
- inputs: "raw_input.txt"
- Artifact {
- filePath: "processed_input.txt"
- fileTags: "processed_file"
- }
- prepare: {
- var cmd = new JavaScriptCommand();
- cmd.description = "Processing '" + input.filePath + "'";
- cmd.highlight = "codegen";
- cmd.sourceCode = function() {
- var file = new TextFile(input.filePath);
- var content = file.readAll();
- file.close()
- content = content.replace(/\r\n/g, "\n");
- file = new TextFile(output.filePath, TextFile.WriteOnly);
- file.truncate();
- file.write(content);
- file.close();
- }
- return cmd;
- }
- }
- \endcode
- This example exhibits some interesting features of transformers:
- \list
- \li If there is only one input file, the property \c input is available as syntactic sugar
- for \c inputs[0].
- \li The filenames of the output artifacts are available as \c outputs. If there is only one
- of these, it can be referred to it as \c output.
- \endlist
-
- A \c Transformer is always attached to a \c Product, possibly indirectly via a \c Module.
-
- \section1 Transformer Properties
-
- \table
- \header
- \li Property
- \li Type
- \li Default
- \li Description
- \row
- \li inputs
- \li stringList
- \li empty list
- \li The list of inputs to the transformer.
- \row
- \li prepare
- \li list of Javascript commands
- \li empty list
- \li The commands that the transformer runs. These typically read from the input files and
- write to the output files in some way.
- \row
- \li condition
- \li bool
- \li true
- \li If true, the transformer is enabled, otherwise it does nothing.
- \row
- \li explicitlyDependsOn
- \li stringList
- \li \c{undefined}
- \li A list of file tags. All output artifacts of this transformer will have a dependency
- to all artifacts with the given file tags.
- \row
- \li alwaysRun
- \li bool
- \li false
- \li If true, the transformer's commands are always executed, even if all output artifacts
- are up to date.
- \endtable
-
-*/
diff --git a/doc/reference/items/xpcservice.qdoc b/doc/reference/items/xpcservice.qdoc
index 14be01329..6cb4e1c25 100644
--- a/doc/reference/items/xpcservice.qdoc
+++ b/doc/reference/items/xpcservice.qdoc
@@ -31,7 +31,7 @@
/*!
\contentspage list-of-items.html
\page xpcservice-item.html
- \previouspage transformer-item.html
+ \previouspage subproject-item.html
\ingroup list-of-items
\title XPCService Item