[QBS] Multiply Artifacts in the rule
Pavel Fischer
rubbiroid at gmail.com
Mon Oct 28 10:04:55 CET 2013
Hello list,
in my project i want to generate a QMetaEnum-like class for the
non-class enum. To do this i create a new module, with a rule, that
transforms my enum spec File to the h and cpp file. I have trouble with
the "prepare"-Function in the rule.
Module {
Depends { name: "cpp" }
FileTagger {
pattern: "*.enum"
fileTags: ["enum"]
}
Rule {
inputs: ["enum"]
Artifact {
fileName: input.fileName.replace(/enum$/,'h')
fileTags: ["hpp"]
}
Artifact {
fileName: input.fileName.replace(/enum$/,'cpp')
fileTags: ["cpp"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Generate enum class " +
FileInfo.fileName(input.fileName);
cmd.highlight = "codegen";
cmd.sourceCode = function() {
print("Input: " + input.fileName);
for (var out in outputs) {
print("Output: " + out.fileName);
}
}
return cmd;
}
}
}
The fileName is "undefined", but the execution log in trace-mode show
that artifacts became right names. For the case with one Artifact
everything works fine. Do I make something wrong?
Thank you for your help.
Pavel Fischer.
More information about the Qbs
mailing list