Skip to content

Conversation

@mbland
Copy link
Collaborator

@mbland mbland commented Oct 23, 2024

Description

Contains aliases to versioned Scala compiler source repository targets. Part of #1482.

Updates the version specific repo references in the srcs attribute of //third_party/dependency_analyzer/src/main/io/bazel/rulesscala/dependencyanalyzer/compiler:dep_reporting_compiler. Now these are references to versioned targets in
@scala_compiler_sources//, which are aliases to those versioned compiler source repos.

Motivation

In a Bzlmod world, this enables rules_scala to import only the scala_compiler_sources repo in MODULE.bazel, instead of importing each individual versioned compiler source repo.

This then allows rules_scala clients to set multiple SCALA_VERSIONS without requiring them to import this repo or any versioned compiler source repo. The Bzlmodifcation of the test repos under dt_patches (coming in a future change) revealed the need for this flexibility.

Contains aliases to versioned Scala compiler source repository targets.
Part of bazel-contrib#1482.

Updates the version specific repo references in the srcs attribute of
`//third_party/dependency_analyzer/src/main/io/bazel/rulesscala/dependencyanalyzer/compiler:dep_reporting_compiler`.
Now these are references to versioned targets in
`@scala_compiler_sources//`, which are aliases to those versioned
compiler source repos.

In a Bzlmod world, this enables `rules_scala` to import only the
`scala_compiler_sources` repo in `MODULE.bazel`, instead of importing
each individual versioned compiler source repo.

This then allows `rules_scala` clients to set multiple `SCALA_VERSIONS`
without requiring them to import this repo or any versioned compiler
source repo. The Bzlmodifcation of the test repos under `dt_patches`
(coming in a future change) revealed the need for this flexibility.

scala_library_for_plugin_bootstrapping(
name = "dep_reporting_compiler",
srcs = select({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you are hiding/unifying version specific repositories under @scala_compiler_sources maybe this select should be moved into that repository. I mean @scala_compiler_sources would have a single alias target with select to version specific sources. For example:

alias(
  name = "src",
  visibility = ["//visibility:public"],
  actual = select({"@io_bazel_rules_scala_config//:scala_version_2_12_19": "@scala_compiler_source_2_12_19//:src"}),
)

And here in compilation target you would specify srcs = ["@scala_compiler_sources//:src"],

What do you think?

Also I think that compilation target could go into that new repository, but let's not go down that rabbit hole now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like it. Done.

Copy link
Collaborator

@simuons simuons left a comment

Choose a reason for hiding this comment

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

Thanks, @mbland!

@simuons simuons merged commit ca27760 into bazel-contrib:master Oct 25, 2024
2 checks passed
@mbland mbland deleted the bzlmod-scala-compiler-sources-repo branch October 25, 2024 21:44
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

Successfully merging this pull request may close these issues.

2 participants