diff --git a/src/java/com/claro/module_system/clarodocs/clarodocs_rules.bzl b/src/java/com/claro/module_system/clarodocs/clarodocs_rules.bzl index dbd793ae..1e71ab60 100644 --- a/src/java/com/claro/module_system/clarodocs/clarodocs_rules.bzl +++ b/src/java/com/claro/module_system/clarodocs/clarodocs_rules.bzl @@ -1,6 +1,7 @@ load( "//src/java/com/claro:claro_build_rules_internal.bzl", _ClaroModuleInfo = "ClaroModuleInfo", + _CLARO_STDLIB_MODULES = "CLARO_STDLIB_MODULES", ) @@ -17,19 +18,23 @@ def _clarodocs_impl(ctx): for module in ctx.attr.root[_ClaroModuleInfo].info.files.to_list(): if module.extension == "claro_module": args.add("--module", module) + for module in ctx.attr._stdlib_modules: + args.add("--module", module[_ClaroModuleInfo].info.path_to_claro_module_file) - treejs_deps = {name: path for path, name in ctx.attr.treejs_deps.items()} + treejs_deps = {name: path for path, name in ctx.attr._treejs_deps.items()} args.add("--treejs", treejs_deps["tree.min.js"].files.to_list()[0]) args.add("--treejs_css", treejs_deps["treejs.min.css"].files.to_list()[0]) args.add("--out", ctx.outputs.out.path) ctx.actions.run( - inputs = ctx.attr.root[_ClaroModuleInfo].info.files.to_list() + [treejs_dep.files.to_list()[0] for treejs_dep in ctx.attr.treejs_deps.keys()], + inputs = ctx.attr.root[_ClaroModuleInfo].info.files.to_list() + + [treejs_dep.files.to_list()[0] for treejs_dep in ctx.attr._treejs_deps.keys()] + + [stdlib_dep[_ClaroModuleInfo].info.path_to_claro_module_file for stdlib_dep in ctx.attr._stdlib_modules], outputs = [ctx.outputs.out], arguments = [args], progress_message = "Generating ClaroDocs: " + ctx.outputs.out.path, - executable = ctx.executable.clarodocs_generator_bin, + executable = ctx.executable._clarodocs_generator_bin, ) print("View auto-generated ClaroDocs by running the following command:\n\t$ open " + ctx.outputs.out.path) @@ -47,13 +52,17 @@ _clarodocs_rule = rule( doc = "The output file to write the generated ClaroDocs HTML to.", mandatory = True, ), - "clarodocs_generator_bin": attr.label( + "_stdlib_modules": attr.label_list( + doc = "StdLib Modules that should be rendered in every ClaroDocs site since any types/procedures there will be used pervasively.", + default = _CLARO_STDLIB_MODULES.values(), + ), + "_clarodocs_generator_bin": attr.label( default = Label("//src/java/com/claro/module_system/clarodocs:clarodocs_generator"), allow_files = True, executable = True, cfg = "host", ), - "treejs_deps": attr.label_keyed_string_dict( + "_treejs_deps": attr.label_keyed_string_dict( doc = "Paths to the required treejs JS and CSS to include in generated HTML.", allow_files = True, default = {