fix(gapic-generator-typescript): improve generator script robustness outside of bazel#8002
Open
GautamSharda wants to merge 4 commits intomainfrom
Open
fix(gapic-generator-typescript): improve generator script robustness outside of bazel#8002GautamSharda wants to merge 4 commits intomainfrom
GautamSharda wants to merge 4 commits intomainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
tscandnode), it previously failed due to missing executable permissions onprotoc-plugin.js, strict file path checks for the systemprotocbinary, and crashes when parsing modern protos without the--experimental_editionsflag. This PR addresses those by:chmod +xto the generated plugin script.protoc(bypassingfs.existsSyncfor the string 'protoc').--experimental_editionsto protoc.noderuntime 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
).