| # Copyright 2017 The Bazel Authors. All rights reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| load("//tools/stardoc:index.bzl", "stardoc") |
| |
| stardoc( |
| name = "builtins", |
| out = "builtins.api", |
| input = "//:index.for_docs.bzl", |
| tags = ["fix-windows"], |
| deps = [ |
| "//:bzl", |
| "//internal/node:bzl", |
| ], |
| ) |
| |
| _BUILTINS_README = "# Built-in rules\n\nThese rules are available without any npm installation, via the `WORKSPACE` install of the `build_bazel_rules_nodejs` workspace. This is necessary to bootstrap Bazel to run the package manager to download other rules from NPM.\n\n" |
| |
| # Ugly genrule depending on local linux environment to build the README out of skylark doc generation. |
| # Only referenced when we do a release. |
| # TODO: This ought to be possible with stardoc alone. Need to coordinate with Chris Parsons. |
| genrule( |
| name = "builtins_md", |
| srcs = [":builtins.api"], |
| outs = ["builtins.doc"], |
| cmd = "echo '%s' > $@;" % _BUILTINS_README + |
| "cat $< | sed 's/^##/\\\n##/' >> $@", |
| tags = ["fix-windows"], |
| ) |
| |
| _PACKAGE_READMES = { |
| "Built-ins": ":builtins.doc", |
| "Jasmine": "//packages/jasmine:README.md", |
| "Karma": "//packages/karma:README.md", |
| "Protractor": "//packages/protractor:README.md", |
| "Rollup": "//packages/rollup:README.md", |
| "Terser": "//packages/terser:README.md", |
| "TypeScript": "//packages/typescript:README.md", |
| } |
| |
| _FRONT_MATTER = "\n".join([ |
| "---", |
| "title: %s", |
| "layout: default", |
| "stylesheet: docs", |
| "---", |
| "<!-- *********************", |
| " DO NOT EDIT THIS FILE", |
| " It is a generated build output from Stardoc.", |
| " Instead you must edit the .bzl file where the rules are declared,", |
| " or possibly a markdown file next to the .bzl file", |
| " ********************* -->", |
| ]) |
| |
| [ |
| genrule( |
| name = "%s_md" % readme[0], |
| srcs = [readme[1]], |
| outs = [readme[0] + ".md"], |
| cmd = "echo '%s' > $@;" % _FRONT_MATTER % readme[0] + |
| "cat $< >> $@", |
| tags = ["fix-windows"], |
| ) |
| for readme in _PACKAGE_READMES.items() |
| ] |
| |
| filegroup( |
| name = "docs", |
| srcs = [s + ".md" for s in _PACKAGE_READMES.keys()], |
| tags = ["fix-windows"], |
| ) |