[Qbs] Writing a custom script by QBS
Ben Lau
xbenlau at gmail.com
Fri Oct 20 10:41:33 CEST 2017
On 20 October 2017 at 16:07, Christian Kandeler <christian.kandeler at qt.io>
wrote:
> On Fri, 20 Oct 2017 16:01:30 +0800
> Ben Lau <xbenlau at gmail.com> wrote:
>
> > What if it change the condition. Let's it just starts a web server for
> > providing mock data to test network service?
> >
> > For example, just run `http-server $SRCDIR/mockdata`? (Assume the data is
> > hard coded in a few set of json files)
>
> I'm not sure I get what you are saying, but if you mean that your rule
> should have no inputs (which is questionable in your example, since it
> should depend on the json files), then just set the rule's "requiresInputs"
> property to true.
>
>
> Christian
>
yes, I wish to have a rule without input. As the mock data is hard coded,
it is not generated dynamically.
But even an non-sense example is not a problem, I want to know a generic
way in writing a custom script by QBS and what is the restriction.
>From my first email, I have raised few examples
deployment = depends on a product's output , but no output file
starting a mock server = no dependence, just run a command, never stop, no
output file
code analysis = depends on the source files, may/may not have a output file
(eg, the eslint in Javascript)
To simulate the condition of `code analysis`, I made this script and just
run `ls` command (in real case, it should be replaced by another tools)
Product {
id: ls
name: "ls"
type: ["ls"]
builtByDefault: false
Rule {
requiresInputs: false
multiplex: true
Artifact {
filePath: "deploydummy"
fileTags: ["ls"]
}
prepare: {
var cmd = new Command("ls");
cmd.description = "ls "
return [cmd];
}
}
}
That works for the first time, but if I run `qbs -p ls` again. That will
just report:
$ qbs -p ls
Restoring build graph from disk
Building for configuration default
Build done for configuration default.
Any solution for this problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20171020/7d4fa680/attachment.html>
More information about the Qbs
mailing list