Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,6 @@ py_library(
),
)

load("//tools:local_config_info.bzl", "local_config_info")

local_config_info(name = "local_config_info")

RULES_BUILD_ERROR_COMMIT = "4ea1a4fa702b16389c7eb3b695ef97a23dfe9330"

http_archive(
Expand Down
9 changes: 9 additions & 0 deletions example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,12 @@ multirun(
":described_predicates_20_log.update",
],
)

filegroup(
name = "all_files",
srcs = glob([
"*.cpp",
"*.log",
]),
visibility = ["//scripts:__pkg__"],
)
5 changes: 4 additions & 1 deletion rules/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
exports_files(
["copy_to_workspace.bash"],
visibility = ["//example:__pkg__"],
visibility = [
"//example:__pkg__",
"//scripts:__pkg__",
],
)
6 changes: 2 additions & 4 deletions rules/lcov.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Rule for generating a coverage report
"""

load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@local_config_info//:defs.bzl", "BAZEL_BIN")

def lcov(
name,
Expand Down Expand Up @@ -66,7 +65,7 @@ def lcov(
]

coverage_command = " ".join(
["{bazel} coverage {bazel_common_opts}"] +
["bazel coverage {bazel_common_opts}"] +
coverage_opts + instrumented + test_targets,
)

Expand All @@ -86,7 +85,7 @@ def lcov(
"lcov_tool=\"$(pwd)/${{1}}\"",
"",
"cd $BUILD_WORKSPACE_DIRECTORY",
"output_path=\"$({bazel} info {bazel_common_opts} output_path)\"",
"output_path=\"$(bazel info {bazel_common_opts} output_path)\"",
"coverage_report=\"${{output_path}}/_coverage/_coverage_report.dat\"",
"",
coverage_command + " || true",
Expand All @@ -97,7 +96,6 @@ def lcov(

content = [
line.format(
bazel = BAZEL_BIN,
bazel_common_opts = "",
)
for line in content
Expand Down
35 changes: 13 additions & 22 deletions scripts/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@rules_python//python:defs.bzl", "py_binary")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@local_config_info//:defs.bzl", "BAZEL_WORKSPACE_ROOT")

py_binary(
name = "markdown-update",
Expand All @@ -14,35 +13,27 @@ genrule(
srcs = ["README.md.tmpl"],
outs = ["README.md.generated"],
cmd = """
export BUILD_WORKSPACE_DIRECTORY={workspace_dir}
$(execpath :markdown-update) $(rootpath :README.md.tmpl)> $@
""".format(
workspace_dir = BAZEL_WORKSPACE_ROOT,
),
tags = ["manual"],
tools = [":markdown-update"],
visibility = ["//visibility:private"],
)

genrule(
name = "readme.update_sh",
srcs = ["README.md.tmpl"],
outs = ["readme.update.sh"],
cmd = """
set -euo pipefail
echo "set -euo pipefail" > $@
echo "" >> $@
echo "cd \\$$BUILD_WORKSPACE_DIRECTORY" >> $@
echo "$(execpath :markdown-update) $(rootpath :README.md.tmpl) > README.md" >> $@
""",
tags = ["manual"],
tools = [":markdown-update"],
tools = [
":markdown-update",
"//example:all_files",
],
visibility = ["//visibility:private"],
)

sh_binary(
name = "readme.update",
srcs = [":readme.update.sh"],
srcs = ["//rules:copy_to_workspace.bash"],
args = [
"$(rootpath :gen_readme)",
"$(rootpath //:README.md)",
],
data = [
":gen_readme",
"//:README.md",
],
)

diff_test(
Expand Down
4 changes: 0 additions & 4 deletions scripts/markdown-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-

import argparse
import os
from pathlib import Path
import sys

Expand All @@ -13,12 +12,9 @@
parser.add_argument("filename")
args = parser.parse_args()

os.chdir(os.environ.get("BUILD_WORKSPACE_DIRECTORY"))

with open(Path(args.filename), "r") as f:
indoc = f.read()

outdoc = get_code_emb()(indoc)

sys.stdout.buffer.write(outdoc.encode())

47 changes: 0 additions & 47 deletions tools/local_config_info.bzl

This file was deleted.