blob: 725966c3b6c195e8c9578c58624fc360eaf33d97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
import qbs
import qbs.File
import qbs.TextFile
Product {
type: ["mytype.final"]
Group {
files: ["input.txt"]
fileTags: ["mytype.in"]
}
Rule {
inputs: ["mytype.in"]
Artifact {
filePath: "output.txt"
fileTags: ["mytype.out"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName;
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); };
return [cmd];
}
}
Rule {
inputs: ["mytype.out"]
outputFileTags: ["mytype.final"]
outputArtifacts: {
var file;
var inFile = new TextFile(input.filePath, TextFile.ReadOnly);
try {
file = inFile.readLine();
if (!file)
throw "no file name found";
} finally {
inFile.close();
}
return [{ filePath: file, fileTags: ["mytype.final"] }];
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName;
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); };
return [cmd];
}
}
}
|