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

[shared_preferences] Platform implementations of async api #6965

Merged
merged 23 commits into from
Jul 30, 2024

Conversation

tarrinneal
Copy link
Contributor

@tarrinneal tarrinneal commented Jun 21, 2024

part 2 of #5210

@tarrinneal tarrinneal marked this pull request as ready for review July 18, 2024 21:02
@tarrinneal tarrinneal requested a review from stuartmorgan July 18, 2024 21:28
@tarrinneal
Copy link
Contributor Author

@reidbaker any chance you can help me diagnose this gradle issue?

@stuartmorgan
Copy link
Contributor

I believe that ("Unsupported class file major version") is the result of something requiring a newer Java version than is available on the machine?

@reidbaker
Copy link
Contributor

Unsupported class file major version 65 means you are using java 21 and should be using something lower more detail here

Looking at your changes I dont see anything that should cause this failure. @christopherfujino do you see something about this machine config that would cause it to run java 21 instead of the lower java versions we expect.

@stuartmorgan
Copy link
Contributor

The machine should definitely be using 17:

{"dependency": "open_jdk", "version": "version:17"},

Could it be something precompiled that used 21?

@tarrinneal tarrinneal requested a review from stuartmorgan July 23, 2024 04:30
@@ -2,13 +2,15 @@ group 'io.flutter.plugins.sharedpreferences'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.8.10'
Copy link
Contributor

Choose a reason for hiding this comment

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

@reidbaker Is this going to cause issues for clients? It looks like this would be the first of our plugins using 1.8.x.

@tarrinneal What exactly was the error when this was 1.7.10 like our other plugins?

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://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8741408197539124465/+/u/Run_package_tests/native_unit_tests/stdout?format=raw

Integration tests run fine though, only unit tests fail. There may be some other underlying issue.

@stuartmorgan
Copy link
Contributor

@tarrinneal I played around with a bit locally, and if I add the implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22")) workaround to android/build.gradle, drive-examples works (which suggests to me that clients should be fine), then if I add the kotlin_version bump to 1.8.10 only in example/android/build.gradle (which doesn't affect clients), unit tests compiled and passed.

@reidbaker Does that seem like a reasonable thing to do? I'm still not clear why this example needs a different kotlin_version when none of the others do, but maybe it's because the unit tests are Kotlin?

@reidbaker
Copy link
Contributor

@tarrinneal I played around with a bit locally, and if I add the implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22")) workaround to android/build.gradle, drive-examples works (which suggests to me that clients should be fine), then if I add the kotlin_version bump to 1.8.10 only in example/android/build.gradle (which doesn't affect clients), unit tests compiled and passed.

@reidbaker Does that seem like a reasonable thing to do? I'm still not clear why this example needs a different kotlin_version when none of the others do, but maybe it's because the unit tests are Kotlin?

It seems weird to me that example/android/build.gradle cant use kotlin 1.8.22. The only reason for that would be if the dependencies used in example/android/app/build.gradle were too old to use a newer version of kotlin.

In general I think it is ok to have the example app have whatever version of kotlin but it seems to me like they should be aligned.

@stuartmorgan
Copy link
Contributor

stuartmorgan commented Jul 26, 2024

It seems weird to me that example/android/build.gradle cant use kotlin 1.8.22.

To clarify, maybe it can use 1.8.22. What doesn't work is continuing to use 1.7.10, even though that's what every other package we have that uses the bom workaround thing is doing.

@stuartmorgan
Copy link
Contributor

And to put some numbers to that:

  • 7 of our plugins currently use the implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22")) trick, with either 1.8.10 or 1.8.22
  • 0 of our plugins (other than a Pigeon internal test app) set ext.kotlin_version to something newer than 1.7.10.

So in seven other plugins, just adding the bom line seems to be enough, but here we also need to bump the example app's Kotlin version.

@reidbaker
Copy link
Contributor

IIRC there was an issue fixed in kotlin 1.8.* that fixed situations where when you had multiple kotlin versions between the app and libraries that you would have duplicate files and the work around was to add the kotlin bom.

@gmackall might remember the exact versions.

@tarrinneal
Copy link
Contributor Author

Any ideas why the bom isn't working for this pr?

@stuartmorgan
Copy link
Contributor

Since it works if we update Kotlin only in the example app, I would just add that to unblock the PR. We have the build-all app ensuring that it works in an app that doesn't set a higher Kotlin version.

@tarrinneal tarrinneal requested a review from stuartmorgan July 27, 2024 02:44
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM!

dependencies {
// org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions.
// See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.10"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Weird, I figured you'd still need this part. 🤷🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you stuck on legacy as the prefix? The meaning of legacy can change over time so v1 might be a better prefix.

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 legacy is pretty fitting, as it is now legacy code. It implies future intent to deprecate the code

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue is legacy assumes 2 states, Legacy and Current and does not account for a 3rd state to exist at the same time.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is something I don't remember to think about until you raise it in reviews, but I'm trying to internalize it into my normal review process :)

I agree it would have been better not to use that name, but in this case I think it'll end up okay, because this was a big change to an API surface that we very explicitly don't want a lot of churn to, and hasn't been fundamentally changed like this in the entire life of the plugin. It's a very different case than, e.g., Android older API version codepaths, where this has come up before, where we can easily get new ones every year.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep I did not view it as a blocker which was why it came paired with an approval. It was just the dismissal that "I think legacy is pretty fitting, as it is now legacy code." that I wanted to expand upon since that misses my entire reason for commenting on the name.

I should have linked to the style guide. https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#avoid-newold-modifiers-in-code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code, and the names specifically, can also change any time without breaking anything, as this is just the native platform implementation. If there does end up being another massive overhaul before it's deprecated, we can just change it to something else at that time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's always LegacyLegacy ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

yes there is hahaha 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was just the dismissal that "I think legacy is pretty fitting, as it is now legacy code." that I wanted to expand upon since that misses my entire reason for commenting on the name.

Totally fair, I was missing the expanded context so I appreciate the comment :)

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 30, 2024
@auto-submit auto-submit bot merged commit 315ed8a into flutter:main Jul 30, 2024
76 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 31, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 31, 2024
flutter/packages@99e8606...46a712f

2024-07-31 [email protected] [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 [email protected] [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 [email protected] [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 [email protected] [shared_preferences] Platform implementations of async api (flutter/packages#6965)

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-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: 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
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
flutter/packages@99e8606...46a712f

2024-07-31 [email protected] [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 [email protected] [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 [email protected] [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 [email protected] [shared_preferences] Platform implementations of async api (flutter/packages#6965)

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-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: 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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
flutter/packages@99e8606...46a712f

2024-07-31 [email protected] [interactive_media_ads] Adds initial iOS implementation (flutter/packages#7063)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.1 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#6770)
2024-07-31 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.0 to 1.8.1 in /packages/interactive_media_ads/android (flutter/packages#7238)
2024-07-30 [email protected] [shared_preferences] full api redesign with DataStore and cache-less interface (flutter/packages#5210)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [url_launcher]: Bump androidx.browser:browser from 1.5.0 to 1.8.0 in /packages/url_launcher/url_launcher_android/android (flutter/packages#6811)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump com.android.billingclient:billing from 6.1.0 to 6.2.0 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#6413)
2024-07-30 [email protected] [path_provider] fix 151823: update minimum required path_provider_android to 2.2.0 (flutter/packages#7181)
2024-07-30 [email protected] [shared_preferences] Platform implementations of async api (flutter/packages#6965)

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-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants