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

Default to the newer version path when checking Android Studio Java path #101862

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

chingjun
Copy link
Contributor

Preview versions of Android Studio has a non-standard version number
like EAP AI-203.7717.56.2031.7557721, which fails the current version
parsing. And it defaults to the older path to look for the Java binary.

This commit switches to use the new path by default if the version
string can't be parsed.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

…ath.

Preview versions of Android Studio has a non-standard version number
like `EAP AI-203.7717.56.2031.7557721`, which fails the current version
parsing. And it defaults to the older path to look for the Java binary.

This commit switches to use the new path by default if the version
string can't be parsed.
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 13, 2022
@@ -445,9 +445,9 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}

final String javaPath = globals.platform.isMacOS ?
version != null && version.major >= 2020 ?
globals.fs.path.join(directory, 'jre', 'Contents', 'Home') :
version != null && version.major < 2020 ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this change effectively flipping the default when version == null from jre/jdk/Contents/Home to /jre/Contents/Home?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right, that's what the description says, lol.

Copy link
Member

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fluttergithubbot fluttergithubbot merged commit c2dc92c into flutter:master Apr 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 14, 2022
auto-submit bot pushed a commit that referenced this pull request Apr 21, 2023
…droid Studio, assume the version to be the latest (#125247)

Fixes #125246 by restoring the intended behavior of #101862. That is, when searching for a JDK and we encounter an Android Studio version we don't recognize, assume it to be the latest version `flutter` is aware of.

Also does some light refactoring in the tests, like using test objects instead of referencing `globals`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants