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

[camerax] Add a dependency on kotlin-bom to align versions of kotlin-stdlib #3960

Merged
merged 7 commits into from
May 12, 2023

Conversation

gmackall
Copy link
Member

@gmackall gmackall commented May 10, 2023

A fresh sample app that adds a dependency on the camerax implementation of the camera plugin will fail to build with an error about duplicate classes*. This PR adds a dependency on kotlin-bom to align versions of kotlin transitive dependencies that are used.

The idea for the fix comes from here, which has some more discussion about the problem (but in a different context, unrelated to flutter).

* The error looks like this:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
     Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
...

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 relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • 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.

@gmackall gmackall requested a review from camsim99 as a code owner May 10, 2023 17:49
@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.

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 with a version bump :)

@gmackall
Copy link
Member Author

LGTM with a version bump :)

Yep, I think yours will land first so 0.5.0+2?

@camsim99
Copy link
Contributor

LGTM with a version bump :)

Yep, I think yours will land first so 0.5.0+2?

Yes!

@stuartmorgan
Copy link
Contributor

LGTM with a version bump :)

Yep, I think yours will land first so 0.5.0+2?

Yes!

We should also remove the README change in this PR since it won't apply any more.

@gmackall
Copy link
Member Author

We should also remove the README change in this PR since it won't apply any more.

I removed the note and also the section as there was nothing left, let me know if you think it would be better to have the section remain but be empty for now!

@@ -1,3 +1,8 @@
## 0.5.0+2

* Add a dependency on kotlin-bom to align versions kotlin transitive dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

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

## 0.5.0+2

* Add a dependency on kotlin-bom to align versions kotlin transitive dependencies.
* Remove note in `README.md` regarding duplicate Kotlin classes issue.
Copy link
Contributor

Choose a reason for hiding this comment

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

Removes

@@ -1,3 +1,8 @@
## 0.5.0+2

* Add a dependency on kotlin-bom to align versions kotlin transitive dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this missing an "of" in "versions kotlin"?

(also, "Kotlin")

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it is 🤦. It was originally "to align Kotlin transitive dependencies" and I missed an "of" when adding "versions"

@stuartmorgan
Copy link
Contributor

I removed the note and also the section as there was nothing left

👍🏻

@gmackall gmackall requested a review from reidbaker May 10, 2023 20:33
@gmackall
Copy link
Member Author

Manually removing the needs-tests label per advice on discord from @stuartmorgan that this is in fact being tested due to the change to use Kotlin 1.7.10 in the example app.

@gmackall gmackall added autosubmit Merge PR when tree becomes green via auto submit App and removed needs tests labels May 10, 2023
@auto-submit auto-submit bot merged commit 58618c9 into flutter:main May 12, 2023
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.8.0'
ext.kotlin_version = '1.7.10'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this have version 1.7.10 but the code here packages/camera/camera_android_camerax/android/build.gradle
Has 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.

We explicitly want to test that the plugin works out of the box for users with a default flutter create setup, which still uses 1.7.10. Otherwise anyone using this plugin gets confusing compile errors and has to change their app settings.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 15, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 15, 2023
flutter/packages@6328cfb...6608b60

2023-05-15 stuartmorgan@google.com [ci] Remove unnecessary Linux libraries (flutter/packages#3975)
2023-05-15 stuartmorgan@google.com [ci] Enforce a minimum Kotlin version in examples (flutter/packages#3979)
2023-05-15 stuartmorgan@google.com [ci] Disable Windows repo tool tests (flutter/packages#3980)
2023-05-12 stuartmorgan@google.com [ci] Add LUCI repo tool tests (flutter/packages#3964)
2023-05-12 reidbaker@google.com [url_launcher] Set broadcast reciever visability as required by target api 34 (flutter/packages#3973)
2023-05-12 reidbaker@google.com Update build.gradle with a comment explaining version (flutter/packages#3972)
2023-05-12 engine-flutter-autoroll@skia.org Roll Flutter from 8c5a1ea to a76dbe4 (12 revisions) (flutter/packages#3958)
2023-05-12 stuartmorgan@google.com [image_picker] Fix Android lints (flutter/packages#3887)
2023-05-12 stuartmorgan@google.com [various] Update minimum Flutter version to 3.3 (flutter/packages#3967)
2023-05-12 stuartmorgan@google.com [tool] Target specific Android unit tests (flutter/packages#3955)
2023-05-12 34871572+gmackall@users.noreply.github.com [camerax] Add a dependency on kotlin-bom to align versions of kotlin-stdlib (flutter/packages#3960)
2023-05-12 stuartmorgan@google.com [local_auth] Improve iOS test DI (flutter/packages#3959)
2023-05-12 stuartmorgan@google.com [ci] Ensure scripts fail if a command fails (flutter/packages#3963)
2023-05-11 stuartmorgan@google.com [ci] Pin the Flutter version for `release` (flutter/packages#3965)
2023-05-11 tarrinneal@gmail.com [video_player] foundation - reduce seek accuracy to fix seek to end bug (flutter/packages#3784)
2023-05-11 stuartmorgan@google.com [image_picker] Fix use_build_context_synchronously violations (flutter/packages#3969)
2023-05-11 stuartmorgan@google.com [tool] Ensure that publish credential path is available (flutter/packages#3970)
2023-05-11 63286031+ahmednfwela@users.noreply.github.com [go_router] change `fix_data.yaml` uris to be absolute to fix lints (flutter/packages#3877)
2023-05-11 stuartmorgan@google.com [tool] Use new pub cache location for publish (flutter/packages#3962)
2023-05-10 engine-flutter-autoroll@skia.org Roll Flutter (stable) from f72efea to 84a1e90 (1920 revisions) (flutter/packages#3961)
2023-05-10 andrelvsousa@gmail.com [image_picker_android] Improved Bitmap resize on Android (flutter/packages#3423)
2023-05-10 43054281+camsim99@users.noreply.github.com [camerax] Add Kotlin duplicate classes known error to README.md (flutter/packages#3957)

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 flutter-ecosystem@google.com,rmistry@google.com 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://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
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
flutter/packages@6328cfb...6608b60

2023-05-15 stuartmorgan@google.com [ci] Remove unnecessary Linux libraries (flutter/packages#3975)
2023-05-15 stuartmorgan@google.com [ci] Enforce a minimum Kotlin version in examples (flutter/packages#3979)
2023-05-15 stuartmorgan@google.com [ci] Disable Windows repo tool tests (flutter/packages#3980)
2023-05-12 stuartmorgan@google.com [ci] Add LUCI repo tool tests (flutter/packages#3964)
2023-05-12 reidbaker@google.com [url_launcher] Set broadcast reciever visability as required by target api 34 (flutter/packages#3973)
2023-05-12 reidbaker@google.com Update build.gradle with a comment explaining version (flutter/packages#3972)
2023-05-12 engine-flutter-autoroll@skia.org Roll Flutter from 8c5a1ea to a76dbe4 (12 revisions) (flutter/packages#3958)
2023-05-12 stuartmorgan@google.com [image_picker] Fix Android lints (flutter/packages#3887)
2023-05-12 stuartmorgan@google.com [various] Update minimum Flutter version to 3.3 (flutter/packages#3967)
2023-05-12 stuartmorgan@google.com [tool] Target specific Android unit tests (flutter/packages#3955)
2023-05-12 34871572+gmackall@users.noreply.github.com [camerax] Add a dependency on kotlin-bom to align versions of kotlin-stdlib (flutter/packages#3960)
2023-05-12 stuartmorgan@google.com [local_auth] Improve iOS test DI (flutter/packages#3959)
2023-05-12 stuartmorgan@google.com [ci] Ensure scripts fail if a command fails (flutter/packages#3963)
2023-05-11 stuartmorgan@google.com [ci] Pin the Flutter version for `release` (flutter/packages#3965)
2023-05-11 tarrinneal@gmail.com [video_player] foundation - reduce seek accuracy to fix seek to end bug (flutter/packages#3784)
2023-05-11 stuartmorgan@google.com [image_picker] Fix use_build_context_synchronously violations (flutter/packages#3969)
2023-05-11 stuartmorgan@google.com [tool] Ensure that publish credential path is available (flutter/packages#3970)
2023-05-11 63286031+ahmednfwela@users.noreply.github.com [go_router] change `fix_data.yaml` uris to be absolute to fix lints (flutter/packages#3877)
2023-05-11 stuartmorgan@google.com [tool] Use new pub cache location for publish (flutter/packages#3962)
2023-05-10 engine-flutter-autoroll@skia.org Roll Flutter (stable) from f72efea to 84a1e90 (1920 revisions) (flutter/packages#3961)
2023-05-10 andrelvsousa@gmail.com [image_picker_android] Improved Bitmap resize on Android (flutter/packages#3423)
2023-05-10 43054281+camsim99@users.noreply.github.com [camerax] Add Kotlin duplicate classes known error to README.md (flutter/packages#3957)

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 flutter-ecosystem@google.com,rmistry@google.com 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://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
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
…stdlib (flutter#3960)

A fresh sample app that adds a dependency on the camerax implementation of the camera plugin will fail to build with an error about duplicate classes*. This PR adds a dependency on kotlin-bom to align versions of kotlin transitive dependencies that are used.

The idea for the fix comes [from here](https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7), which has some more discussion about the problem (but in a different context, unrelated to flutter).

\* The error looks like this:
```
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.5.30 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30)
     Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
...
```
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 p: camera platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants