Skip to content

Conversation

@bratsche
Copy link
Contributor

@bratsche bratsche commented Jul 25, 2018

Use JdkInfo to get the Java SDK path, and fix Java SDK validation to work with OpenJDK.

Fixes VSTS #652760 and VSTS #646086

bratsche added 3 commits July 25, 2018 17:34
As per the OpenJDK spec, GetJavaSdkPath() now follows these steps
when fetching the SDK path:

1. Gets the prefered SDK path from ~/.config/xbuild/monodroid-config.xml
2. Checks $JAVA_HOME
3. Checks the output of /usr/libexec/java_home
4. ** NOT IMPLEMENTED YET **: Checks /etc/alternatives/java
5. A directory in $PATH that contains jarsigner

Fixes VSTS #652760 and VSTS #646086
@bratsche
Copy link
Contributor Author

ValidateJavaSdkLocation() used to check the output of /usr/libexec/java_home. That won't work with OpenJDK so I'm checking if $path/bin/javac exists. Suggestions welcome.

@jonpryor
Copy link
Contributor

jonpryor commented Jul 26, 2018

@bratsche: PR #32 also implements the OpenJDK spec; with it, GetJavaSdkPath() becomes a one-liner:

protected override string GetJavaSdkPath ()
{
    return JdkInfo.GetKnownSystemJdkInfos (Logger).FirstOrDefault ()?.HomePath;
}

@grendello
Copy link
Contributor

build

@jonpryor
Copy link
Contributor

This PR should be updated to include the one-liner above.

@bratsche bratsche changed the title [Mac] Handle OpenJDK paths and path validation [Mac] Use the new JdkInfo to fetch the Java SDK path Jul 26, 2018
@bratsche bratsche changed the title [Mac] Use the new JdkInfo to fetch the Java SDK path [Mac] Use the new JdkInfo to fetch the Java SDK path and fix validation Jul 26, 2018
@jonpryor jonpryor merged commit 7553056 into master Jul 26, 2018
@bratsche bratsche deleted the openjdk-validate-java-sdk-location branch July 28, 2018 04:25
jonpryor pushed a commit that referenced this pull request Aug 2, 2018
Fixes: http://work.devdiv.io/646086
Fixes: http://work.devdiv.io/652760

Context: https://paper.dropbox.com/doc/OpenJDK-and-You--AH1yWKdVXgno~uXYfmcUAZTwAg-NoECAe2XkBQeoxFfGL6ea

Update `AndroidSdkInfo.JavaSdkPath` so that it now uses
`JdkInfo.GetKnownSystemJdkInfos()` to determine the JDK path to use,
instead of separately reading from `monodroid-config.xml` or probing
`$PATH` for `jarsigner`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants