简体   繁体   English

如何在Gradle中将.cmd文件作为任务运行?

[英]How to run .cmd file as task in Gradle?

I have .cmd file that I want to include everytime build.gradle is run by Android Studio. 我有每次要由Android Studio运行build.gradle时都要包含的.cmd文件。

Let's say the filename is create-artifacts.cmd and so in my module's build.gradle . 假设文件名是create-artifacts.cmd ,因此在模块的build.gradle

android {
    ...

    task createArtifacts(type:Exec) {
        commandLine = ["create-artifacts.cmd"]
        workingDir = file("$rootDir")
    }
}

How may I be helped with this? 我该如何帮助?

See the ExecTask documentation 请参阅ExecTask文档

task createArtifacts(type:Exec) {
    commandLine 'cmd', '/c', 'create-artifacts.cmd'
    workingDir rootDir
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM