I am using this question Execute shell script in Gradle as a reference, however, I cannot figure out how to get it work.
This is my gradle file:
...
task myPrebuildTask(type: Exec) {
println "Hello world from gradle"
commandLine 'sh', './myScript.sh'
}
build.dependsOn myPrebuildTask
I have this in myScript.sh
#!/bin/sh
echo "Hello world from the script file"
However, whenever I run the script gradle assembleDebug
, I can only see "Hello world from gradle" but not "Hello world from the script file".
Yuchens-iMac:MyApplication yuchen$ gradle assembleDebug
Hello world from gradle
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
...
Why?