Skip to content

Instantly share code, notes, and snippets.

@tiwiz
Last active June 12, 2018 19:26
Show Gist options
  • Select an option

  • Save tiwiz/a2bd1f5249147e017730 to your computer and use it in GitHub Desktop.

Select an option

Save tiwiz/a2bd1f5249147e017730 to your computer and use it in GitHub Desktop.

Revisions

  1. tiwiz revised this gist Oct 5, 2015. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions build.gradle
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,12 @@
    import org.gradle.internal.os.OperatingSystem;
    String getJavaHome(String version) {
    def stdout = new ByteArrayOutputStream()
    exec {
    commandLine "/usr/libexec/java_home", "-v", version
    standardOutput = stdout;
    }
    return stdout.toString().trim()
    }

    task findOs {
    doLast {
  2. tiwiz created this gist Oct 5, 2015.
    14 changes: 14 additions & 0 deletions build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import org.gradle.internal.os.OperatingSystem;

    task findOs {
    doLast {
    if (OperatingSystem.current().isMacOsX()) {
    println("Adding retrolmbda")
    retrolambda {
    jdk System.getenv("JAVA8_HOME") ?: getJavaHome("1.8")
    oldJdk System.getenv("JAVA7_HOME") ?: getJavaHome("1.7")
    }
    }
    }
    }
    preBuild.dependsOn findOs