|
1 | 1 | """
|
2 | 2 | Implementation of the "_dgeni_api_docs" rule. The implementation runs Dgeni with the
|
3 |
| - specified entry points and outputs the API docs into a package relative directory. |
| 3 | + specified entry points and outputs the API docs as `DefaultInfo` declared output files. |
4 | 4 | """
|
5 | 5 |
|
6 | 6 | def _dgeni_api_docs(ctx):
|
7 | 7 | input_files = ctx.files.srcs
|
8 | 8 | args = ctx.actions.args()
|
9 | 9 | expected_outputs = []
|
10 |
| - |
11 |
| - output_dir_name = ctx.attr.name |
12 |
| - output_dir_path = "%s/%s/%s" % (ctx.bin_dir.path, ctx.label.package, output_dir_name) |
| 10 | + output_dir_path = "%s/%s" % (ctx.bin_dir.path, ctx.label.package) |
13 | 11 |
|
14 | 12 | # Do nothing if there are no input files. Bazel will throw if we schedule an action
|
15 | 13 | # that returns no outputs.
|
@@ -41,17 +39,15 @@ def _dgeni_api_docs(ctx):
|
41 | 39 | # Declare the output for the current entry-point. The output file will always follow the
|
42 | 40 | # same format: "{output_folder}/{package_name}-{entry_point_name}.html"
|
43 | 41 | # (e.g. "api-docs/material-slider-testing.html")
|
44 |
| - ctx.actions.declare_file("%s/%s-%s.html" % |
45 |
| - (output_dir_name, package_name, entry_point.replace("/", "-"))), |
| 42 | + ctx.actions.declare_file("%s-%s.html" % |
| 43 | + (package_name, entry_point.replace("/", "-"))), |
46 | 44 | ]
|
47 | 45 |
|
48 | 46 | # Small workaround that ensures that the "ripple" API doc is properly exposed as an output
|
49 | 47 | # of the packaging rule. Technically Dgeni should not output the "ripple" directory as
|
50 | 48 | # its own entry-point. TODO(devversion): Support sub API docs for entry-points
|
51 | 49 | if package_name == "material":
|
52 |
| - expected_outputs += [ |
53 |
| - ctx.actions.declare_file("%s/%s-%s.html" % (output_dir_name, package_name, "ripple")), |
54 |
| - ] |
| 50 | + expected_outputs += [ctx.actions.declare_file("%s-%s.html" % (package_name, "ripple"))] |
55 | 51 |
|
56 | 52 | # Run the Dgeni bazel executable which builds the documentation output based on the
|
57 | 53 | # configured rule attributes.
|
|
0 commit comments