Skip to content

Commit

Permalink
chore: Migrate python-trace synth.py from artman to bazel (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
vam-google authored Apr 21, 2020
1 parent 57c7c0c commit 2e8a9e9
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/google-cloud-trace/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,39 @@
import synthtool as s
import synthtool.gcp as gcp

gapic = gcp.GAPICGenerator()
gapic = gcp.GAPICBazel()
common = gcp.CommonTemplates()

# ----------------------------------------------------------------------------
# Generate trace GAPIC layer
# ----------------------------------------------------------------------------
for version in ["v1", "v2"]:
library = gapic.py_library(
"trace",
version,
config_path=f"/google/devtools/cloudtrace" f"/artman_cloudtrace_{version}.yaml",
artman_output_name=f"trace-{version}",
service="trace",
version=version,
bazel_target=f"//google/devtools/cloudtrace/{version}:devtools-cloudtrace-{version}-py",
proto_output_path=f"google/cloud/trace_{version}/proto",
include_protos=True,
)

s.move(library / f"google/cloud/trace_{version}")
s.move(library / f"tests/unit/gapic/{version}")
s.move(library/ f"google/cloud/devtools/cloudtrace_{version}/proto",
f"google/cloud/trace_{version}/proto")

# Fix up imports
s.replace(
"google/**/*.py",
f"from google.devtools.cloudtrace_{version}.proto import ",
f"from google.cloud.devtools.cloudtrace_{version}.proto import ",
f"from google.cloud.trace_{version}.proto import ",
)

s.replace(
f"google/cloud/trace_{version}/gapic/trace_service_client.py",
"google-cloud-devtools-cloudtrace",
"google-cloud-trace",
)

# Copy docs configuration
s.move(library / f"docs/conf.py")

Expand Down

0 comments on commit 2e8a9e9

Please sign in to comment.