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

hardcoded scala-library doesn't respect scala_version #1440

Open
dmivankov opened this issue Nov 1, 2022 · 2 comments
Open

hardcoded scala-library doesn't respect scala_version #1440

dmivankov opened this issue Nov 1, 2022 · 2 comments

Comments

@dmivankov
Copy link
Contributor

With

scala_config(scala_version = "2.13.9")

in WORKSPACE there is still 2.13.6 scala-library dependency

$ bazel query --output build //external:io_bazel_rules_scala_scala_library

jvm_import_external(
  name = "io_bazel_rules_scala_scala_library",
  generator_name = "io_bazel_rules_scala_scala_library",
  generator_function = "scala_repositories",
  rule_name = "scala_import",
  licenses = ["notice"],
  jar_urls = ["https://repo.maven.apache.org/maven2/org/scala-lang/scala-library/2.13.6/scala-library-2.13.6.jar", "https://maven-central.storage-download.googleapis.com/maven2/org/scala-lang/scala-library/2.13.6/scala-library-2.13.6.jar", "https://mirror.bazel.build/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.6/scala-library-2.13.6.jar", "https://jcenter.bintray.com/org/scala-lang/scala-library/2.13.6/scala-library-2.13.6.jar"],
  artifact_sha256 = "f19ed732e150d3537794fd3fe42ee18470a3f707efd499ecd05a99e727ff6c8a",
  rule_load = "load(\"@io_bazel_rules_scala//scala:scala_import.bzl\", \"scala_import\")",
  deps = [],
  runtime_deps = [],
  testonly_ = False,
)

and it ends up being present in the container images (along with scala-library pulled in via rules_jvm_external dependency in this case)

-r-xr-xr-x 0/0         5939419 1970-01-01 01:00 ./app/maven/v1/https/repo.maven.apache/maven2/org/org/scala-lang/scala-library/2.13.9/scala-library-2.13.9.jar
-r-xr-xr-x 0/0         5955737 1970-01-01 01:00 ./app/io_bazel_rules_scala_scala_library/scala-library-2.13.6.jar
@ddl-jbrown
Copy link

We got around this by doing an override

scala_version = "2.13.11"

scala_repositories(overriden_artifacts={
    "io_bazel_rules_scala_scala_library": {
        "artifact": "org.scala-lang:scala-library:%s" % scala_version,
        "sha256": "e6ca607c3fce03e8fa38af3374ce1f8bb098e316e8bf6f6d27331360feddb1c1",
    },
    "io_bazel_rules_scala_scala_compiler": {
        "artifact": "org.scala-lang:scala-compiler:%s" % scala_version,
        "sha256": "2cd4a964ea48e78c91a2a7b19c4fc67a9868728ace5ee966b1d498270b3c3aa7",
    },
    "io_bazel_rules_scala_scala_reflect": {
        "artifact": "org.scala-lang:scala-reflect:%s" % scala_version,
        "sha256": "62bd7a7198193c5373a992c122990279e413af3307162472a5d3cbb8ecadb35e",
    }
})

@mbland
Copy link
Contributor

mbland commented Feb 21, 2025

As I just mentioned in #1482 (comment), I'm pretty sure this is because rules_scala defines a particular patch release for each major version at the top of its third_party/repositories/scala_*.bzl files. If you specify a different scala_version, you'll need to provide those overridden_artifacts yourself, as in #1440 (comment).

I'll leave it up to @simuons and/or @liucijus to confirm and close this as WAI if this is correct.

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

3 participants