I have a build.gradle file that runs a series of tasks before building my android APK. I looked through the documentation but I didn't find an answer so I'll ask here. Is it possible - and if it is how - to run the touch command on a file using gradle?
It has been some time since this question was answered. I think there is a more elegant way available in Gradle as of today.
Remembering that Gradle treats Ant as a first class citizen, you can invoke any ant task as a simple method call using Groovy syntax.
Ant has a touch task and in Gradle you can invoke it easily as shown below. For reference on the parameters supported by the Ant Touch task look here: https://ant.apache.org/manual/Tasks/touch.html
task testStuff(){
ant.touch(file:"some.properties")
}
You just need to create a task of type Exec
and pass appropriate configuration. See the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With