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

i123643 print java version gradle #123644

Merged
merged 42 commits into from Apr 13, 2023
Merged

i123643 print java version gradle #123644

merged 42 commits into from Apr 13, 2023

Conversation

reidbaker
Copy link
Contributor

@reidbaker reidbaker commented Mar 28, 2023

#123643

  • Add task to projects evaluated by flutter.gradle that will print the java version.
  • Add integration test for the existence of javaVersion and the expected format.
  • Add gradle util to get the gradlew version for a specific platform (gradlew everywhere but windows).

Why does this code need to exist?
Figuring out what version of java is used by flutter/gradle is done in a few different ways that are not always aligned.
See this issue #122609 ,
this issue #121501 this feature request #106416

As examples of why assuming the java version is dangerous.
This task is code flutter can build upon and is the version gradle is using to build no matter how it is configured.

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.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 28, 2023
@reidbaker reidbaker marked this pull request as ready for review March 28, 2023 23:34
Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

LGTM!

// Format of the output of this task is used by other code in flutter to evaluate java version.
private static void addTaskForJavaVersion(Project project) {
// Warning: The name of this task is used by other code.
project.tasks.register('javaVersion') {
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you feel about calling it (print/show/get)JavaVersion? And is the warning for possible edits to the name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Locally I had printJavaVersion which would be run as ./gradlew -q printJavaVersion but this is a task not a gradle function and thought ./gradlew -q javaVersion actually read more clean.

The warning is for possible changes to the name since I am not aware of anything. I can make the warning more clear. " Warning: the name of this task is used by other code. Change with caution."

@chunhtai
Copy link
Contributor

I have a more general question: How will this task be used?

@@ -0,0 +1,55 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

The name should end with *_test.dart

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch. fixed.

@reidbaker
Copy link
Contributor Author

I have a more general question: How will this task be used?

There are a handful of issues relating to identifying or configuring the java sdk. I see this a the source of truth for the version of java gradle is using. In practice I think it will be used to warn on incompatible java versions that other tools have. For example java 17 and gradle 6.7.

@gnprice
Copy link
Member

gnprice commented Mar 29, 2023

Running a Gradle task is pretty slow. (Particularly due to #119196; I don't know how slow it would still be after fixing that.) So if you're thinking of a use case within a normal flutter run or flutter build, I think it'd be best to avoid having to run an extra Gradle task.

What should work to identify the Java version being used by Gradle is:

  • The environment that the tool starts gradlew with is under the tool's control.
  • The behavior of gradlew is that it looks at JAVA_HOME, and if it doesn't find an executable file at "$JAVA_HOME/bin/java" then it uses the java executable found in the PATH.
  • So the tool can look at the JAVA_HOME and PATH environment variables it intends to pass to gradlew, and identify what java executable those point to.
  • Then to find the version, one can run that java executable with the argument -version.

That approach isn't quite ground truth, because in principle the user could have an android/gradlew script that does something wild. But there a lot of ways that a user could in principle have made a mess, so it's impossible to be prepared for all of them. And I think this is a pretty unlikely one in practice — I think people generally avoid touching the gradlew scripts except by letting a Gradle upgrade do it.

In principle also a future Gradle version's gradlew could change that logic; but I think the behavior of "JAVA_HOME, then fall back to PATH" has been a widespread expectation in the Java world for a long time, and has been very stable in gradlew.

I think a task like this one could be useful as ground truth in a debugging situation, though. I'd just want to keep it out of a developer's normal flutter run or flutter build iteration loop.

@gnprice
Copy link
Member

gnprice commented Mar 29, 2023

In practice I think it will be used to warn on incompatible java versions that other tools have. For example java 17 and gradle 6.7.

In that situation, would this task be able to run? Or would it hit the same unhelpful error message as the main build tasks do?

My guess (though I don't actually know) would be that the error is happening before Gradle even gets to looking at a specific task, so that this task would hit the same unhelpful error message.

@reidbaker
Copy link
Contributor Author

In practice I think it will be used to warn on incompatible java versions that other tools have. For example java 17 and gradle 6.7.

In that situation, would this task be able to run? Or would it hit the same unhelpful error message as the main build tasks do?

My guess (though I don't actually know) would be that the error is happening before Gradle even gets to looking at a specific task, so that this task would hit the same unhelpful error message.

Thanks for these comments. I think you are correct that we will get an error before this code can run which makes this pr less valuable but not so much that I think we should drop this PR. I added a warning about speed and intended use and will not rely on this task for the other work I am doing around java versioning.

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

LGTM with that plan

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -290,3 +289,12 @@ void exitWithNoSdkMessage() {
'Try setting the ANDROID_SDK_ROOT environment variable.'
);
}

// return gradlew file name based on the platform.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// return gradlew file name based on the platform.
// Returns gradlew file name based on the platform.

cbracken and others added 6 commits April 5, 2023 15:23
In #122336 we migrated the principal class from NSApplication to
FlutterApplication in the app Info.plist. We removed the need for
FlutterApplication in flutter/engine#40929. This
reverses the migration for anyone who previously upgraded on the Flutter
master branch.

Issue: #30735

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
… AppBar's scrolledUnderElevation" (#124226)

Revert "Fix scrolling in the  `Drawer` and `NavigationDrawer` triggers AppBar's scrolledUnderElevation"
…124227)

Roll Flutter Engine from db23c3fbe0b0 to 67467127295d (1 revision)
The first of many PRs for transitioning to `package:unified_analytics`.
This PR is only focused on disabling and enabling telemetry via the
`flutter config --[no-]analytics` flag

Fixes: #121617

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Christopher Fujino <fujino@google.com>
Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
#123917

Doc covering a broad set of issues related to android studio updating.

https://docs.google.com/document/d/1hTXkjbUrBnXgu8NQsth1c3aEqo77rWoEj8CcsQ39wwQ/edit?pli=1#

Specifically this pr:
- Adds new functions to find a projects AGP, Gradle and java versions,
and tests.
- Adds new functions that take versions and parse if the versions are
compatible with each other, and tests.
- Adds validator for `flutter analyze --suggestions` that evaluates the
java/gradle/agp versions and checks if they are compatible, and
integration test.
- Updates the version of gradle used by
dev/integration_tests/flutter_gallery/ to the minimum supported by java
18 so that the integration tests pass (It is unknown why the java
version is 18.9 instead of 11)
- Moves `isWithinVersionRange` to version.dart, and tests.
- Adds FakeAndroidStudio to fakes to be used in multiple tests but does
not remove existing copies.

Metrics will be included as part of the definition of done for this bug
but not as part of this cl. It is already too big.

Known work still left in this pr:
* Understand why analyze integration tests are failing.

Example output if Java and gradle are not compatible:
```
┌───────────────────────────────────────────────────────────────────┐
│ General Info                                                      │
│ [✓] App Name: espresso_example                                    │
│ [✓] Supported Platforms: android                                  │
│ [✓] Is Flutter Package: yes                                       │
│ [✓] Uses Material Design: yes                                     │
│ [✓] Is Plugin: no                                                 │
│ [✗] Java/Gradle/Android Gradle Plugin:                            │
│                                                                   │
│ Incompatible Java/Gradle versions.                                │
│                                                                   │
│ Java Version: 17.0.6, Gradle Version: 7.0.2                       │
│                                                                   │
│ See the link below for more information.                          │
│ https://docs.gradle.org/current/userguide/compatibility.html#java │
│                                                                   │
└───────────────────────────────────────────────────────────────────┘
```
Example output if Gradle and AGP are not compatible
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ General Info                                                                │
│ [✓] App Name: espresso_example                                              │
│ [✓] Supported Platforms: android                                            │
│ [✓] Is Flutter Package: yes                                                 │
│ [✓] Uses Material Design: yes                                               │
│ [✓] Is Plugin: no                                                           │
│ [✗] Java/Gradle/Android Gradle Plugin: Incompatible Gradle/AGP versions.    │
│                                                                             │
│ Gradle Version: 7.0.2, AGP Version: 7.4.2                                   │
│                                                                             │
│ Update gradle to at least "7.5".                                            │
│ See the link below for more information:                                    │
│ https://developer.android.com/studio/releases/gradle-plugin#updating-gradle │
│                                                                             │
│ Incompatible Java/Gradle versions.                                          │
│                                                                             │
│ Java Version: 17.0.6, Gradle Version: 7.0.2                                 │
│                                                                             │
│ See the link below for more information:                                    │
│ https://docs.gradle.org/current/userguide/compatibility.html#java           │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
```
Example output if Java/Gradle/Agp are not compatible.
```

┌─────────────────────────────────────────────────────────────────────────────┐
│ General Info                                                                │
│ [✓] App Name: espresso_example                                              │
│ [✓] Supported Platforms: android                                            │
│ [✓] Is Flutter Package: yes                                                 │
│ [✓] Uses Material Design: yes                                               │
│ [✓] Is Plugin: no                                                           │
│ [✗] Java/Gradle/Android Gradle Plugin: Incompatible Gradle/AGP versions.    │
│                                                                             │
│ Gradle Version: 7.0.2, AGP Version: 7.4.2                                   │
│                                                                             │
│ Update gradle to at least "7.5".                                            │
│ See the link below for more information:                                    │
│ https://developer.android.com/studio/releases/gradle-plugin#updating-gradle │
│                                                                             │
│ Incompatible Java/Gradle versions.                                          │
│                                                                             │
│ Java Version: 17.0.6, Gradle Version: 7.0.2                                 │
│                                                                             │
│ See the link below for more information:                                    │
│ https://docs.gradle.org/current/userguide/compatibility.html#java           │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
```

Commit messages
- Add function to gradle_utils.dart that gets the gradle version from
wrapper or system and add a test for each situation
- Add method to get agp version, add method to validate agp against
gradle version, update documentation, add tests for agp validation.
- Update dart doc for validateGradleAndAgp to describe where the info
came from and corner case behavior, create function to validate java and
gradle and hardcode return to false
- Fill out and test java gradle compatibility function in gradle_utils
- Hook up java gradle evaluateion to hasValidJavaGradleAgpVersions with
hardcoded java version
- Add java --version output parsing and tests
- Add getJavaBinary test
- Update comment in android_sdk for mac behavior with java_home -v

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] All existing and new tests are passing.
// Verify that gradlew has a javaVersion task.
expect(result.exitCode, 0);
// Verify the format is a number on its own line.
expect(result.stdout.toString(), matches(RegExp(r'\d\n')));
Copy link
Member

Choose a reason for hiding this comment

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

2 questions:

  1. should we be matching 1 or more digits?
  2. would this never be a \r\n on Windows?

Copy link
Contributor Author

@reidbaker reidbaker Apr 13, 2023

Choose a reason for hiding this comment

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

  1. yes updated.
  2. Maybe, I think I will update this to use the end of line sequence instead.

@@ -9,6 +9,7 @@ import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/project.dart';
import '../../commands.shard/hermetic/build_windows_test.dart' as windows;
Copy link
Member

Choose a reason for hiding this comment

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

TIL about this check:

▌19:42:44▐ Test imports...
╔═╡ERROR╞═══════════════════════════════════════════════════════════════════════
║ The following file import a test directly. Test utilities should be in their own file.
║ /tmp/flutter sdk/packages/flutter_tools/test/general.shard/android/gradle_utils_test.dart
╚═══════════════════════════════════════════════════════════════════════════════

Copy link
Member

Choose a reason for hiding this comment

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

Failing the analysis shard

@reidbaker reidbaker merged commit 2723266 into flutter:master Apr 13, 2023
122 of 123 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 14, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 14, 2023
flutter/flutter@be45eb2...f740544

2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from b7b2e7b742aa to 4b96e38c9275 (1 revision) (flutter/flutter#124856)
2023-04-14 6655696+guidezpl@users.noreply.github.com Adjust repo config for VS Code formatting (flutter/flutter#122758)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4f86a05ac932 to b7b2e7b742aa (4 revisions) (flutter/flutter#124845)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 00bef00f64a7 to 4f86a05ac932 (5 revisions) (flutter/flutter#124841)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from ad222b0c93b9 to 00bef00f64a7 (1 revision) (flutter/flutter#124837)
2023-04-14 andrewrkolos@gmail.com [flutter_tools] Reorganize android_studio_test.dart (flutter/flutter#124834)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from ce7be0093399 to ad222b0c93b9 (1 revision) (flutter/flutter#124832)
2023-04-14 magder@google.com Remove Finder extended attributes in build target before code signing iOS frameworks (flutter/flutter#123896)
2023-04-14 kevmoo@users.noreply.github.com flutter-tool, web: update HTML template serviceWorkerVersion to be const (flutter/flutter#124826)
2023-04-14 tessertaha@gmail.com Fix `CupertinoContextMenu` throws exception on route animation (flutter/flutter#124785)
2023-04-14 kevmoo@users.noreply.github.com flutter-tool: enum cleanup (flutter/flutter#124760)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1289f4b513ef to ce7be0093399 (1 revision) (flutter/flutter#124825)
2023-04-13 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.1 to 3.5.2 (flutter/flutter#124822)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2ff14d733daa to 1289f4b513ef (2 revisions) (flutter/flutter#124824)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from eb3e7d52ebbc to 2ff14d733daa (1 revision) (flutter/flutter#124820)
2023-04-13 reidbaker@google.com i123643 print java version gradle (flutter/flutter#123644)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 496543715bdb to eb3e7d52ebbc (3 revisions) (flutter/flutter#124816)
2023-04-13 fluttergithubbot@gmail.com Roll pub packages (flutter/flutter#124709)
2023-04-13 21270878+elliette@users.noreply.github.com [flutter_tools] Disable flaky `output_web_test` test case (flutter/flutter#124257)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 26eddb64e8ea to 496543715bdb (1 revision) (flutter/flutter#124812)
2023-04-13 tessertaha@gmail.com Refactor `SliverAppBar.medium` & `SliverAppBar.large` to fix several issues (flutter/flutter#122542)
2023-04-13 jmccandless@google.com Improve the docs around the TextSelectionHandleControls deprecations (flutter/flutter#123827)
2023-04-13 engine-flutter-autoroll@skia.org Roll Packages from fe5615f to d01f4ea (5 revisions) (flutter/flutter#124795)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 81a57d24e62a to 26eddb64e8ea (1 revision) (flutter/flutter#124794)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
bartekpacia added a commit to bartekpacia/flutter that referenced this pull request Apr 14, 2023
exaby73 pushed a commit to exaby73/flutter_nevercode that referenced this pull request Apr 17, 2023
flutter#123643
- Add task to projects evaluated by flutter.gradle that will print the
java version.
- Add integration test for the existence of javaVersion and the expected
format.
- Add gradle util to get the gradlew version for a specific platform
(gradlew everywhere but windows).

Why does this code need to exist? 
Figuring out what version of java is used by flutter/gradle is done in a
few different ways that are not always aligned.
See this issue flutter#122609 ,
this issue flutter#121501 this feature
request flutter#106416

As examples of why assuming the java version is dangerous. 
This task is code flutter can build upon and is the version gradle is
using to build no matter how it is configured.



## Pre-launch Checklist

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

---------

Co-authored-by: Mitchell Goodwin <58190796+MitchellGoodwin@users.noreply.github.com>
Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
Co-authored-by: Victoria Ashworth <vashworth@google.com>
Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
Co-authored-by: Jackson Gardner <jacksongardner@google.com>
Co-authored-by: Rydmike <m.rydstrom@gmail.com>
Co-authored-by: keyonghan <54558023+keyonghan@users.noreply.github.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
Co-authored-by: Ben Konyi <bkonyi@google.com>
Co-authored-by: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Co-authored-by: hellohuanlin <41930132+hellohuanlin@users.noreply.github.com>
Co-authored-by: Danny Tuppeny <danny@tuppeny.com>
Co-authored-by: Chris Bracken <chris@bracken.jp>
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
Co-authored-by: Elias Yishak <42216813+eliasyishak@users.noreply.github.com>
Co-authored-by: Christopher Fujino <fujino@google.com>
gmackall pushed a commit to gmackall/flutter that referenced this pull request May 5, 2023
- Add task to projects evaluated by flutter.gradle that will print the
java version.
- Add integration test for the existence of javaVersion and the expected
format.
- Add gradle util to get the gradlew version for a specific platform
(gradlew everywhere but windows).

Why does this code need to exist?
Figuring out what version of java is used by flutter/gradle is done in a
few different ways that are not always aligned.
See this issue flutter#122609 ,
this issue flutter#121501 this feature
request flutter#106416

As examples of why assuming the java version is dangerous.
This task is code flutter can build upon and is the version gradle is
using to build no matter how it is configured.

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

---------

Co-authored-by: Mitchell Goodwin <58190796+MitchellGoodwin@users.noreply.github.com>
Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
Co-authored-by: Victoria Ashworth <vashworth@google.com>
Co-authored-by: Jackson Gardner <jacksongardner@google.com>
Co-authored-by: Rydmike <m.rydstrom@gmail.com>
Co-authored-by: keyonghan <54558023+keyonghan@users.noreply.github.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
Co-authored-by: Ben Konyi <bkonyi@google.com>
Co-authored-by: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Co-authored-by: hellohuanlin <41930132+hellohuanlin@users.noreply.github.com>
Co-authored-by: Danny Tuppeny <danny@tuppeny.com>
Co-authored-by: Chris Bracken <chris@bracken.jp>
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
Co-authored-by: Elias Yishak <42216813+eliasyishak@users.noreply.github.com>
Co-authored-by: Christopher Fujino <fujino@google.com>
XilaiZhang pushed a commit that referenced this pull request May 15, 2023
…d Studio bundled Java version is detected (and 3 others) (#126093)

This is a cherry pick of the following four PRs (the first one depends
on changes made in the latter three).
1. #125836
2. #124771
3. #123034
4. #123644

For the first PR, 
Original issue: #122376
Cherry-pick issue: #125693

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Reid Baker <reidbaker@google.com>
Co-authored-by: Mitchell Goodwin <58190796+MitchellGoodwin@users.noreply.github.com>
Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
Co-authored-by: Victoria Ashworth <vashworth@google.com>
Co-authored-by: Jackson Gardner <jacksongardner@google.com>
Co-authored-by: Rydmike <m.rydstrom@gmail.com>
Co-authored-by: keyonghan <54558023+keyonghan@users.noreply.github.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
Co-authored-by: Ben Konyi <bkonyi@google.com>
Co-authored-by: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Co-authored-by: hellohuanlin <41930132+hellohuanlin@users.noreply.github.com>
Co-authored-by: Danny Tuppeny <danny@tuppeny.com>
Co-authored-by: Chris Bracken <chris@bracken.jp>
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
Co-authored-by: Elias Yishak <42216813+eliasyishak@users.noreply.github.com>
Co-authored-by: Christopher Fujino <fujino@google.com>
Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
…r#3713)

flutter/flutter@be45eb2...f740544

2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from b7b2e7b742aa to 4b96e38c9275 (1 revision) (flutter/flutter#124856)
2023-04-14 6655696+guidezpl@users.noreply.github.com Adjust repo config for VS Code formatting (flutter/flutter#122758)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4f86a05ac932 to b7b2e7b742aa (4 revisions) (flutter/flutter#124845)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 00bef00f64a7 to 4f86a05ac932 (5 revisions) (flutter/flutter#124841)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from ad222b0c93b9 to 00bef00f64a7 (1 revision) (flutter/flutter#124837)
2023-04-14 andrewrkolos@gmail.com [flutter_tools] Reorganize android_studio_test.dart (flutter/flutter#124834)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from ce7be0093399 to ad222b0c93b9 (1 revision) (flutter/flutter#124832)
2023-04-14 magder@google.com Remove Finder extended attributes in build target before code signing iOS frameworks (flutter/flutter#123896)
2023-04-14 kevmoo@users.noreply.github.com flutter-tool, web: update HTML template serviceWorkerVersion to be const (flutter/flutter#124826)
2023-04-14 tessertaha@gmail.com Fix `CupertinoContextMenu` throws exception on route animation (flutter/flutter#124785)
2023-04-14 kevmoo@users.noreply.github.com flutter-tool: enum cleanup (flutter/flutter#124760)
2023-04-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1289f4b513ef to ce7be0093399 (1 revision) (flutter/flutter#124825)
2023-04-13 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.1 to 3.5.2 (flutter/flutter#124822)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2ff14d733daa to 1289f4b513ef (2 revisions) (flutter/flutter#124824)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from eb3e7d52ebbc to 2ff14d733daa (1 revision) (flutter/flutter#124820)
2023-04-13 reidbaker@google.com i123643 print java version gradle (flutter/flutter#123644)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 496543715bdb to eb3e7d52ebbc (3 revisions) (flutter/flutter#124816)
2023-04-13 fluttergithubbot@gmail.com Roll pub packages (flutter/flutter#124709)
2023-04-13 21270878+elliette@users.noreply.github.com [flutter_tools] Disable flaky `output_web_test` test case (flutter/flutter#124257)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 26eddb64e8ea to 496543715bdb (1 revision) (flutter/flutter#124812)
2023-04-13 tessertaha@gmail.com Refactor `SliverAppBar.medium` & `SliverAppBar.large` to fix several issues (flutter/flutter#122542)
2023-04-13 jmccandless@google.com Improve the docs around the TextSelectionHandleControls deprecations (flutter/flutter#123827)
2023-04-13 engine-flutter-autoroll@skia.org Roll Packages from fe5615f to d01f4ea (5 revisions) (flutter/flutter#124795)
2023-04-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 81a57d24e62a to 26eddb64e8ea (1 revision) (flutter/flutter#124794)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
FlutterSu pushed a commit to flutter-rosita/flutter-rosita that referenced this pull request Sep 14, 2023
…d Studio bundled Java version is detected (and 3 others) (flutter#126093)

This is a cherry pick of the following four PRs (the first one depends
on changes made in the latter three).
1. flutter#125836
2. flutter#124771
3. flutter#123034
4. flutter#123644

For the first PR,
Original issue: flutter#122376
Cherry-pick issue: flutter#125693

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Reid Baker <reidbaker@google.com>
Co-authored-by: Mitchell Goodwin <58190796+MitchellGoodwin@users.noreply.github.com>
Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
Co-authored-by: Victoria Ashworth <vashworth@google.com>
Co-authored-by: Jackson Gardner <jacksongardner@google.com>
Co-authored-by: Rydmike <m.rydstrom@gmail.com>
Co-authored-by: keyonghan <54558023+keyonghan@users.noreply.github.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
Co-authored-by: Ben Konyi <bkonyi@google.com>
Co-authored-by: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Co-authored-by: hellohuanlin <41930132+hellohuanlin@users.noreply.github.com>
Co-authored-by: Danny Tuppeny <danny@tuppeny.com>
Co-authored-by: Chris Bracken <chris@bracken.jp>
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
Co-authored-by: Elias Yishak <42216813+eliasyishak@users.noreply.github.com>
Co-authored-by: Christopher Fujino <fujino@google.com>
Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
FlutterSu pushed a commit to flutter-rosita/flutter-rosita that referenced this pull request Dec 27, 2023
…d Studio bundled Java version is detected (and 3 others) (flutter#126093)

This is a cherry pick of the following four PRs (the first one depends
on changes made in the latter three).
1. flutter#125836
2. flutter#124771
3. flutter#123034
4. flutter#123644

For the first PR,
Original issue: flutter#122376
Cherry-pick issue: flutter#125693

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Reid Baker <reidbaker@google.com>
Co-authored-by: Mitchell Goodwin <58190796+MitchellGoodwin@users.noreply.github.com>
Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
Co-authored-by: Victoria Ashworth <vashworth@google.com>
Co-authored-by: Jackson Gardner <jacksongardner@google.com>
Co-authored-by: Rydmike <m.rydstrom@gmail.com>
Co-authored-by: keyonghan <54558023+keyonghan@users.noreply.github.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
Co-authored-by: Ben Konyi <bkonyi@google.com>
Co-authored-by: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Co-authored-by: hellohuanlin <41930132+hellohuanlin@users.noreply.github.com>
Co-authored-by: Danny Tuppeny <danny@tuppeny.com>
Co-authored-by: Chris Bracken <chris@bracken.jp>
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
Co-authored-by: Elias Yishak <42216813+eliasyishak@users.noreply.github.com>
Co-authored-by: Christopher Fujino <fujino@google.com>
Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
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