-
-
Notifications
You must be signed in to change notification settings - Fork 287
Open
Labels
Description
I want to customize the scalafmt phase. I don't understand how to actually customize configuration settings, such as the scalafmt config.
The current definition is this:
ext_scalafmt = {
"attrs": {
"config": attr.label(
allow_single_file = [".conf"],
default = "@scalafmt_default//:config",
doc = "The Scalafmt configuration file.",
),
"format": attr.bool(
default = False,
doc = "Switch of enabling formatting.",
),
"_fmt": attr.label(
cfg = "host",
default = "//scala/scalafmt",
executable = True,
),
"_runner": attr.label(
allow_single_file = True,
default = "//scala/scalafmt:runner",
),
"_testrunner": attr.label(
allow_single_file = True,
default = "//scala/scalafmt:testrunner",
),
},
"outputs": {
"scalafmt_runner": "%{name}.format",
"scalafmt_testrunner": "%{name}.format-test",
},
"phase_providers": [
"//scala/scalafmt:phase_scalafmt",
],
}
Am I supposed to be able to override the default values somehow? Or is default actually used to set the configuration value, and isn't supposed to be modifiable later? I couldn't find any guidance in the documentation.
Currently, my solution is to make my own version of ext_scalafmt, using different values for default. Is that correct?
my_ext_scalafmt = {
"attrs": {
"config": attr.label(
allow_single_file = [".conf"],
default = "//my/new/config,
doc = "The Scalafmt configuration file.",
),
...
},
...
}
_scala_macro_library = make_scala_macro_library(my_ext_scalafmt)