# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This script is used to synthesize generated parts of this library."""
import synthtool as s
from synthtool import gcp

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

# ----------------------------------------------------------------------------
# Generate logging GAPIC layer
# ----------------------------------------------------------------------------
library = gapic.py_library(
    "logging",
    "v2",
    config_path="/google/logging/artman_logging.yaml",
    artman_output_name="logging-v2",
    include_protos=True,
)

# the structure of the logging directory is a bit different, so manually copy the protos
s.move(library / "google/cloud/logging_v2/proto/cloud/logging_v2/proto", "google/cloud/logging_v2/proto")
s.move(library / "google/cloud/logging_v2/proto/*.proto")

s.move(library / "google/cloud/logging_v2/gapic")
s.move(library / "tests/unit/gapic/v2")
s.move(library / "docs/gapic/v2")

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(unit_cov_level=95, cov_level=100)
# Don't move noxfile. logging has special testing setups for django, etc
s.move(templated_files, excludes="noxfile.py")

s.shell.run(["nox", "-s", "blacken"], hide_output=False)

@@ -711,17 +711,13 @@
 APIC
-Generator
+Bazel
 ()%0Ac
@@ -968,16 +968,24 @@
 ry(%0A    
+service=
 %22logging
@@ -991,16 +991,24 @@
 g%22,%0A    
+version=
 %22v2%22,%0A  
@@ -1013,22 +1013,24 @@
     
-config_path
+bazel_target
 =%22/
+/
 goog
@@ -1044,54 +1044,11 @@
 ing/
-artman_logging.yaml%22,%0A    artman_output_name=%22
+v2:
 logg
@@ -1053,16 +1053,19 @@
 gging-v2
+-py
 %22,%0A    i
@@ -1223,39 +1223,16 @@
 v2/proto
-/cloud/logging_v2/proto
 %22, %22goog
@@ -1262,66 +1262,8 @@
 to%22)
-%0As.move(library / %22google/cloud/logging_v2/proto/*.proto%22)
 %0A%0As.

Migrate python-logging synth.py from artman to bazel (#35)