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

Dependency updates for v2024.4 #6505

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Nov 12, 2024

Why is this the best possible solution? Were any other approaches considered?

As usual, I've updated the dependencies for the next release. However, this time, there are some significant changes in addition to the regular updates:

  • Switched to Gradle Version Catalog: Dependency management now uses the Gradle Version Catalog, which is the default approach for managing dependencies in new projects. It offers several advantages over the previous buildSrc module, such as faster project builds when dependencies are changed and notifications about new available versions. For details, see this commit.
  • Migrated to FusedLocationProviderClient: This migration was necessary to update the play-services-location library. For more information, see this commit.
  • Reviewed and Fixed Some PMD Rules: Over the last few dependency updates, we had disabled some new PMD rules. After a review, I re-enabled a few of them. However, others were left disabled as they either don’t make much sense, would require extensive edits across hundreds of classes, or are faulty and don’t work as intended.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

It's often challenging to determine what should be tested when multiple dependencies are updated. However, in this case, I can highlight one area: location recording. As mentioned earlier, we switched to a new location provider, which could be a potential source of bugs. In fact, this is our second attempt at the migration, as the first one failed due to this issue: #6027. Hopefully, everything will go smoothly this time.

Do we need any specific form for testing your changes? If so, please attach one.

A form with a few geopints might be helpful for testing reading locations:
geo5.xlsx

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 force-pushed the dependency_updates_for_v2024.4 branch 30 times, most recently from 1bafc27 to 2068f65 Compare November 14, 2024 18:03
@grzesiek2010 grzesiek2010 marked this pull request as ready for review November 19, 2024 19:10
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

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

Loving the change to version catalog! I used it recently on a different app and thought it was so much nicer, but definitely a pain to convert to. Thanks for taking the time to do that.

[plugins]
androidApplication = { id = "com.android.application" }
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to declare the plugin versions here so we don't still need these declared in the root build.gradle?

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, I even attempted to do that, but since it was quite complex (requiring a lot of additional changes) and some of the functions I would need to use are still marked as unstable, I decided to hold off for now.

}

apply(from = "../config/quality.gradle")

android {
compileSdk = Versions.android_compile_sdk
compileSdk = libs.versions.compileSdk.get().toInt()
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking it might make sense to still declare the compile/target/mid SDKs in as constants in Gradle (example below). It doesn't seem like version catalog lets us define integer values. They're also more like shared configuration than library versions.

buildscript {
    ext {
        minSdkVersion = 21
        targetSdkVersion = 34
        compileSdkVersion = 34
    }
...

Copy link
Member Author

Choose a reason for hiding this comment

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

In kotlin DSL this would be like this:

    compileSdk = rootProject.extra["compileSdkVersion"] as Int

so it would also require casting to Int. Given that I don't think this approach would be any better.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, wow. Kotlin makes that much worse - in Groovy it'd be rootProject.ext.minSdkVersion. Let's leave it as-is then.

* Should be used whenever Google Play Services is present. In general, use
* [LocationClientProvider] to retrieve a configured [LocationClient].
*/
class GoogleFusedLocationClient(
Copy link
Member

Choose a reason for hiding this comment

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

Did any changes get made to GoogleFusedLocationClient or its test? Because the Kotlin version happens in the same commit, the diff doesn't give me any insight into that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes, there are some changes because the old provider used different listeners, so the file structure has changed slightly. The file isn't large, so hopefully comparing it with the old one shouldn't be difficult.

@seadowg
Copy link
Member

seadowg commented Nov 26, 2024

@getodk/testers I think it's worth testing location tracking (background, maps etc) before merging this as we've made changes to how we interact with location services.

@dbemke
Copy link

dbemke commented Nov 26, 2024

@grzesiek2010 Could you send us (in Slack) the apk with access to different maps sources?

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.

3 participants