aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/fileTagger/moc_cpp.qbs
blob: ce7970f209bb298cec9c72f4ae37070e05953dea (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
import qbs 1.0
import qbs.TextFile
import qbs.FileInfo

Project {
    Product {
        type: "application"
        name: "moc_cpp"

        Depends {
            name: "Qt.core"
        }

        Group {
            files: 'bla.txt'
            fileTags: ['text']
        }
    }

    Rule {
        inputs: ['text']
        Artifact {
            fileTags: ['cpp']
            filePath: input.baseName + '.cpp'
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.sourceCode = function () {
                var file = new TextFile(input.filePath, TextFile.ReadOnly);
                var text = file.readAll();
                file.close();
                file = new TextFile(output.filePath, TextFile.WriteOnly);
                file.truncate();
                file.write(text);
                file.close();
            }
            cmd.description = 'generating ' + FileInfo.fileName(output.filePath);
            cmd.highlight = 'codegen';
            return cmd;
        }
    }
}