Skip to content

Commit c789cb0

Browse files
committed
Remove testing parameter from scala_toolchains
Removed in favor of using the existing `scalatest`, `junit`, and `specs2` parameters at @simuons's suggestion in: - #1482 (comment) Also updated the `scala_toolchains()` docstring slightly and added `doc` parameters to the `attrs` for `_scala_toolchains_repo()`.
1 parent b06363e commit c789cb0

File tree

4 files changed

+42
-30
lines changed

4 files changed

+42
-30
lines changed

WORKSPACE

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ load("//scala:toolchains.bzl", "scala_register_toolchains", "scala_toolchains")
5555
scala_toolchains(
5656
fetch_sources = True,
5757
jmh = True,
58+
junit = True,
5859
scala_proto = True,
5960
scalafmt = True,
60-
testing = True,
61+
scalatest = True,
62+
specs2 = True,
6163
twitter_scrooge = True,
6264
)
6365

examples/testing/multi_frameworks_toolchain/WORKSPACE

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ load(
6060

6161
scala_toolchains(
6262
fetch_sources = True,
63-
testing = True,
63+
junit = True,
64+
scalatest = True,
65+
specs2 = True,
6466
)
6567

6668
register_toolchains(":testing_toolchain")

scala/toolchains.bzl

+2-10
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def scala_toolchains(
3939
scalatest = False,
4040
junit = False,
4141
specs2 = False,
42-
testing = False,
4342
scalafmt = False,
4443
scalafmt_default_config_path = ".scalafmt.conf",
4544
scala_proto = False,
@@ -78,19 +77,17 @@ def scala_toolchains(
7877
compiler srcjar metadata dictionaries containing:
7978
- exactly one "label", "url", or "urls" key
8079
- optional "integrity" or "sha256" keys
81-
scalatest: whether to instantiate the Scalatest toolchain
80+
scalatest: whether to instantiate the ScalaTest toolchain
8281
junit: whether to instantiate the JUnit toolchain
8382
specs2: whether to instantiate the Specs2 JUnit toolchain
84-
testing: whether to instantiate the Scalatest, JUnit, and Specs2 JUnit
85-
toolchains combined
8683
scalafmt: whether to instantiate the Scalafmt toolchain
8784
scalafmt_default_config_path: the relative path to the default Scalafmt
8885
config file within the repository
8986
scala_proto: whether to instantiate the scala_proto toolchain
9087
scala_proto_enable_all_options: whether to instantiate the scala_proto
9188
toolchain with all options enabled; `scala_proto` must also be
9289
`True` for this to take effect
93-
jmh: whether to instantiate the jmh toolchain
90+
jmh: whether to instantiate the Java Microbenchmarks Harness toolchain
9491
twitter_scrooge: whether to instantiate the twitter_scrooge toolchain
9592
twitter_scrooge_deps: dictionary of string to Label containing overrides
9693
for twitter_scrooge toolchain dependency providers with keys:
@@ -114,10 +111,6 @@ def scala_toolchains(
114111
scalafmt_conf_target = "//:" + scalafmt_default_config_path
115112
scalafmt_config(name = "scalafmt_default", path = scalafmt_conf_target)
116113

117-
if testing:
118-
scalatest = True
119-
junit = True
120-
specs2 = True
121114
if specs2:
122115
junit = True
123116

@@ -185,7 +178,6 @@ def scala_toolchains(
185178
scalatest = scalatest,
186179
junit = junit,
187180
specs2 = specs2,
188-
testing = testing,
189181
scalafmt = scalafmt,
190182
scala_proto = scala_proto,
191183
scala_proto_enable_all_options = scala_proto_enable_all_options,

scala/toolchains_repo.bzl

+34-18
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
def _generate_testing_toolchain_build_file_args(repo_attr):
44
framework_deps = {}
55

6-
if repo_attr.testing:
7-
framework_deps = {
8-
"scalatest": "SCALATEST_DEPS",
9-
"junit": "JUNIT_DEPS",
10-
"specs2": "SPECS2_DEPS",
11-
"specs2_junit": "SPECS2_JUNIT_DEPS",
12-
}
136
if repo_attr.scalatest:
147
framework_deps["scalatest"] = "SCALATEST_DEPS"
158
if repo_attr.specs2:
@@ -92,18 +85,41 @@ _scala_toolchains_repo = repository_rule(
9285
implementation = _scala_toolchains_repo_impl,
9386
doc = "Creates a repo containing Scala toolchain packages",
9487
attrs = {
95-
"scala": attr.bool(default = True),
96-
"scalatest": attr.bool(),
97-
"junit": attr.bool(),
98-
"specs2": attr.bool(),
99-
"testing": attr.bool(),
100-
"scalafmt": attr.bool(),
101-
"scala_proto": attr.bool(),
102-
"scala_proto_enable_all_options": attr.bool(),
103-
"jmh": attr.bool(),
104-
"twitter_scrooge": attr.bool(),
88+
"scala": attr.bool(
89+
doc = "Instantiate the Scala compiler toolchain",
90+
default = True,
91+
),
92+
"scalatest": attr.bool(doc = "Instantiate the ScalaTest toolchain"),
93+
"junit": attr.bool(doc = "Instantiate the JUnit toolchain"),
94+
"specs2": attr.bool(doc = "Instantiate the Specs2 toolchain"),
95+
"scalafmt": attr.bool(doc = "Instantiate the Scalafmt toolchain"),
96+
"scala_proto": attr.bool(
97+
doc = "Instantiate the scala_proto toolchain",
98+
),
99+
"scala_proto_enable_all_options": attr.bool(
100+
doc = (
101+
"Enable all scala_proto_options; " +
102+
"scala_proto must also be True for this to take effect"
103+
),
104+
),
105+
"jmh": attr.bool(
106+
doc = "Instantiate the Java Microbenchmarks Harness toolchain",
107+
),
108+
"twitter_scrooge": attr.bool(
109+
doc = "Instantiate the twitter_scrooge toolchain",
110+
),
105111
# attr.string_keyed_label_dict isn't available in Bazel 6
106-
"twitter_scrooge_deps": attr.string_dict(),
112+
"twitter_scrooge_deps": attr.string_dict(
113+
doc = (
114+
"overrides for twitter_scrooge toolchain dependency " +
115+
"providers with keys:\n" +
116+
" libthrift\n" +
117+
" scrooge_core\n" +
118+
" scrooge_generator\n" +
119+
" util_core\n" +
120+
" util_logging"
121+
),
122+
),
107123
},
108124
)
109125

0 commit comments

Comments
 (0)