Skip to content

Commit

Permalink
ci: update all library READMES with a single script (#7695)
Browse files Browse the repository at this point in the history
Use some markers in each library `README.md` file to inject the
`quickstart.cc` code. With this change it is now possible to update all
the libraries using a single script.

I also changed the scaffold generation to include these markers for
future libraries.
  • Loading branch information
coryan authored Dec 5, 2021
1 parent edbe664 commit 5648627
Show file tree
Hide file tree
Showing 42 changed files with 483 additions and 649 deletions.
12 changes: 6 additions & 6 deletions ci/cloudbuild/builds/checkers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set -euo pipefail
source "$(dirname "$0")/../../lib/init.sh"
source module ci/lib/io.sh
source module ci/cloudbuild/builds/lib/git.sh
source module ci/cloudbuild/builds/lib/features.sh

# Runs sed expressions (specified after -e) over the given files, editing them
# in place. This function is exported so it can be run in subshells, such as
Expand Down Expand Up @@ -82,17 +83,16 @@ printf "%-30s" "Running markdown generators:" >&2
time {
declare -A -r GENERATOR_MAP=(
["ci/generate-markdown/generate-readme.sh"]="README.md"
["ci/generate-markdown/generate-bigquery-readme.sh"]="google/cloud/bigquery/README.md"
["ci/generate-markdown/generate-bigtable-readme.sh"]="google/cloud/bigtable/README.md"
["ci/generate-markdown/generate-iam-readme.sh"]="google/cloud/iam/README.md"
["ci/generate-markdown/generate-pubsub-readme.sh"]="google/cloud/pubsub/README.md"
["ci/generate-markdown/generate-spanner-readme.sh"]="google/cloud/spanner/README.md"
["ci/generate-markdown/generate-storage-readme.sh"]="google/cloud/storage/README.md"
["ci/generate-markdown/generate-packaging.sh"]="doc/packaging.md"
)
for generator in "${!GENERATOR_MAP[@]}"; do
"${generator}" >"${GENERATOR_MAP[${generator}]}"
done

mapfile -t libraries < <(features::libraries)
for library in "${libraries[@]}"; do
ci/generate-markdown/update-library-readme.sh "${library}"
done
}

printf "%-30s" "Running check-include-guards:" >&2
Expand Down
15 changes: 12 additions & 3 deletions ci/cloudbuild/builds/lib/features.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,24 @@ if ((CI_CLOUDBUILD_BUILDS_LIB_FEATURES_SH__++ != 0)); then
return 0
fi # include guard

function features::list() {
function features::libraries() {
local feature_list
mapfile -t feature_list < <(cat ci/etc/full_feature_list)
# Add the hand-crafted libraries and custom features to the full list
mapfile -t feature_list <ci/etc/full_feature_list
# Add the hand-crafted libraries
feature_list+=(
bigtable
pubsub
spanner
storage
)
printf "%s\n" "${feature_list[@]}"
}

function features::list() {
local feature_list
mapfile -t feature_list < <(features::libraries)
# Add any custom features to the full list of libraries
feature_list+=(
experimental-storage-grpc
)
printf "%s\n" "${feature_list[@]}"
Expand Down
101 changes: 0 additions & 101 deletions ci/generate-markdown/generate-bigquery-readme.sh

This file was deleted.

96 changes: 0 additions & 96 deletions ci/generate-markdown/generate-bigtable-readme.sh

This file was deleted.

101 changes: 0 additions & 101 deletions ci/generate-markdown/generate-iam-readme.sh

This file was deleted.

Loading

0 comments on commit 5648627

Please sign in to comment.