Skip to content

Migrate settings.gradle to KTS and add the dependency resolutions#2328

Merged
skydoves merged 2 commits into
mainfrom
kts/settings
Apr 4, 2025
Merged

Migrate settings.gradle to KTS and add the dependency resolutions#2328
skydoves merged 2 commits into
mainfrom
kts/settings

Conversation

@skydoves

@skydoves skydoves commented Apr 4, 2025

Copy link
Copy Markdown
Member

Motivation

Migrate settings.gradle to KTS and add the dependency resolutions.

The includeGroupByRegex function in Gradle's settings.gradle.kts file allows you to filter artifacts from a repository based on regular expressions applied to their group IDs. This is useful for selectively including or excluding dependencies from a repository, improving build performance by reducing the amount of metadata Gradle needs to process. For example, you might use it to only include Android-related libraries from Google's Maven repository.

By specifying a regular expression, you can target specific groups of artifacts. This is more flexible than simply including or excluding entire repositories, as it allows for fine-grained control over which dependencies are used in your project. The function is typically used within the content block of a repository definition in the pluginManagement section of the settings.gradle.kts file.

  • includeGroupByRegex("com\.google\.firebase(\..*|)"): Google Billing library basically depends on Firebase.
  • includeGroupByRegex("com\.google\.prefab"), includeGroupByRegex("com\.google\.testing\.platform"): Some Jetpack Android libraries depend on this.
  • includeGroupByRegex("com\.google\.crypto\..*"): Tink library.

@skydoves skydoves added the dependencies Pull requests that update a dependency file label Apr 4, 2025
@skydoves skydoves requested a review from a team April 4, 2025 01:01
@skydoves skydoves self-assigned this Apr 4, 2025

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good! Just a question

Comment thread settings.gradle.kts
includeGroupByRegex("com\\.google\\.firebase(\\..*|)")
includeGroupByRegex("com\\.google\\.gms(\\..*|)")
includeGroupByRegex("com\\.google\\.prefab")
includeGroupByRegex("com\\.google\\.testing\\.platform")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm I do wonder if it's worth adding this... Don't think we earn much and in case google adds some other dependency here that we need to include we would need to update this... But then again, a win is a win, and adding dependencies is probably not going to happen often, so I don't think it's a blocker 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you for reviewing this, Toni! This dependency filtering feature also helps prevent potential vulnerabilities caused by resolving incorrect artifacts since Gradle retrieves dependencies based on the order of declared repositories, so it may be more trustworthy for our customers. Now it's the default configuration as you can see it will be added automatically when you create a new Android project 😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yea I think the supply-chain vulnerability is a good reason to include this. Gradle Syncs should also be slightly faster, as it won't try to e.g. get Coil from the google repo (referring to dependencyResolutionManagement below).

I see Toni's point about potentially having to keep this up to date manually, but I'm assuming that any issues would be compile-time, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ohh I actually didn't know that, make sense, thank you for explaining! This makes sense then 👍

And yeah, if there are any issues, I would assume them to be at compile-time so I don't think it would be a bit issue at all. Let's ship this! 💪

@JayShortway JayShortway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Much better! Thanks for taking care of this!

Comment thread settings.gradle.kts
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

YES

Comment thread settings.gradle.kts
includeGroupByRegex("com\\.google\\.firebase(\\..*|)")
includeGroupByRegex("com\\.google\\.gms(\\..*|)")
includeGroupByRegex("com\\.google\\.prefab")
includeGroupByRegex("com\\.google\\.testing\\.platform")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yea I think the supply-chain vulnerability is a good reason to include this. Gradle Syncs should also be slightly faster, as it won't try to e.g. get Coil from the google repo (referring to dependencyResolutionManagement below).

I see Toni's point about potentially having to keep this up to date manually, but I'm assuming that any issues would be compile-time, right?

@skydoves skydoves enabled auto-merge April 4, 2025 11:49
@skydoves skydoves added this pull request to the merge queue Apr 4, 2025
@codecov

codecov Bot commented Apr 4, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.34%. Comparing base (3f11b50) to head (2cd1820).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2328   +/-   ##
=======================================
  Coverage   80.34%   80.34%           
=======================================
  Files         281      281           
  Lines        9964     9964           
  Branches     1417     1417           
=======================================
  Hits         8006     8006           
  Misses       1346     1346           
  Partials      612      612           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Merged via the queue into main with commit 28ccb4b Apr 4, 2025
@skydoves skydoves deleted the kts/settings branch April 4, 2025 16:50
github-merge-queue Bot pushed a commit that referenced this pull request Apr 15, 2025
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* Add missing response fields to `CustomerInfo`. Including transaction
Prices (#2128) via Cesar de la Vega (@vegaro)

## RevenueCatUI SDK
### Paywallv2
#### 🐞 Bugfixes
* [Paywalls v2] Fixes timeline layout when width is Fit (#2354) via
JayShortway (@JayShortway)
* [Paywalls V2] Improves fuzzy matching locale when the region doesn't
match (#2355) via JayShortway (@JayShortway)
* [Paywalls V2] Norwegian Bokmål and Norwegian Nynorsk fall back to
Norwegian. (#2329) via JayShortway (@JayShortway)
### Customer Center
#### 🐞 Bugfixes
* Clean up on restoring functionality in customer center (#2316) via
Cesar de la Vega (@vegaro)

### 🔄 Other Changes
* [Paywalls v2] Adds the unsupported Background type to the error
message (#2350) via JayShortway (@JayShortway)
* [Paywalls v2] Uses a fixed date for template previews to avoid daily
changes. (#2351) via JayShortway (@JayShortway)
* [Paywalls v2] Adds a default case to `Background` and
`ButtonComponent` (#2347) via JayShortway (@JayShortway)
* [Paywalls v2] Improves `PaywallComponentsTemplatePreviewRecorder`
stability (#2352) via JayShortway (@JayShortway)
* [Paywalls v2] Adds a default case to most enums and sealed types
(#2346) via JayShortway (@JayShortway)
* Adds `EnumDeserializerWithDefault` and `SealedDeserializerWithDefault`
(#2345) via JayShortway (@JayShortway)
* [Paywalls V2] Renders template previews in a fixed resolution using
Paparazzi (#2214) via JayShortway (@JayShortway)
* Bump fastlane from 2.227.0 to 2.227.1 (#2344) via dependabot[bot]
(@dependabot[bot])
* Migrate root gradle file to KTS (#2343) via Jaewoong Eum (@skydoves)
* Migrate tester modules to KTS format (#2340) via Jaewoong Eum
(@skydoves)
* Introduce purchases-bom package (#2339) via Jaewoong Eum (@skydoves)
* [AUTOMATIC][Paywalls V2] Updates paywall-preview-resources submodule
(#2338) via RevenueCat Git Bot (@RCGitBot)
* [Diagnostics] Removes Android 7 requirement (#2335) via JayShortway
(@JayShortway)
* [Paywalls v2] Fixes `update-paywall-preview-resources-submodule` CI
job (#2337) via JayShortway (@JayShortway)
* Make purchases module to transitive dependency for the ui module
(#2334) via Jaewoong Eum (@skydoves)
* Migrate settings.gradle to KTS and add the dependency resolutions
(#2328) via Jaewoong Eum (@skydoves)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants