[英]Execute shell script in android gradle
I want to run a shell script to change the value in string.xml when my app is built. 我想运行一个Shell脚本来在构建我的应用程序时更改string.xml中的值。 Where should I run my script in gradle, since there is no task in it. 我应该在哪里在gradle中运行脚本,因为其中没有任务。 Or, because I will build the app use Jenkins, should I run the script on Jenkins server? 或者,因为我将使用Jenkins构建应用程序,所以我应该在Jenkins服务器上运行脚本吗? Please help me out. 请帮帮我。
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
}
defaultConfig {
.......
}
buildTypes {
release {
.......
}
}
productFlavors {
development {}
production {}
}
sourceSets {
androidTest {
setRoot('src/test')
}
}
packagingOptions {..}
dependencies {...}
You can add a preBuild
step that runs the script and makes it depend on build. 您可以添加一个preBuild
步骤来运行脚本并使它依赖于构建。
task myPreBuild << {
commandLine './script.sh'
}
build.dependsOn myPreBuild
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.