@@ -16,8 +16,8 @@ DependencyLevelInfo = provider(
1616 fields = {
1717 "level" : "Dependency level (0=internal, 1=prod, 2=safe, None=no level)" ,
1818 "portable" : "Whether the target is portable" ,
19- "label" : "The target's label"
20- }
19+ "label" : "The target's label" ,
20+ },
2121)
2222
2323def _get_coding_level_from_tags (tags ):
@@ -76,7 +76,7 @@ def _check_allowed_cc_deps_impl(target, ctx):
7676 return [DependencyLevelInfo (
7777 level = None ,
7878 portable = current_portable ,
79- label = label_str
79+ label = label_str ,
8080 )]
8181
8282 # Check dependencies
@@ -104,7 +104,7 @@ def _check_allowed_cc_deps_impl(target, ctx):
104104 target .label ,
105105 _level_to_str (current_level ),
106106 dep_info .label ,
107- _level_to_str (dep_level )
107+ _level_to_str (dep_level ),
108108 )
109109 fail (error_msg )
110110
@@ -113,30 +113,31 @@ def _check_allowed_cc_deps_impl(target, ctx):
113113 error_msg = ("ERROR: Target {} is marked as portable but depends on {} which is not portable. " +
114114 "Portable targets can only depend on other portable targets." ).format (
115115 target .label ,
116- dep_info .label
116+ dep_info .label ,
117117 )
118118 fail (error_msg )
119119
120120 # Return provider for this target
121121 return [DependencyLevelInfo (
122122 level = current_level ,
123123 portable = current_portable ,
124- label = label_str
124+ label = label_str ,
125125 )]
126126
127127check_allowed_cc_deps = aspect (
128128 implementation = _check_allowed_cc_deps_impl ,
129129 attr_aspects = ["deps" ],
130- attrs = {}
130+ attrs = {},
131131)
132132
133133def _validate_allowed_deps_rule_impl (ctx ):
134134 """Rule that applies the validation aspect to specified targets."""
135+
135136 # This rule doesn't produce any output, it just triggers the aspect
136137 output = ctx .actions .declare_file (ctx .label .name + ".validation" )
137138 ctx .actions .write (
138139 output = output ,
139- content = "Allowed C/C++ dependency validation passed\n "
140+ content = "Allowed C/C++ dependency validation passed\n " ,
140141 )
141142 return [DefaultInfo (files = depset ([output ]))]
142143
@@ -145,10 +146,10 @@ validate_allowed_cc_deps = rule(
145146 attrs = {
146147 "targets" : attr .label_list (
147148 aspects = [check_allowed_cc_deps ],
148- doc = "Targets to validate"
149- )
149+ doc = "Targets to validate" ,
150+ ),
150151 },
151- doc = "Validates allowed C/C++ dependencies for specified targets"
152+ doc = "Validates allowed C/C++ dependencies for specified targets" ,
152153)
153154
154155def validate_all_allowed_cc_deps (name , targets = ["//..." ]):
@@ -161,5 +162,5 @@ def validate_all_allowed_cc_deps(name, targets = ["//..."]):
161162 validate_allowed_cc_deps (
162163 name = name ,
163164 targets = targets ,
164- tags = ["manual" ] # Don't build by default, only when explicitly requested
165+ tags = ["manual" ], # Don't build by default, only when explicitly requested
165166 )
0 commit comments