Skip to content

Commit

Permalink
chore: Migrate python-cloudbuild synth.py from artman to bazel (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
  • Loading branch information
vam-google and busunkim96 authored May 2, 2020
1 parent 852d782 commit fab5406
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions packages/google-cloud-build/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
import synthtool as s
from synthtool import gcp

gapic = gcp.GAPICGenerator()
gapic = gcp.GAPICBazel()
common = gcp.CommonTemplates()
version = 'v1'

# ----------------------------------------------------------------------------
# Generate cloudbuild GAPIC layer
# ----------------------------------------------------------------------------
library = gapic.py_library(
'cloudbuild',
version,
config_path='/google/devtools/cloudbuild/artman_cloudbuild.yaml',
generator_args=["--dev_samples"],
include_protos=True
service='cloudbuild',
version=version,
bazel_target=f"//google/devtools/cloudbuild/{version}:devtools-cloudbuild-{version}-py",
include_protos=True,
proto_output_path=f"google/cloud/devtools/cloudbuild_{version}/proto",
)

s.move(
Expand All @@ -40,26 +40,14 @@
'setup.py',
'setup.cfg',
'README.rst',
'**/*.proto',
'google/cloud/devtools/__init__.py', # declare this as a namespace package
],
)

# Move protos to the right directory
s.move(library / "google/cloud/cloudbuild_v1/proto/*.proto", "google/cloud/devtools/cloudbuild_v1/proto")

# Fix up imports
s.replace(
["google/**/*.py", "tests/unit/**/*.py"],
r"from google.devtools.cloudbuild_v1.proto import ",
r"from google.cloud.devtools.cloudbuild_v1.proto import ",
)


# Rename package to `google-cloud-build`
s.replace(
["**/*.rst", "*/**/*.py", "**/*.md"],
"google-cloud-cloudbuild",
"google-cloud-devtools-cloudbuild",
"google-cloud-build"
)

Expand Down

0 comments on commit fab5406

Please sign in to comment.