| # 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("@bazel_skylib//rules:diff_test.bzl", "diff_test") |
| load("@bazel_skylib//rules:write_file.bzl", "write_file") |
| load("//tools/stardoc:index.bzl", "stardoc") |
| |
| stardoc( |
| name = "core", |
| bzl_library_target = "//nodejs:index.for_docs", |
| ) |
| |
| _READMES = { |
| "Core": "//docs:core-docgen.md", |
| } |
| |
| [ |
| diff_test( |
| name = "check_" + k.lower(), |
| failure_message = "Please run: bazel run //docs:update", |
| file1 = k + ".md", |
| file2 = v, |
| ) |
| for [ |
| k, |
| v, |
| ] in _READMES.items() |
| ] |
| |
| write_file( |
| name = "gen_update", |
| out = "update.sh", |
| content = [ |
| "#!/usr/bin/env bash", |
| "cd $BUILD_WORKSPACE_DIRECTORY", |
| ] + [ |
| "cp -fv bazel-bin/{1} docs/{0}.md".format( |
| k, |
| v.replace(":", "/"), |
| ) |
| for [ |
| k, |
| v, |
| ] in _READMES.items() |
| ], |
| ) |
| |
| sh_binary( |
| name = "update", |
| srcs = ["update.sh"], |
| data = _READMES.values(), |
| ) |