From 69397539621ede39ffe8170e21fb000eca8a46e0 Mon Sep 17 00:00:00 2001 From: Jaden Peterson Date: Fri, 23 Aug 2024 15:30:21 -0400 Subject: [PATCH] Removed reconfigure_deps_configuration --- rules/providers.bzl | 38 ------------------------ tests/dependencies/indirect/BUILD | 49 +++++++++++++++++++++---------- tests/scala/BUILD | 6 ---- 3 files changed, 34 insertions(+), 59 deletions(-) diff --git a/rules/providers.bzl b/rules/providers.bzl index 9da344e9..cf871f13 100644 --- a/rules/providers.bzl +++ b/rules/providers.bzl @@ -52,44 +52,6 @@ ScalaRulePhase = provider( }, ) -def _reconfigure_deps_configuration_implementation(ctx): - original_config = ctx.attr.provider[DepsConfiguration] - - direct = original_config.direct - if ctx.attr.direct != "inherit": - direct = ctx.attr.direct - used = original_config.used - if ctx.attr.used != "inherit": - used = ctx.attr.used - - providers = [DepsConfiguration( - direct = direct, - used = used, - worker = original_config.worker, - )] - if ScalaConfiguration in ctx.attr.provider: - providers += [ctx.attr.provider[ScalaConfiguration]] - if ZincConfiguration in ctx.attr.provider: - providers += [ctx.attr.provider[ZincConfiguration]] - if ScalaRulePhase in ctx.attr.provider: - providers += [ctx.attr.provider[ScalaRulePhase]] - - return providers - -reconfigure_deps_configuration = rule( - attrs = { - "provider": attr.label( - mandatory = True, - providers = [ - [DepsConfiguration], - ], - ), - "direct": attr.string(default = "inherit"), - "used": attr.string(default = "inherit"), - }, - implementation = _reconfigure_deps_configuration_implementation, -) - ZincInfo = provider( doc = "Zinc-specific outputs.", fields = { diff --git a/tests/dependencies/indirect/BUILD b/tests/dependencies/indirect/BUILD index fa39887c..e92c9216 100644 --- a/tests/dependencies/indirect/BUILD +++ b/tests/dependencies/indirect/BUILD @@ -1,57 +1,76 @@ -load("@rules_scala_annex//rules:providers.bzl", "reconfigure_deps_configuration") +load("@rules_scala_annex//rules:register_toolchain.bzl", "register_zinc_toolchain") load("@rules_scala_annex//rules:scala.bzl", "scala_library") +load("@rules_scala_annex//rules/scala:workspace.bzl", "scala_2_13_version") # used_deps off -reconfigure_deps_configuration( - name = "scala_used_deps_off", - provider = "//scala:2_13", - used = "off", +register_zinc_toolchain( + name = "test_zinc_2_13_used_deps_off", + compiler_bridge = "@annex//:org_scala_sbt_compiler_bridge_2_13", + compiler_classpath = [ + "@annex//:org_scala_lang_scala_compiler", + "@annex//:org_scala_lang_scala_reflect", + "@annex//:org_scala_lang_scala_library", + ], + deps_used = "off", + global_scalacopts = ["-Ytasty-reader"], + runtime_classpath = ["@annex//:org_scala_lang_scala_library"], + version = scala_2_13_version, + visibility = ["//visibility:public"], ) scala_library( name = "used_deps_off_a", srcs = ["A.scala"], - scala = ":scala_used_deps_off", + scala_toolchain_name = "test_zinc_2_13_used_deps_off", ) scala_library( name = "used_deps_off_b", srcs = ["B.scala"], - scala = ":scala_used_deps_off", + scala_toolchain_name = "test_zinc_2_13_used_deps_off", deps = [":used_deps_off_a"], ) scala_library( name = "used_deps_off_c", srcs = ["C.scala"], - scala = ":scala_used_deps_off", + scala_toolchain_name = "test_zinc_2_13_used_deps_off", deps = [":used_deps_off_b"], ) # direct_deps off -reconfigure_deps_configuration( - name = "scala_direct_deps_off", - direct = "off", - provider = "//scala:2_13", +register_zinc_toolchain( + name = "test_zinc_2_13_direct_deps_off", + compiler_bridge = "@annex//:org_scala_sbt_compiler_bridge_2_13", + compiler_classpath = [ + "@annex//:org_scala_lang_scala_compiler", + "@annex//:org_scala_lang_scala_reflect", + "@annex//:org_scala_lang_scala_library", + ], + deps_direct = "off", + global_scalacopts = ["-Ytasty-reader"], + runtime_classpath = ["@annex//:org_scala_lang_scala_library"], + version = scala_2_13_version, + visibility = ["//visibility:public"], ) scala_library( name = "direct_deps_off_a", srcs = ["A.scala"], - scala = ":scala_direct_deps_off", + scala_toolchain_name = "test_zinc_2_13_direct_deps_off", ) scala_library( name = "direct_deps_off_b", srcs = ["B.scala"], - scala = ":scala_direct_deps_off", + scala_toolchain_name = "test_zinc_2_13_direct_deps_off", deps = [":direct_deps_off_a"], ) scala_library( name = "direct_deps_off_c", srcs = ["C.scala"], - scala = ":scala_direct_deps_off", + scala_toolchain_name = "test_zinc_2_13_direct_deps_off", deps = [":direct_deps_off_b"], ) diff --git a/tests/scala/BUILD b/tests/scala/BUILD index 71271d16..3bf185d8 100644 --- a/tests/scala/BUILD +++ b/tests/scala/BUILD @@ -7,12 +7,6 @@ load("@rules_scala_annex//rules:scala.bzl", "scala_library") load("@rules_scala_annex//rules/scala:workspace.bzl", "scala_2_13_version", "scala_3_version") load("@rules_scala_annex//rules/scala:workspace_2_12.bzl", "scala_2_12_version") -alias( - name = "2_13", - actual = ":zinc_2_13", - visibility = ["//visibility:public"], -) - # zinc 2.12 compiler_classpath_2_12 = [