This repository was archived by the owner on Mar 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
feat: Make GAPIC Bazel rules production ready #402
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
84f91a6
Make GAPIC Bazel rules production ready
vam-google b0b240b
Make GAPIC Bazel rules production ready
vam-google 1172bba
set LC_ALL to fix kokoro build
vam-google a72432d
Merge remote-tracking branch 'upstream/master'
vam-google bb5e605
Fix typo
vam-google 8066385
add pyenv3_toolchain
vam-google 6fae027
add pyenv3_toolchain
vam-google b69b8fc
add newline character
vam-google File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| load("//:gapic_generator_python.bzl", "pandoc_binary", "pandoc_toolchain") | ||
| load("@gapic_generator_python_pip_deps//:requirements.bzl", "requirement") | ||
| load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair") | ||
|
|
||
| toolchain_type( | ||
| name = "pandoc_toolchain_type", | ||
|
|
@@ -23,14 +24,37 @@ pandoc_toolchain( | |
| ) | ||
|
|
||
| pandoc_binary( | ||
| name = "pandoc_binary" | ||
| name = "pandoc_binary", | ||
| ) | ||
|
|
||
| config_setting( | ||
| name = "gapic_gen_python_3_6", | ||
| values = {"define": "gapic_gen_python=3.6"}, | ||
| ) | ||
|
|
||
| py_runtime( | ||
| name = "pyenv3_runtime", | ||
| interpreter = ":pyenv3wrapper.sh", | ||
| python_version="PY3", | ||
| ) | ||
|
|
||
| py_runtime_pair( | ||
| name = "pyenv3_runtime_pair", | ||
| py3_runtime = ":pyenv3_runtime", | ||
| ) | ||
|
|
||
| toolchain( | ||
| name = "pyenv3_toolchain", | ||
| toolchain = ":pyenv3_runtime_pair", | ||
| toolchain_type = "@bazel_tools//tools/python:toolchain_type", | ||
| ) | ||
|
|
||
| py_binary( | ||
| name = "gapic_plugin", | ||
| srcs = glob(["gapic/**/*.py"]), | ||
| data = [":pandoc_binary"] + glob(["gapic/**/*.j2"]), | ||
| main = "gapic/cli/generate_with_pandoc.py", | ||
| python_version = "PY3", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "@com_google_protobuf//:protobuf_python", | ||
|
|
@@ -42,6 +66,8 @@ py_binary( | |
| requirement("MarkupSafe"), | ||
| requirement("pypandoc"), | ||
| requirement("PyYAML"), | ||
| ], | ||
| python_version = "PY3", | ||
| ) | ||
| ] + select({ | ||
| ":gapic_gen_python_3_6": [requirement("dataclasses")], | ||
| "//conditions:default": [], | ||
| }), | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: no newline |
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ protobuf_deps() | |
|
|
||
| # | ||
| # Import grpc as a native bazel dependency. This avoids duplication and also | ||
| # spedds up loading phase a lot (otherwise python_rules will be building grpcio | ||
| # speeds up loading phase a lot (otherwise python_rules will be building grpcio | ||
| # from sources in a single-core speed, which takes around 5 minutes on a regular | ||
| # workstation) | ||
|
Comment on lines
+45
to
+48
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wat? Why is it building single-cored?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont know how exactly it does it, but based on time it takes and the CPU load on the build machine I assumed it must be single core |
||
| # | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/sh | ||
|
|
||
| HOME_DIR=$(getent passwd "$(whoami)" | cut -d: -f6) | ||
|
software-dov marked this conversation as resolved.
|
||
| exec "$HOME_DIR/.pyenv/shims/python3" "$@" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ MarkupSafe==1.1.1 | |
| protobuf==3.11.3 | ||
| pypandoc==1.5 | ||
| PyYAML==5.3.1 | ||
| dataclasses==0.6 | ||
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.
Uh oh!
There was an error while loading. Please reload this page.