@@ -103,9 +103,7 @@ def _dupeclasses_rule_impl(ctx):
103
103
inputs = []
104
104
input_args = ctx .actions .args ()
105
105
106
- # inputs (dupe checker python script, spring boot jar file, ignorelist)
107
- inputs .append (ctx .attr .script .files .to_list ()[0 ])
108
- input_args .add (ctx .attr .script .files .to_list ()[0 ].path )
106
+ # inputs (spring boot jar file, ignorelist)
109
107
inputs .append (ctx .attr .springbootjar .files .to_list ()[0 ])
110
108
input_args .add (ctx .attr .springbootjar .files .to_list ()[0 ].path )
111
109
if ctx .attr .dupeclassescheck_ignorelist != None :
@@ -117,12 +115,9 @@ def _dupeclasses_rule_impl(ctx):
117
115
# add the output file to the args, so python script knows where to write result
118
116
input_args .add (output .path )
119
117
120
- # compute the location of python
121
- python_interpreter = _compute_python_executable (ctx )
122
-
123
118
# run the dupe checker
124
119
ctx .actions .run (
125
- executable = python_interpreter ,
120
+ executable = ctx . executable . script ,
126
121
outputs = outputs ,
127
122
inputs = inputs ,
128
123
arguments = [input_args ],
@@ -135,13 +130,16 @@ _dupeclasses_rule = rule(
135
130
implementation = _dupeclasses_rule_impl ,
136
131
attrs = {
137
132
"dupeclasses_rule" : attr .label (),
138
- "script" : attr .label (),
133
+ "script" : attr .label (
134
+ executable = True ,
135
+ cfg = "exec" ,
136
+ allow_files = True ,
137
+ ),
139
138
"springbootjar" : attr .label (),
140
- "dupeclassescheck_ignorelist" : attr .label (allow_files = True ),
139
+ "dupeclassescheck_ignorelist" : attr .label (allow_files = True ),
141
140
"dupeclassescheck_enable" : attr .bool (),
142
141
"out" : attr .string (),
143
142
},
144
- toolchains = ["@bazel_tools//tools/python:toolchain_type" ],
145
143
)
146
144
147
145
# ***************************************************************
@@ -159,9 +157,7 @@ def _javaxdetect_rule_impl(ctx):
159
157
inputs = []
160
158
input_args = ctx .actions .args ()
161
159
162
- # inputs (dupe checker python script, spring boot jar file, ignorelist)
163
- inputs .append (ctx .attr .script .files .to_list ()[0 ])
164
- input_args .add (ctx .attr .script .files .to_list ()[0 ].path )
160
+ # inputs (spring boot jar file, ignorelist)
165
161
inputs .append (ctx .attr .springbootjar .files .to_list ()[0 ])
166
162
input_args .add (ctx .attr .springbootjar .files .to_list ()[0 ].path )
167
163
if ctx .attr .javaxdetect_ignorelist != None :
@@ -173,12 +169,9 @@ def _javaxdetect_rule_impl(ctx):
173
169
# add the output file to the args, so python script knows where to write result
174
170
input_args .add (output .path )
175
171
176
- # compute the location of python
177
- python_interpreter = _compute_python_executable (ctx )
178
-
179
172
# run the dupe checker
180
173
ctx .actions .run (
181
- executable = python_interpreter ,
174
+ executable = ctx . executable . script ,
182
175
outputs = outputs ,
183
176
inputs = inputs ,
184
177
arguments = [input_args ],
@@ -191,31 +184,18 @@ _javaxdetect_rule = rule(
191
184
implementation = _javaxdetect_rule_impl ,
192
185
attrs = {
193
186
"javaxdetect_rule" : attr .label (),
194
- "script" : attr .label (),
187
+ "script" : attr .label (
188
+ executable = True ,
189
+ cfg = "exec" ,
190
+ allow_files = True ,
191
+ ),
195
192
"springbootjar" : attr .label (),
196
- "javaxdetect_ignorelist" : attr .label (allow_files = True ),
193
+ "javaxdetect_ignorelist" : attr .label (allow_files = True ),
197
194
"javaxdetect_enable" : attr .bool (),
198
195
"out" : attr .string (),
199
196
},
200
- toolchains = ["@bazel_tools//tools/python:toolchain_type" ],
201
197
)
202
198
203
- def _compute_python_executable (ctx ):
204
- python_interpreter = None
205
-
206
- # hard requirement on python3 being available
207
- python_runtime = ctx .toolchains ["@bazel_tools//tools/python:toolchain_type" ].py3_runtime
208
- if python_runtime != None :
209
- if python_runtime .interpreter != None :
210
- # registered python toolchain, or the Bazel python wrapper script (for system python)
211
- python_interpreter = python_runtime .interpreter
212
- elif python_runtime .interpreter_path != None :
213
- # legacy python only?
214
- python_interpreter = python_runtime .interpreter_path
215
-
216
- # print(python_interpreter)
217
- return python_interpreter
218
-
219
199
# ***************************************************************
220
200
# BANNED DEPS RULE
221
201
0 commit comments