2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-30 16:42:07 +00:00
rules_foreign_cc/docs/gen_header.sh
Yesudeep Mangalapilly a2f1e5d8c3
Adds toolchain for freebsd. (#794)
* Adds toolchain for freebsd.

* Address buildifier lint warnings.

* Use /usr/bin/env bash

* Leave the Linux-specific shebang alone.

* Adds note about Bazel CI issue requesting for FreeBSD support and experimental status.

* Fix typo.

* Clean up trailing whitespace.

* Updates bazel-skylib version for tests to pass on FreeBSD.

* Update foreign_cc/repositories.bzl

Co-authored-by: UebelAndre <github@uebelandre.com>
2021-11-29 10:54:06 +00:00

33 lines
707 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# The block below functions as follows
#
# - Look for all assignments
# - Remove all load statements
# - Remove multi line load statements
# - Remvoe all whitespace
# - Remove all comments
# - Strip assignments
# - Generate `- [symbol](#sybol)` formatting
# - Sort entries
TABLE_OF_CONTENTS=$(grep "=" "$1" \
| sed '/^load.*/d' \
| sed '/,$/d' \
| sed '/^$/d' \
| sed '/^#/d' \
| sed 's/ = .*//' \
| python -c 'import sys; print("\n".join(["- [{}](#{})".format(symbol.strip(), symbol.strip().lower()) for symbol in sys.stdin.readlines()]))' \
| sort -f
)
cat << EOF > "$2"
<!-- Generated with Stardoc, Do Not Edit! -->
# Rules Foreign CC
${TABLE_OF_CONTENTS}
EOF