1919 _phase_coverage_jacoco = "phase_coverage_jacoco" ,
2020 _phase_ijinfo = "phase_ijinfo" ,
2121 _phase_javainfo = "phase_javainfo" ,
22+ _phase_labeledjars = "phase_labeledjars" ,
2223 _phase_library_defaultinfo = "phase_library_defaultinfo" ,
2324 _phase_outputgroupinfo = "phase_outputgroupinfo" ,
2425 _phase_resources = "phase_resources" ,
@@ -75,7 +76,19 @@ _compile_private_attributes = {
7576 ),
7677}
7778
78- _compile_attributes = {
79+ _deps_checker_label_attributes = {
80+ "deps_checker_label" : attr .string (
81+ doc = """\
82+ The label to identify this target in the output of the dependency checker.
83+
84+ By default, this is just the label of the target. But sometimes—for example, when overriding an artifact with
85+ `rules_jvm_external` to point to your own, or defining an alias to target—you want the dependency checker to suggest
86+ you add or remove a different label as a dependency. In that case, you can set this attribute to that label.
87+ """ ,
88+ ),
89+ }
90+
91+ _compile_attributes = _deps_checker_label_attributes | {
7992 "srcs" : attr .label_list (
8093 cfg = _scala_outgoing_transition ,
8194 doc = "The source Scala and Java files (and `-sources.jar` `.srcjar` `-src.jar` files of those)." ,
@@ -213,6 +226,7 @@ def _scala_library_implementation(ctx):
213226 ("resources" , _phase_resources ),
214227 ("classpaths" , _phase_classpaths ),
215228 ("javainfo" , _phase_javainfo ),
229+ ("labeledjars" , _phase_labeledjars ),
216230 ("semanticdb" , _phase_semanticdb ),
217231 ("singlejar" , _phase_singlejar ),
218232 ("coverage" , _phase_coverage_jacoco ),
@@ -227,6 +241,7 @@ def _scala_binary_implementation(ctx):
227241 ("resources" , _phase_resources ),
228242 ("classpaths" , _phase_classpaths ),
229243 ("javainfo" , _phase_javainfo ),
244+ ("labeledjars" , _phase_labeledjars ),
230245 ("semanticdb" , _phase_semanticdb ),
231246 ("singlejar" , _phase_singlejar ),
232247 ("coverage" , _phase_coverage_jacoco ),
@@ -242,6 +257,7 @@ def _scala_test_implementation(ctx):
242257 ("resources" , _phase_resources ),
243258 ("classpaths" , _phase_classpaths ),
244259 ("javainfo" , _phase_javainfo ),
260+ ("labeledjars" , _phase_labeledjars ),
245261 ("semanticdb" , _phase_semanticdb ),
246262 ("singlejar" , _phase_singlejar ),
247263 ("coverage" , _phase_coverage_jacoco ),
@@ -458,6 +474,7 @@ To run: `bazel run <target>`
458474scala_import = rule (
459475 attrs = _dicts .add (
460476 _scala_import_private_attributes ,
477+ _deps_checker_label_attributes ,
461478 {
462479 "deps" : attr .label_list (
463480 doc = "Libraries used by this one." ,
0 commit comments