From 749cb68517d19d5a11b16dd81f4960b379c98837 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 22 Sep 2025 11:58:56 -0700 Subject: [PATCH 1/3] exclude files that have bad syntax --- configure/best-practices.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/configure/best-practices.mdx b/configure/best-practices.mdx index 00b4391..431b686 100644 --- a/configure/best-practices.mdx +++ b/configure/best-practices.mdx @@ -80,6 +80,7 @@ and add `user.bazelrc` to your `.gitignore`. The open-source [bazelrc-preset.bzl](https://github.com/bazel-contrib/bazelrc-preset.bzl) + generates a custom bazelrc file that matches your Bazel version and provides a preset of recommended flags. From 9b2624cece0303b8bf9234c6ffc434b1bd626cc4 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 22 Sep 2025 13:18:25 -0700 Subject: [PATCH 2/3] feat: introduce ability to patch the upstream --- .github/workflows/hugo-site-generator.yml | 4 +++ configure/attributes.mdx | 28 ++++------------ configure/best-practices.mdx | 1 - patches/attributes.patch | 39 +++++++++++++++++++++++ 4 files changed, 49 insertions(+), 23 deletions(-) create mode 100644 patches/attributes.patch diff --git a/.github/workflows/hugo-site-generator.yml b/.github/workflows/hugo-site-generator.yml index 3d27e18..488c34c 100644 --- a/.github/workflows/hugo-site-generator.yml +++ b/.github/workflows/hugo-site-generator.yml @@ -39,6 +39,10 @@ jobs: working-directory: upstream run: git checkout ${{ inputs.bcrCommitHash }} + - name: Patch upstream docs + working-directory: upstream + run: patch -p1 < ../patches/*.patch + - name: Clean up mdx files run: ./cleanup-mdx.sh diff --git a/configure/attributes.mdx b/configure/attributes.mdx index 7bc3f41..2ba93cc 100644 --- a/configure/attributes.mdx +++ b/configure/attributes.mdx @@ -44,28 +44,12 @@ config_setting( This declares a `cc_binary` that "chooses" its deps based on the flags at the command line. Specifically, `deps` becomes: - - - - - - - - - - - - - - - - - - - - - -
Commanddeps =
bazel build //myapp:mybinary --cpu=arm[":arm_lib"]
bazel build //myapp:mybinary -c dbg --cpu=x86[":x86_dev_lib"]
bazel build //myapp:mybinary --cpu=ppc[":generic_lib"]
bazel build //myapp:mybinary -c dbg --cpu=ppc[":generic_lib"]
+| Command | deps | +| ----------------------------------------------- | ------------------ | +| `bazel build //myapp:mybinary --cpu=arm` | `[":arm_lib"]` | +| `bazel build //myapp:mybinary -c dbg --cpu=x86` | `[":x86_dev_lib"]` | +| `bazel build //myapp:mybinary --cpu=ppc` | `[":generic_lib"]` | +| `bazel build //myapp:mybinary -c dbg --cpu=ppc` | `[":generic_lib"]` | `select()` serves as a placeholder for a value that will be chosen based on *configuration conditions*, which are labels referencing [`config_setting`](/reference/be/general#config_setting) diff --git a/configure/best-practices.mdx b/configure/best-practices.mdx index 431b686..00b4391 100644 --- a/configure/best-practices.mdx +++ b/configure/best-practices.mdx @@ -80,7 +80,6 @@ and add `user.bazelrc` to your `.gitignore`. The open-source [bazelrc-preset.bzl](https://github.com/bazel-contrib/bazelrc-preset.bzl) - generates a custom bazelrc file that matches your Bazel version and provides a preset of recommended flags. diff --git a/patches/attributes.patch b/patches/attributes.patch new file mode 100644 index 0000000..a1745e7 --- /dev/null +++ b/patches/attributes.patch @@ -0,0 +1,39 @@ +diff --git a/site/en/configure/attributes.md b/site/en/configure/attributes.md +index 7b55a6f..945ac81 100644 +--- a/site/en/configure/attributes.md ++++ b/site/en/configure/attributes.md +@@ -45,28 +45,12 @@ config_setting( + This declares a `cc_binary` that "chooses" its deps based on the flags at the + command line. Specifically, `deps` becomes: + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
Commanddeps =
bazel build //myapp:mybinary --cpu=arm[":arm_lib"]
bazel build //myapp:mybinary -c dbg --cpu=x86[":x86_dev_lib"]
bazel build //myapp:mybinary --cpu=ppc[":generic_lib"]
bazel build //myapp:mybinary -c dbg --cpu=ppc[":generic_lib"]
++| Command | deps | ++| ----------------------------------------------- | ------------------ | ++| `bazel build //myapp:mybinary --cpu=arm` | `[":arm_lib"]` | ++| `bazel build //myapp:mybinary -c dbg --cpu=x86` | `[":x86_dev_lib"]` | ++| `bazel build //myapp:mybinary --cpu=ppc` | `[":generic_lib"]` | ++| `bazel build //myapp:mybinary -c dbg --cpu=ppc` | `[":generic_lib"]` | + + `select()` serves as a placeholder for a value that will be chosen based on + *configuration conditions*, which are labels referencing [`config_setting`](/reference/be/general#config_setting) From 86de18aaa4ca55b08f8bdd7013ca77ec3befe333 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 23 Sep 2025 14:12:56 -0700 Subject: [PATCH 3/3] move patch into script --- .github/workflows/hugo-site-generator.yml | 4 ---- copy-upstream-docs.sh | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hugo-site-generator.yml b/.github/workflows/hugo-site-generator.yml index 488c34c..3d27e18 100644 --- a/.github/workflows/hugo-site-generator.yml +++ b/.github/workflows/hugo-site-generator.yml @@ -39,10 +39,6 @@ jobs: working-directory: upstream run: git checkout ${{ inputs.bcrCommitHash }} - - name: Patch upstream docs - working-directory: upstream - run: patch -p1 < ../patches/*.patch - - name: Clean up mdx files run: ./cleanup-mdx.sh diff --git a/copy-upstream-docs.sh b/copy-upstream-docs.sh index 0675b28..21b17fe 100755 --- a/copy-upstream-docs.sh +++ b/copy-upstream-docs.sh @@ -57,6 +57,12 @@ if [ ! -d "$SOURCE_DIR" ]; then exit 1 fi +( + cd upstream + echo "Patching files" + patch -p1 < ../patches/*.patch +) + echo "Finding all .md files in $SOURCE_DIR..." # Find all .md files and copy them @@ -84,5 +90,11 @@ find "$SOURCE_DIR" -name "*.md" -type f | while read -r source_file; do awk -f transform-docs.awk "$source_file" > "$target_file" done +( + cd upstream + echo "Undoing patches" + git reset --hard +) + echo "Successfully copied all .md files to .mdx files in root" echo "You can now modify the files as needed."