New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically grab Java home from the JRE location in System.properties ... #26

Closed
wants to merge 1 commit into
base: master
from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+8 −1
Diff settings

Always

Just for now

@@ -19,6 +19,8 @@ package me.tatarka
import org.gradle.api.JavaVersion
import org.gradle.api.ProjectConfigurationException

import java.util.regex.Pattern

import static me.tatarka.RetrolambdaPlugin.javaVersionToBytecode

/**
@@ -32,6 +34,7 @@ public class RetrolambdaExtension {
int bytecodeVersion = 50
List<String> excludes = []
List<String> includes = []
String javaHomeProp = System.properties.'java.home'.toString().split(Pattern.quote(System.properties.'file.separator'.toString() + "jre"))[0]

This comment has been minimized.

@evant

evant Jul 14, 2014

Owner

Don't have to move into a function, but you should make it private since we don't want to expose this to plugin users.

boolean isOnJava8 = System.properties.'java.version'.startsWith('1.8')

private String jdk = null
@@ -112,7 +115,11 @@ public class RetrolambdaExtension {

private String findJdk() {
if (isOnJava8) {
return System.getenv("JAVA_HOME")
if (javaHomeProp) {
return javaHomeProp
} else {
return System.getenv("JAVA_HOME")
}
} else {
return System.getenv("JAVA8_HOME")
}
ProTip! Use n and p to navigate between commits in a pull request.