Skip to content

fix(gapic-generator-typescript): improve generator script robustness outside of bazel#8002

Open
GautamSharda wants to merge 4 commits intomainfrom
pr-1-scripts
Open

fix(gapic-generator-typescript): improve generator script robustness outside of bazel#8002
GautamSharda wants to merge 4 commits intomainfrom
pr-1-scripts

Conversation

@GautamSharda
Copy link
Copy Markdown
Contributor

@GautamSharda GautamSharda commented Apr 9, 2026

This PR improves the robustness of the generator scripts so they can execute successfully outside of a Bazel sandbox environment.

When the generator is invoked directly (e.g., via tsc and node), it previously failed due to missing executable permissions on protoc-plugin.js, strict file path checks for the system protoc binary, and crashes when parsing modern protos without the --experimental_editions flag. This PR addresses those by:

  • Dynamically applying chmod +x to the generated plugin script.
  • Trusting the system PATH for protoc (bypassing fs.existsSync for the string 'protoc').
  • Explicitly passing --experimental_editions to protoc.
  • Explicitly invoking the baseline tests with the node runtime to avoid shebang permission issues.

This is Part 1 of 3 in the broader effort to completely remove Bazel from the generator (For googleapis/librarian#4593
).

This change completely removes the Bazel dependency from the
gapic-generator-typescript project. All Bazel configuration files
have been deleted and package.json scripts have been updated to
use the standard TypeScript compiler (tsc) directly.

Bazel was originally introduced to export build rules for the
googleapis monorepo. However, following the consolidation of
the generator into google-cloud-node/core, Bazel is no longer
necessary and adds significant overhead (e.g., 4+ minute
installations via npm run compile). Since tsc provides all the
compilation functionality needed natively, stripping Bazel
simplifies the toolchain and significantly speeds up CI pipelines
without losing capabilities.

To verify this change does not break functionality, the project
was locally compiled successfully using `npx tsc -p .` in under
7 seconds. The test scripts were also run, and the overall
Librarian CI workflow has been verified to pass with these
changes, confirming that the generator builds and executes
correctly without Bazel.

For googleapis/librarian#4593
# Conflicts:
#	core/generator/gapic-generator-typescript/.bazeliskrc
#	core/generator/gapic-generator-typescript/.bazelrc
#	core/generator/gapic-generator-typescript/WORKSPACE
#	core/generator/gapic-generator-typescript/repositories.bzl
…outside of bazel

This PR improves the robustness of the generator scripts so they can execute successfully outside of a Bazel sandbox environment.

When the generator is invoked directly (e.g., via tsc and node), it previously failed due to missing executable permissions on protoc-plugin.js, strict file path checks for the system protoc binary, and crashes when parsing modern protos without the --experimental_editions flag. This commit addresses those by:
- Dynamically applying chmod +x to the generated plugin script.
- Trusting the system PATH for protoc (bypassing fs.existsSync for the string 'protoc').
- Explicitly passing --experimental_editions to protoc.
- Explicitly invoking the baseline tests with the node runtime to avoid shebang permission issues.
@GautamSharda GautamSharda requested a review from a team as a code owner April 9, 2026 21:31
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.

1 participant