Skip to content

Instantly share code, notes, and snippets.

@dp-singh
Last active May 10, 2016 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dp-singh/4bcce518edf8ef576656 to your computer and use it in GitHub Desktop.
Save dp-singh/4bcce518edf8ef576656 to your computer and use it in GitHub Desktop.
It is used to setup retrolambda in android
String java8 = getJavaVersion(8)
String java7 = getJavaVersion(7)
retrolambda {
jdk java8
oldJdk java7
javaVersion JavaVersion.VERSION_1_7
// jvmArgs '-arg1', '-arg2' < if I don't comment this line gradle fails
defaultMethods false
incremental true
}
String getJavaVersion(Integer v) {
def sout = new StringBuffer()
def proc = "/usr/libexec/java_home -v 1.$v".execute()
proc.consumeProcessOutput(sout, new StringBuffer())
proc.waitForOrKill(1000)
return sout.toString().replace("\n", "").replace("\r", "")
}
@dp-singh
Copy link
Author

evant/gradle-retrolambda#120

Find it from this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment