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

Extract dependencies from Gradle Version Catalogs #3542

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fthomas
Copy link
Member

@fthomas fthomas commented Jan 13, 2025

This adds partial support for Gradle builds that use a version catalog (i.e. a gradle/libs.versions.toml file). Dependencies are extracted from the version catalog just by parsing the libs.versions.toml file. Since the version catalog only contains libraries and no resolvers, the default resolver is used for the Scope of these libraries.

The support is only partial, because

  • a default resolver is assumed (as mentioned above)
  • dependencies and plugins that are defined in other Gradle build files are ignored
  • additional version catalogs are ignored
  • a version catalog with a custom name is ignored

Closes: #3534

@fthomas fthomas added enhancement New feature or request cat:build-tool labels Jan 13, 2025
@fthomas fthomas added this to the 0.32.2 milestone Jan 13, 2025
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 98.52941% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.88%. Comparing base (757f9bb) to head (4b19b78).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...scalasteward/core/buildtool/gradle/GradleAlg.scala 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3542      +/-   ##
==========================================
+ Coverage   89.77%   89.88%   +0.10%     
==========================================
  Files         171      174       +3     
  Lines        4970     5022      +52     
  Branches      494      437      -57     
==========================================
+ Hits         4462     4514      +52     
  Misses        508      508              

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

This adds partial support for Gradle builds that use a [version
catalog](https://docs.gradle.org/current/userguide/version_catalogs.html)
(i.e. a `gradle/libs.versions.toml` file). Dependencies are extracted
from the version catalog just by parsing the `libs.versions.toml` file.
Since the version catalog only contains libraries and no resolvers, the
default resolver is used for the `Scope` of these libraries. This is
one reason why this Gradle support is only partial. The other is that
additional dependencies and plugins that are defined in other Gradle
build files are also ignored.

Closes: #3534
@fthomas fthomas force-pushed the topic/gradle-version-catalog branch from 0b02252 to 4b19b78 Compare January 13, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:build-tool enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract dependencies from Gradle Version Catalogs
1 participant