Skip to content

Commit f7f626e

Browse files
committed
Update to use bin/javadoc
1 parent 3be9df4 commit f7f626e

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

apidoc/internal/javadoc.bzl

+7-14
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def _mk_attrs():
7474
attrs = {
7575
"sourcepaths": attr.string_list(mandatory = False),
7676
"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"),
7979
single_file = True,
80-
executable = True,
80+
allow_files = True,
8181
cfg = "host",
8282
),
8383
"tools_jar": attr.label(
@@ -132,12 +132,6 @@ def _get_java_dep_jars(deps):
132132
return jars
133133

134134

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-
141135

142136
def _get_output_index_html(ctx, outdir):
143137
filename = "index.html"
@@ -155,16 +149,15 @@ def _javadoc_impl(ctx):
155149
#
156150
# Preparation of inputs and dependencies.
157151
#
158-
java = ctx.executable.java_tool
159-
javadoc = _get_javadoc_tool(java)
152+
javadoc = ctx.file.javadoc_tool
160153
jars = _get_java_dep_jars(ctx.attr.deps)
161154
jars.append(ctx.file.tools_jar)
162155
doclet_jars = _get_java_dep_jars(ctx.attr.doclet_deps)
163156
taglet_jars = _get_java_dep_jars(ctx.attr.taglet_deps)
164157
srcfiles = ctx.files.srcs
165158
index_html = _get_output_index_html(ctx, ctx.attr.outdir)
166159
all_jars = jars + doclet_jars + taglet_jars
167-
inputs = [java] + all_jars + srcfiles
160+
inputs = [javadoc] + all_jars + srcfiles
168161

169162
#
170163
# Command generation.
@@ -173,7 +166,7 @@ def _javadoc_impl(ctx):
173166
if ctx.attr.outdir:
174167
cmds += ["mkdir -p %s" % index_html.dirname]
175168

176-
args = [javadoc]
169+
args = [javadoc.path]
177170
args += ["-d", index_html.dirname]
178171
args += ["-classpath", _pathlist(jars)]
179172
if doclet_jars: args += ["-docletpath", _pathlist(doclet_jars)]
@@ -224,7 +217,7 @@ def _javadoc_impl(ctx):
224217
)
225218

226219
return struct(
227-
files = set([index_html]),
220+
files = depset([index_html]),
228221
)
229222

230223
javadoc = rule(

0 commit comments

Comments
 (0)