Skip to content

Conversation

@bartekpacia
Copy link
Member

@bartekpacia bartekpacia commented Jan 12, 2024

There's no issue for this PR. I can create one if requested.

Summary

This PR makes public fields of FlutterExtension non-static. The aim is to make migrating from Gradle Groovy DSL to Gradle Kotlin DSL easier for Flutter developers, because...

Without this PR

android/app/build.gradle.kts

plugins {
    id "com.android.application"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "io.flutter.examples.hello_world"
    compileSdk = FlutterExtension.compileSdkVersion

    defaultConfig {
        applicationId = "io.flutter.examples.hello_world"
        minSdk = FlutterExtension.minSdkVersion
        targetSdk = FlutterExtension.targetSdkVersion
        // ...
    }
}
// ...

Groovy and Java allow accessing static fields of a class through its instance, but Kotlin is being more "correct" and disallows that.

With this PR

Thanks to this PR, the user won't have to replace flutter with FlutterExtension in some places, thus decreasing possible confusion.

plugins {
    id "com.android.application"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "io.flutter.examples.hello_world"
    compileSdk = flutter.compileSdkVersion

    defaultConfig {
        applicationId = "io.flutter.examples.hello_world"
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        // ...
    }
}
// ...

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
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 "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jan 12, 2024
@bartekpacia
Copy link
Member Author

No tests are needed for this, since build of any Flutter app (that has build.gradle.kts which uses flutter.minSdkVersion) will start failing if this change gets reverted.

@reidbaker
Copy link
Contributor

No tests are needed for this, since build of any Flutter app (that has build.gradle.kts which uses flutter.minSdkVersion) will start failing if this change gets reverted.

Let me state this differently. No New tests are needed since the existing tests will fail if this is reverted.

@reidbaker
Copy link
Contributor

If nothing breaks in customer tests then this works for me.

@bartekpacia
Copy link
Member Author

Let me state this differently. No New tests are needed since the existing tests will fail if this is reverted.

That's right. Thanks for clarifying:)

@bartekpacia
Copy link
Member Author

bartekpacia commented Jan 12, 2024

This is a tiny bit more complex since the first build.gradle.kts will be added to the Flutter repo in #140115. But I already tested it locally and it works, no breackage. Anyway if something blows up just hit me up and I'll fix stuff.

In retrospect I would've taken a more orderly approach (if I knew what I know now). Now I make PRs as soon as I see area for improvement.

@bartekpacia bartekpacia added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 12, 2024
@auto-submit auto-submit bot merged commit dbf5f04 into flutter:master Jan 12, 2024
@bartekpacia bartekpacia deleted the chore/flutter_extension_nonstatic_fields branch January 12, 2024 18:50
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 14, 2024
flutter/flutter@7dc856a...1a2c315

2024-01-14 [email protected] BoxPainter should dispatch creation and disposal events. (flutter/flutter#141526)
2024-01-14 [email protected] Roll Flutter Engine from a0ac66ecaa2b to f20657354d8b (1 revision) (flutter/flutter#141518)
2024-01-13 [email protected] Roll Flutter Engine from b06478b70a2f to a0ac66ecaa2b (1 revision) (flutter/flutter#141498)
2024-01-13 [email protected] Roll Flutter Engine from 205ed6882a8f to b06478b70a2f (3 revisions) (flutter/flutter#141496)
2024-01-13 [email protected] Roll Flutter Engine from b8e5d4776908 to 205ed6882a8f (1 revision) (flutter/flutter#141492)
2024-01-12 [email protected] Roll Flutter Engine from 418c9e918a22 to b8e5d4776908 (7 revisions) (flutter/flutter#141489)
2024-01-12 [email protected] Added newline at end of `.gitignore` files (flutter/flutter#141270)
2024-01-12 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.0.0 to 4.1.0 (flutter/flutter#141480)
2024-01-12 [email protected] Fixed a lot of typos (flutter/flutter#141431)
2024-01-12 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove hack from PageView." (flutter/flutter#141479)
2024-01-12 [email protected] Roll Flutter Engine from 01e353544dd7 to 418c9e918a22 (2 revisions) (flutter/flutter#141474)
2024-01-12 [email protected] Roll Flutter Engine from 0ac8215c70ae to 01e353544dd7 (1 revision) (flutter/flutter#141470)
2024-01-12 [email protected] Roll Flutter Engine from ef2cf86c35a5 to 0ac8215c70ae (2 revisions) (flutter/flutter#141464)
2024-01-12 [email protected] unpin web_socket_channel and roll pub packages (flutter/flutter#141424)
2024-01-12 [email protected] FlutterExtension: make fields non-static (flutter/flutter#141463)
2024-01-12 [email protected] [deep link]  Update a gradle task to add flag check and intent filter check to the AppLinkSettings (flutter/flutter#141231)
2024-01-12 [email protected] Expose versionCode and versionName from local.properties in FlutterExtension (flutter/flutter#141417)
2024-01-12 [email protected] Roll Flutter Engine from a56f346dbbf9 to ef2cf86c35a5 (1 revision) (flutter/flutter#141456)
2024-01-12 [email protected] When Impeller is enabled for flutter tester choose correct shader target. (flutter/flutter#141391)
2024-01-12 [email protected] Remove hack from PageView. (flutter/flutter#141138)
2024-01-12 [email protected] Roll Flutter Engine from d0f9329c5ce4 to a56f346dbbf9 (6 revisions) (flutter/flutter#141451)
2024-01-12 [email protected] Adds support for StepStyle visual property bundle to the Step widget (flutter/flutter#140825)
2024-01-12 [email protected] Roll Flutter Engine from 44a0a6ee4d39 to d0f9329c5ce4 (1 revision) (flutter/flutter#141435)

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 [email protected],[email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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