Skip to content

Conversation

GaryQian
Copy link
Contributor

@GaryQian GaryQian commented Nov 4, 2022

The flake in #103230 is caused by groovy dynamic dispatch bug. This PR refactors the troublesome logic to Kotlin DSL, which is preferred over Groovy now.

This is an initial step to introduce Kotlin DSL. More refactors may come in the future should we decide to move to it.

Since Kotlin DSL is statically compiled while Groovy is dynamically dispatched, we use withGroovyBuilder and getProperty() to access Groovy metaprogramming.

Since this is a refactor, the existing build tests for multidex and general builds already covers this PR.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 4, 2022
@GaryQian GaryQian marked this pull request as ready for review November 4, 2022 18:43
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

apply<FlutterPluginKts>()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we already require of all users the dependencies needed to use Kotlin during builds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so but let me double check that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://docs.gradle.org/5.0/release-notes.html

Kotlin DSL 1.0 is supported in Gradle 5.0 (Nov 2018), and older versions of gradle include pre-1.0 support for Kotlin DSL. This predates Dec 2018 Flutter 1.0 release, so all flutter apps 1.0 and above should support Kotlin DLS buildscripts.

Gradle 3.2 (Nov 2016) contains the initial support for Kotlin DSL (called Gradle Buildscript Kotlin) back then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reference, Flutter 1.0 shipped with Gradle 4.10.2, which included Kotlin DSL 1.0 RC6 https://docs.gradle.org/4.10.2/release-notes.html

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, sounds like Kotlin DSL ships with an embedded compiler: https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html

Copy link
Contributor

@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 let's give it a shot

@GaryQian GaryQian changed the title Apply multidex login in kotlin dsl gradle file Apply multidex config in kotlin dsl gradle file Nov 9, 2022
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@GaryQian GaryQian added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 9, 2022
@auto-submit auto-submit bot merged commit 69a542d into flutter:master Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 9, 2022
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 9, 2022
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902)

* 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834)

* 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048)

* 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645)

* 530324d Build command dependency injection (flutter/flutter#114383)

* 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660)

* 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922)

* d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
auto-submit bot pushed a commit to flutter/plugins that referenced this pull request Nov 9, 2022
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902)

* 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834)

* 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048)

* 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645)

* 530324d Build command dependency injection (flutter/flutter#114383)

* 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660)

* 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922)

* d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
IVLIVS-III pushed a commit to IVLIVS-III/flutter_plugins_fork that referenced this pull request Nov 11, 2022
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902)

* 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834)

* 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048)

* 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645)

* 530324d Build command dependency injection (flutter/flutter#114383)

* 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660)

* 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922)

* d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
adam-harwood pushed a commit to adam-harwood/flutter_plugins that referenced this pull request Nov 21, 2022
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902)

* 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834)

* 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048)

* 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645)

* 530324d Build command dependency injection (flutter/flutter#114383)

* 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660)

* 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922)

* d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
shogohida pushed a commit to shogohida/flutter that referenced this pull request Dec 7, 2022
* Apply multidex login in kotlin dsl gradle file

* Cleanup

* Remove plugin parameter passing

* Cleanup

* Restore dependencies block

* Analyzer

* Compiles

* Cleanup

* Cleanup
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
* Apply multidex login in kotlin dsl gradle file

* Cleanup

* Remove plugin parameter passing

* Cleanup

* Restore dependencies block

* Analyzer

* Compiles

* Cleanup

* Cleanup
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902)

* 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834)

* 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048)

* 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645)

* 530324d Build command dependency injection (flutter/flutter#114383)

* 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660)

* 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922)

* d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants