Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct deep-remove and deep-preserve regexes #2572

Merged
merged 2 commits into from
Mar 20, 2024
Merged
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
22 changes: 21 additions & 1 deletion library_generation/postprocess_library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,22 @@ fi
# we determine the location of the .OwlBot.yaml file by checking if the target
# folder is a monorepo folder or not
if [[ "${is_monorepo}" == "true" ]]; then
owlbot_yaml_relative_path=".OwlBot.yaml"
# the deep-remove-regex and deep-preserve-regex of the .OwlBot.yaml
# files in the monorepo libraries assume that `copy-code` is run
# from the root of the monorepo. However, we call `copy-code` from inside each
# library, so a path like `/java-asset/google-.*/src` will not have
# any effect. We solve this by creating a temporary owlbot yaml with
# the patched paths.
# For example, we convert
# - "/java-asset/google-.*/src"
# to
# - "/google-.*/src"

library_name=$(basename "${postprocessing_target}")
cat "${postprocessing_target}/.OwlBot.yaml" \
| sed "s/- \"\/${library_name}/ - \"/" \
> "${postprocessing_target}/.OwlBot.hermetic.yaml"
owlbot_yaml_relative_path=".OwlBot.hermetic.yaml"
else
owlbot_yaml_relative_path=".github/.OwlBot.yaml"
fi
Expand Down Expand Up @@ -109,6 +124,11 @@ docker run --rm \
--source-repo="${preprocessed_libraries_binding}" \
--config-file="${owlbot_yaml_relative_path}"

# clean the custom owlbot yaml
if [[ "${is_monorepo}" == "true" ]]; then
rm "${postprocessing_target}/.OwlBot.hermetic.yaml"
fi

# we clone the synthtool library and manually build it
mkdir -p /tmp/synthtool
pushd /tmp/synthtool
Expand Down
Loading