Skip to content

Conversation

@yaakovschectman
Copy link
Contributor

Tests in the title package that are run using the Robolectric test runner will now run on all SDKs level >= LOLLIPOP (i.e. 21). Raises max heap size to 1G.

Affects only tests, should be version-bump exempt.

Fixes flutter/flutter#152931

Pre-launch Checklist

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

@yaakovschectman
Copy link
Contributor Author

https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#version states PRs that only affect tests are exempt from versioning changes.

@yaakovschectman yaakovschectman added the override: no versioning needed Override the check requiring version bumps for most changes label Oct 7, 2024
@stuartmorgan-g stuartmorgan-g added the override: no changelog needed Override the check requiring CHANGELOG updates for most changes label Oct 7, 2024
outputs.upToDateWhen {false}
showStandardStreams = true
}
jvmArgs "-Xmx1g"
Copy link
Contributor

@reidbaker reidbaker Oct 7, 2024

Choose a reason for hiding this comment

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

Good find but instead of setting the jvm args in build.gradle set them in gradle.properties like we do in the rest of the places we bump memory.

For this pr I think you need to create a gradle.properties and put this value there.

Here is an example from where daco bumped the memory used in the templates. https://github.com/flutter/flutter/pull/156201/files

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 whatever it's worth, this approach is what the other packages, or at least those I looked at, do, and is how I found this fix initially.

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/search?q=repo%3Aflutter%2Fpackages%20jvmArgs%20%22-Xmx1g%22&type=code
I see one example. Can you modify camera and this pr to use gradle.properties?

Copy link
Contributor

Choose a reason for hiding this comment

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

The reasoning is that keeping track of memory allocation is hard enough as a class of problem and having 2 different ways we do it makes it even harder. Especially because properties clober each other so any jvm args set in one place will be overridden in the second place.

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 may be misunderstanding the actual use of this. Creating gradle.properties in the same path as this build.gradle file and populating it with org.gradle.jvmargs=-Xmx1G (and removing the added line from build.gradle) reintroduces the OOM that was the issue in the first place. And trying instead to set the property android.testOptions.unitTests.all.jvmArgs in gradle.properties also does not resolve the OOM error, either. It at least appears that whatever is set in gradle.properties is not impacting the android unit tests the way build.gradle does.

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've added a comment explaining this. Please see if it warrants an LGTM or further requests.

@yaakovschectman yaakovschectman marked this pull request as ready for review October 7, 2024 18:26
@yaakovschectman yaakovschectman requested review from a team and gmackall October 15, 2024 10:21
Copy link
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

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

Thanks for finding this! Optionally can you add the same comment to camera where you found the first example.

@yaakovschectman yaakovschectman merged commit 8be261c into flutter:main Oct 18, 2024
@yaakovschectman yaakovschectman deleted the maps_minsdk branch October 18, 2024 18:01
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 21, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 21, 2024
flutter/packages@2a1c477...b6f7e47

2024-10-21 49699333+dependabot[bot]@users.noreply.github.com [path_provider]: Bump androidx.annotation:annotation from 1.8.2 to 1.9.0 in /packages/path_provider/path_provider_android/android (flutter/packages#7895)
2024-10-18 [email protected] [in_app_purchase] Update iOS Pigeon for non-nullable generics (flutter/packages#7820)
2024-10-18 [email protected] [interactive_media_ads] Adds internal wrapper for Android native `Ad` (flutter/packages#7880)
2024-10-18 [email protected] [video_player] Remove Android API 19 SSL handling (flutter/packages#7876)
2024-10-18 [email protected] [google_maps_android_flutter] Convert `Config.sdk` to `minSdk` in Robolectric tests and lower to `LOLLIPOP` (flutter/packages#7805)

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] 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

Labels

override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: camera p: google_maps_flutter platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[google_maps_android] Update robolectric tests to run against minSdk version instead of sdk and lower that sdk version to the oldest supported.

3 participants