Skip to content
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

Merged
merged 2 commits into from Mar 9, 2018
Merged

Conversation

ewanharris
Copy link
Contributor

@ewanharris ewanharris commented Feb 23, 2018

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.

@@ -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))) {
Copy link
Contributor Author

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();
Copy link
Contributor

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()?

Copy link
Contributor Author

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) {
Copy link
Contributor

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();
}

@sgtcoolguy
Copy link
Contributor

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.

@sgtcoolguy sgtcoolguy merged commit feeaabf into tidev:master Mar 9, 2018
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.

None yet

3 participants