@@ -74,10 +74,10 @@ def _mk_attrs():
74
74
attrs = {
75
75
"sourcepaths" : attr .string_list (mandatory = False ),
76
76
"groups" : attr .string_dict (),
77
- "java_tool " : attr .label (
78
- default = Label ("@local_jdk//:java " ),
77
+ "javadoc_tool " : attr .label (
78
+ default = Label ("@local_jdk//:bin/javadoc " ),
79
79
single_file = True ,
80
- executable = True ,
80
+ allow_files = True ,
81
81
cfg = "host" ,
82
82
),
83
83
"tools_jar" : attr .label (
@@ -132,12 +132,6 @@ def _get_java_dep_jars(deps):
132
132
return jars
133
133
134
134
135
- def _get_javadoc_tool (java_tool ):
136
- javadoc = java_tool .dirname + "/javadoc"
137
- if java_tool .basename .endswith (".exe" ):
138
- javadoc += ".exe"
139
- return javadoc
140
-
141
135
142
136
def _get_output_index_html (ctx , outdir ):
143
137
filename = "index.html"
@@ -155,16 +149,15 @@ def _javadoc_impl(ctx):
155
149
#
156
150
# Preparation of inputs and dependencies.
157
151
#
158
- java = ctx .executable .java_tool
159
- javadoc = _get_javadoc_tool (java )
152
+ javadoc = ctx .file .javadoc_tool
160
153
jars = _get_java_dep_jars (ctx .attr .deps )
161
154
jars .append (ctx .file .tools_jar )
162
155
doclet_jars = _get_java_dep_jars (ctx .attr .doclet_deps )
163
156
taglet_jars = _get_java_dep_jars (ctx .attr .taglet_deps )
164
157
srcfiles = ctx .files .srcs
165
158
index_html = _get_output_index_html (ctx , ctx .attr .outdir )
166
159
all_jars = jars + doclet_jars + taglet_jars
167
- inputs = [java ] + all_jars + srcfiles
160
+ inputs = [javadoc ] + all_jars + srcfiles
168
161
169
162
#
170
163
# Command generation.
@@ -173,7 +166,7 @@ def _javadoc_impl(ctx):
173
166
if ctx .attr .outdir :
174
167
cmds += ["mkdir -p %s" % index_html .dirname ]
175
168
176
- args = [javadoc ]
169
+ args = [javadoc . path ]
177
170
args += ["-d" , index_html .dirname ]
178
171
args += ["-classpath" , _pathlist (jars )]
179
172
if doclet_jars : args += ["-docletpath" , _pathlist (doclet_jars )]
@@ -224,7 +217,7 @@ def _javadoc_impl(ctx):
224
217
)
225
218
226
219
return struct (
227
- files = set ([index_html ]),
220
+ files = depset ([index_html ]),
228
221
)
229
222
230
223
javadoc = rule (
0 commit comments