diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-07-26 16:57:44 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-07-26 16:57:44 +0200 |
commit | d46b40d27ebc9bcbdb4430893396f066e1f2d758 (patch) | |
tree | 28f269505091363139945284ec77dd2636a12290 /examples | |
parent | 7ead994c8a3e263c4cced6f54f0d959d32268454 (diff) | |
parent | 2269ddc60e47bfea459ef034ab1be112716b4764 (diff) |
Merge 1.14 into master
Change-Id: Ic632b377bf10e2b320956011e9a7d4eea99f560b
Diffstat (limited to 'examples')
-rw-r--r-- | examples/examples.qbs | 3 | ||||
-rw-r--r-- | examples/rule/lorem_ipsum.txt | 4 | ||||
-rw-r--r-- | examples/rule/rule.qbs | 36 |
3 files changed, 42 insertions, 1 deletions
diff --git a/examples/examples.qbs b/examples/examples.qbs index abb6d5d9a..ff6e7a191 100644 --- a/examples/examples.qbs +++ b/examples/examples.qbs @@ -65,6 +65,7 @@ Project { "install-bundle/install-bundle.qbs", "protobuf/cpp/addressbook.qbs", "protobuf/objc/addressbook.qbs", - "baremetal/baremetal.qbs" + "baremetal/baremetal.qbs", + "rule/rule.qbs", ] } diff --git a/examples/rule/lorem_ipsum.txt b/examples/rule/lorem_ipsum.txt new file mode 100644 index 000000000..2901fbcee --- /dev/null +++ b/examples/rule/lorem_ipsum.txt @@ -0,0 +1,4 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer accumsan laoreet magna vitae +elementum. Duis semper ex pellentesque nibh ullamcorper lacinia. Suspendisse sed diam magna. +Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In id +maximus turpis, mattis commodo mauris. Sed bibendum accumsan leo. Nulla placerat. diff --git a/examples/rule/rule.qbs b/examples/rule/rule.qbs new file mode 100644 index 000000000..8ec14ee40 --- /dev/null +++ b/examples/rule/rule.qbs @@ -0,0 +1,36 @@ +import qbs.TextFile + +Product { + type: "txt_output" + + Group { + name: "lorem_ipsum" + files: "lorem_ipsum.txt" + fileTags: "txt_input" + } + + //![1] + Rule { + multiplex: false + inputs: ["txt_input"] + Artifact { + filePath: input.fileName + ".out" + fileTags: ["txt_output"] + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = input.fileName + "->" + output.fileName; + cmd.highlight = "codegen"; + cmd.sourceCode = function() { + var file = new TextFile(input.filePath); + var content = file.readAll(); + file.close() + content = content.toUpperCase(); + file = new TextFile(output.filePath, TextFile.WriteOnly); + file.write(content); + file.close(); + } + return [cmd]; + } + } +} |