Reputation: 9978
I develop locally in a Windows PC and I have my build machine in OSX and or Linux. Since some of the files have over 255 characters I changed my build path like this:
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
Now this won't work in any UNIX system. How can I make it dynamic so it works in Windows, OSX and Linux? I am trying to find a variable but I dont have that much experience in gradle.
Upvotes: 1
Views: 631
Reputation: 16833
You can use the Os
class from ant
Try something like this :
import org.apache.tools.ant.taskdefs.condition.Os
def prefix = Os.isFamily(Os.FAMILY_WINDOWS) ? 'C:/' : '/'
buildDir = prefix + "tmp/${rootProject.name}/${project.name}"
Upvotes: 1
Reputation: 14493
Gradle is built on top of Groovy, which is a JVM language just like Java. Therefore, you can use the same method(s) you can use in Java.
Upvotes: 0