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

Create the @scala_compiler_sources repo #1635

Merged
merged 2 commits into from
Oct 25, 2024

Conversation

mbland
Copy link
Contributor

@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 bazelbuild#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.
@@ -5,7 +5,9 @@ load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "version_suffix")
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
Contributor 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 bazelbuild: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