Skip to content

fix: remove_upb_c_rules.patch file path issue#16093

Open
NeerajDwivedii wants to merge 1 commit into
googleapis:mainfrom
NeerajDwivedii:fix_patch_path_issue
Open

fix: remove_upb_c_rules.patch file path issue#16093
NeerajDwivedii wants to merge 1 commit into
googleapis:mainfrom
NeerajDwivedii:fix_patch_path_issue

Conversation

@NeerajDwivedii
Copy link
Copy Markdown

@NeerajDwivedii NeerajDwivedii commented May 13, 2026

This PR fixes an issue with how the remove_upb_c_rules.patch file path is resolved when the googleapis dependency is used internally by the google-cloud-cpp client library.

Previously, googleapis attempted to locate the patch file in the source directory of the parent workspace that includes google-cloud-cpp. This behavior is incorrect because the patch file actually belongs to the google-cloud-cpp repository itself.

With this fix, the patch file is now searched relative to the google-cloud-cpp directory, ensuring it works correctly regardless of the name or location of the parent project/workspace using the library.

Current Error:
image

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the patch file reference in bazel/workspace0.bzl to use an explicit workspace prefix. The reviewer pointed out that using @// can lead to build failures when the repository is consumed as an external dependency and suggested using Label() to ensure the path is resolved correctly relative to the library's own workspace.

Comment thread bazel/workspace0.bzl Outdated

# Mirrors the patch from the current bazel module
"//bazel:remove_upb_c_rules.patch",
"@//bazel:remove_upb_c_rules.patch",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using @// explicitly refers to the main workspace (the root project). If this library is consumed as a dependency by another project, Bazel will look for the patch file in the consumer's repository instead of this one, which will cause the build to fail. To ensure the patch is correctly located within this repository regardless of how it is consumed, use Label() to resolve the path relative to this .bzl file. This is the standard way to handle internal references in Bazel macros that are intended for external use.

Suggested change
"@//bazel:remove_upb_c_rules.patch",
Label("//bazel:remove_upb_c_rules.patch"),

@NeerajDwivedii NeerajDwivedii force-pushed the fix_patch_path_issue branch from 11568c8 to c448a05 Compare May 13, 2026 04:48
@sachinpro
Copy link
Copy Markdown
Contributor

@NeerajDwivedii Provide a description and open the PR please.

@NeerajDwivedii NeerajDwivedii marked this pull request as ready for review May 13, 2026 12:20
@NeerajDwivedii NeerajDwivedii requested a review from a team as a code owner May 13, 2026 12:20
@NeerajDwivedii
Copy link
Copy Markdown
Author

@sachinpro PR ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants