我习惯使用 Makefiles,但我当前的项目使用.qbs
文件。如何在不创建或不需要文件的情况下通过 qbs 运行简单的终端命令?类似于 make 中的虚假规则。
以下工作并在我的终端中显示“很棒”。
import qbs 1.0
Project {
name: "cli"
Product {
name: "helloworld"
type: "application"
files: "TEST.c"
Depends { name: "cpp" }
}
Product {
type: ["custom-image"]
Depends { name: "helloworld" }
Rule {
inputsFromDependencies: ["application"]
Artifact {
fileTags: ["custom-image"]
}
prepare: {
var cmd = new Command("echo", "awesome")
return cmd
}
}
}
}
但是,我必须TEST.c
在每次运行之前触摸我的虚拟文件。如果没有helloworld
依赖关系,则规则不会运行。
有任何想法吗?非常感谢!