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

Support providing maven coordinates using libs.toml files #976

Open
Bencodes opened this issue Oct 11, 2023 · 3 comments
Open

Support providing maven coordinates using libs.toml files #976

Bencodes opened this issue Oct 11, 2023 · 3 comments

Comments

@Bencodes
Copy link
Contributor

Bencodes commented Oct 11, 2023

It would be great to support passing libs.toml files containing maven coordinates into rules_jvm_external.

Gradle already supports this format: https://docs.gradle.org/current/userguide/platforms.html#sub:conventional-dependencies-toml

I see a few benefits:

  • Would help improve dependency management and let tools like dependabot and renovate help manage automatically bumping version updates.
  • Would reduce the need to clutter our MODULE.bazel with giant lists of maven dependencies.

Potential issues:

  • Conveying attributes like testonly, neverlink, and packaging (aar|jar|...) might be harder. Technically this is supported by the Toml format already but we would need to document this.

Example:

# MODULE.bazel
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
    # Toml file containing all of the maven coords
    toml = "//:deps.toml",
)
# deps.toml
[versions]
androix-activity-version = "1.8.0"
androidx-experiemental-version = "1.3.0"
...

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", package = "aar", version.ref = "androix-activity-version" }
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", package = "aar", version.ref = "androix-activity-version" }
...
@shs96c
Copy link
Collaborator

shs96c commented Oct 12, 2023

Being able to pass in a file for listing dependencies is something we've discussed in order to make bzlmod support a bit cleaner. The constraint is that we'd like that file to be parseable in Starlark only, since this will be executed in a repository_rule, and external commands invoked in those are highly dependent on the user's configuration (rather than being part of a potentially hermetic build)

@shs96c
Copy link
Collaborator

shs96c commented Oct 12, 2023

The chances are that a JSON-based syntax will be used, though I can see the attraction of being able to inject Gradle's format, particularly when migrating projects.

@shs96c
Copy link
Collaborator

shs96c commented Oct 19, 2023

I'm planning the approach we could take to handling listing dependencies in an external file. Comments are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants