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
[TIMOB-25429] Add JDK 9 detection #127
Conversation
@@ -61,7 +61,7 @@ exports.detect = function detect(config, opts, finished) { | |||
}; | |||
|
|||
function isJDK(dir) { | |||
if (fs.existsSync(path.join(dir, 'bin', 'javac' + exe)) && fs.existsSync(path.join(dir, 'lib', 'dt.jar'))) { | |||
if (fs.existsSync(path.join(dir, 'bin', 'javac' + exe))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dt.jar
doesn't seem to exist in JDK 9, jdklib uses 'java', 'javac', 'keytool', 'jarsigner'
executables in place of this check see here, I think it might be sensible to move to that here too
lib/android.js
Outdated
result.java.version = m[1]; | ||
result.java.build = m[2]; | ||
if (err) { | ||
next(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be return next()
to prevent the next line of code running or second invocation of next()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A code review from @muhammaddadu... What year is it? 😄
lib/android.js
Outdated
} | ||
var re = /^javac (.+?)(?:_(.+))?$/ | ||
var m = stderr.trim().match(re) || stdout.trim().match(re);; | ||
if (m) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do this to make the code flatter?
if (!m) {
return next();
}
Well, I'm going to merge this here. I think we need to ask Eric what version of the SDK we can include this. Personally I think it'd make sense to do 7.20 and 7.1.1. |
https://jira.appcelerator.org/browse/TIMOB-25429
Tested across OSX, Windows and Ubuntu.
Attempted to add tests but due to the way that the jdk functionality spawns executables it doesn't seem easy to set up mocking similar to how we test in jdklib, although I might be able to mock out some of the subprocess functions to return the mocks, @cb1kenobi any guidance you might have is appreciated.