Execute shell script in Gradle

前端 未结 6 429
北荒
北荒 2020-12-07 17:20

I have a gradle build setup at the beginning of which I want to execute a shellscript in a subdirectory that prepares my environment.

task build << {
         


        
6条回答
  •  旧巷少年郎
    2020-12-07 18:15

    This works for me in my Android project

    preBuild.doFirst {
        println("Executing myScript")
        def proc = "mySubDir/myScript.sh".execute()
        proc.waitForProcessOutput(System.out, System.err)
    }
    

    See here for explanation: How to make System command calls in Java/Groovy?

提交回复
热议问题