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

bzlmod: when root module overrides a namespace but doesn't change artifacts, do not emit a warning #1193

Open
brianantony456 opened this issue Jul 8, 2024 · 1 comment

Comments

@brianantony456
Copy link

brianantony456 commented Jul 8, 2024

Reproduced in examples bzlmod project

The documentation states that one can override the rules_jvm_external lock file with bzlmod, however we end up many warning during build.

bazel_dep(name = "rules_jvm_external", version = "6.2")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

# Repin everything with `REPIN=1 bazel run @maven_repo//:pin`
# Overwrite rules_jvm_external internal maven file
maven.install(
    name = "rules_jvm_external_deps",
    repositories = [
        "https://repo1.maven.org/maven2",
        "https://packages.atlassian.com/mvn/maven-atlassian-external/",
    ],
    lock_file = "//:rules_jvm_external_deps_install.json",
)

# Named as maven_repo to prevent conflict with protobuf's default "maven" repo name
maven.install(
    name = "maven_repo",
    artifacts = [
        # Obtained from: https://github.com/jflex-de/bazel_rules/blob/master/jflex/deps.bzl
        "de.jflex:jflex:jar:1.9.1",
        "com.github.vbmacher:java-cup-runtime:jar:11b-20160615-1",
    ],
    # Currently the sources are not required, enable if necessary.
    fetch_sources = False,
    # On change, comment out lock_file input, update file with: bazelisk run @maven//:pin
    lock_file = "//:maven_install.json",
    # TODO: DECIDE: Use only our internal repository which acts as a transparent proxy.
    repositories = [
        "https://repo1.maven.org/maven2",
        "https://packages.atlassian.com/mvn/maven-atlassian-external/",
    ],
)
use_repo(maven, "maven_repo")

Warnings thrown

DEBUG: /workspaces//483e35951be2410848d0b4cbe4058b2f/external/rules_jvm_external~6.2/private/extensions/maven.bzl:156:14: The maven repository 'rules_jvm_external_deps' is used in two different bazel modules, originally in 'example' and now in 'rules_jvm_external'
DEBUG: /workspaces/.bazel/483e35951be2410848d0b4cbe4058b2f/external/rules_jvm_external~6.2/private/extensions/maven.bzl:156:14: The maven repository 'rules_jvm_external_deps' is used in two different bazel modules, originally in 'example' and now in 'rules_jvm_external'
DEBUG: /workspaces//.bazel/483e35951be2410848d0b4cbe4058b2f/external/rules_jvm_external~6.2/private/extensions/maven.bzl:156:14: The maven repository 'rules_jvm_external_deps' is used in two different bazel modules, originally in 'example' and now in 'rules_jvm_external'

Bazel version

7.0.1

rules_jvm_external version

6.2

@shs96c shs96c changed the title with bzlmod overwriting the lock file of 'rules_jvm_external_deps_install.json' throws warnings bzlmod: when root module overrides a namespace but doesn't change artifacts, do not emit a warning Jul 9, 2024
@shs96c
Copy link
Collaborator

shs96c commented Jul 9, 2024

The warning is expected. Without it, there's no way to know that other modules are contributing to a particular set of artifacts being resolved. However, in this case, where the root module isn't contributing to the set of artifacts, perhaps it would be nicer to omit the warning. I'll retitle this issue, and add the concern to the design doc for module layering.

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