def generate_admin_api(gapic): library = gapic.java_library( service='bigtable-admin', version='v2', config_path='/google/bigtable/admin/artman_bigtableadmin.yaml', artman_output_name='') # Excludes are relative to source `gapic-google-cloud-bigtable-v2/src` excludes = [ "main/java/com/google/cloud/bigtable/admin/v2/package-info.java", ] # Paths are relative to the destination, which is the current working directory internal_only = [ 'src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java', 'src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java', ] s.copy(library / 'gapic-google-cloud-bigtable-admin-v2/src', 'src', excludes=excludes) s.copy(library / 'grpc-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-admin-v2/src') s.copy(library / 'proto-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-admin-v2/src') make_internal_only(internal_only) java.format_code('../../google-api-grpc/grpc-google-cloud-bigtable-admin-v2/src') java.format_code('../../google-api-grpc/proto-google-cloud-bigtable-admin-v2/src')
def main(): gapic = gcp.GAPICGenerator() generate_data_api(gapic) generate_admin_api(gapic) java.format_code('src')
def generate_data_api(gapic): library = gapic.java_library( service='bigtable', version='v2', proto_path=f'google/bigtable/v2', bazel_target=f'//google/bigtable/v2:google-cloud-bigtable-v2-java', ) library = library / 'google-cloud-bigtable-v2-java' # Excludes are relative to source `gapic-google-cloud-bigtable-v2/src` excludes = [ "build.gradle", "pom.xml", "README.md", "src/main/java/com/google/cloud/bigtable/data/v2/package-info.java", "src/main/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClient.java", "src/main/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataSettings.java", "src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java", "src/test/java/com/google/cloud/bigtable/data/v2/MockBigtable.java", "src/test/java/com/google/cloud/bigtable/data/v2/MockBigtableImpl.java", ] # Paths are relative to the destination, which is the current working directory internal_only = [ "google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStub.java", 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java', "google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableStub.java", "google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableCallableFactory.java", ] package_name = f'com.google.bigtable.v2' java.fix_proto_headers(library / f'proto-google-cloud-bigtable-v2-java') java.fix_grpc_headers(library / f'grpc-google-cloud-bigtable-v2-java', package_name) s.copy(library / f'gapic-google-cloud-bigtable-v2-java', 'google-cloud-bigtable/', excludes=excludes) s.copy(library / f'grpc-google-cloud-bigtable-v2-java/src', f'grpc-google-cloud-bigtable-v2/src') s.copy(library / f'proto-google-cloud-bigtable-v2-java/src', f'proto-google-cloud-bigtable-v2/src') make_internal_only(internal_only) java.format_code(f'./grpc-google-cloud-bigtable-v2/src') java.format_code(f'./proto-google-cloud-bigtable-v2/src')
def generate_admin_api(gapic): library = gapic.java_library( service='bigtable-admin', version='v2', bazel_target= f'//google/bigtable/admin/v2:google-cloud-bigtable-admin-v2-java', proto_path=f'google/bigtable/admin/v2', ) library = library / 'google-cloud-bigtable-admin-v2-java' # Excludes are relative to source `gapic-google-cloud-bigtable-v2/src` excludes = [ "main/java/com/google/cloud/bigtable/admin/v2/package-info.java", ] # Paths are relative to the destination, which is the current working directory internal_only = [ 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java', ] package_name = f'com.google.cloud.bigtable.admin.v2' java.fix_proto_headers(library / f'proto-google-cloud-bigtable-admin-v2-java') java.fix_grpc_headers( library / f'grpc-google-cloud-bigtable-admin-v2-java', package_name) s.copy(library / f'gapic-google-cloud-bigtable-admin-v2-java/src', 'google-cloud-bigtable/src', excludes=excludes) s.copy(library / f'grpc-google-cloud-bigtable-admin-v2-java/src', f'grpc-google-cloud-bigtable-admin-v2/src') s.copy(library / f'proto-google-cloud-bigtable-admin-v2-java/src', f'proto-google-cloud-bigtable-admin-v2/src') make_internal_only(internal_only) java.format_code(f'./grpc-google-cloud-bigtable-admin-v2/src') java.format_code(f'./proto-google-cloud-bigtable-admin-v2/src')
def generate_data_api(gapic, license): library = gapic.java_library( service='bigtable', version='v2', config_path='/google/bigtable/artman_bigtable.yaml', artman_output_name='') # Excludes are relative to source `gapic-google-cloud-bigtable-v2/src` excludes = [ "build.gradle", "pom.xml", "README.md", "src/main/java/com/google/cloud/bigtable/data/v2/package-info.java", "src/main/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClient.java", "src/main/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataSettings.java", "src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java", "src/test/java/com/google/cloud/bigtable/data/v2/MockBigtable.java", "src/test/java/com/google/cloud/bigtable/data/v2/MockBigtableImpl.java", ] # Paths are relative to the destination, which is the current working directory internal_only = [ "google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStub.java", 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java', "google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableStub.java", "google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableCallableFactory.java", ] package_name = f'com.google.cloud.bigtable.v2' java.fix_proto_headers(library / f'proto-google-cloud-bigtable-v2') # java.fix_grpc_headers(library / f'grpc-google-cloud-bigtable-v2', package_name) ##todo replace with fix_grpc_headers s.replace(library / f'grpc-google-cloud-bigtable-v2/src/**/*.java', f"package com.google.bigtable.v2;", f"{license}package com.google.bigtable.v2;") s.copy(library / f'gapic-google-cloud-bigtable-v2', 'google-cloud-bigtable/', excludes=excludes) s.copy(library / f'grpc-google-cloud-bigtable-v2/src', f'grpc-google-cloud-bigtable-v2/src') s.copy(library / f'proto-google-cloud-bigtable-v2/src', f'proto-google-cloud-bigtable-v2/src') make_internal_only(internal_only) java.format_code(f'./grpc-google-cloud-bigtable-v2/src') java.format_code(f'./proto-google-cloud-bigtable-v2/src')
def main(): gapic = gcp.GAPICBazel() generate_data_api(gapic) generate_admin_api(gapic) java.format_code(f'./google-cloud-bigtable/src') java.common_templates(excludes=[ '.gitignore', 'README.md', '.kokoro/presubmit/integration.cfg', # todo remove once template is updated '.github/ISSUE_TEMPLATE/bug_report.md', 'CONTRIBUTING.md', ])
def generate_admin_api(gapic, license): library = gapic.java_library( service='bigtable-admin', version='v2', config_path='/google/bigtable/admin/artman_bigtableadmin.yaml', artman_output_name='') # Excludes are relative to source `gapic-google-cloud-bigtable-v2/src` excludes = [ "main/java/com/google/cloud/bigtable/admin/v2/package-info.java", ] # Paths are relative to the destination, which is the current working directory internal_only = [ 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java', ] package_name = f'com.google.cloud.bigtable.admin.v2' java.fix_proto_headers(library / f'proto-google-cloud-bigtable-admin-v2') # java.fix_grpc_headers(library / f'grpc-google-cloud-bigtable-admin-v2', package_name) ##todo replace with fix_grpc_headers s.replace(library / f'grpc-google-cloud-bigtable-admin-v2/src/**/*.java', f"package com.google.bigtable.admin.v2;", f"{license}package com.google.bigtable.admin.v2;") s.copy(library / f'gapic-google-cloud-bigtable-admin-v2/src', 'google-cloud-bigtable/src', excludes=excludes) s.copy(library / f'grpc-google-cloud-bigtable-admin-v2/src', f'grpc-google-cloud-bigtable-admin-v2/src') s.copy(library / f'proto-google-cloud-bigtable-admin-v2/src', f'proto-google-cloud-bigtable-admin-v2/src') make_internal_only(internal_only) java.format_code(f'./grpc-google-cloud-bigtable-admin-v2/src') java.format_code(f'./proto-google-cloud-bigtable-admin-v2/src')
def generate_client(service, version, proto_path=None, bazel_target=None, package=None, include_gapic=True): library = gapic.java_library( service=service, version=version, proto_path=proto_path if proto_path else f'google/{service}/{version}', bazel_target=bazel_target if bazel_target else f'//google/{service}/{version}:google-cloud-{service}-{version}-java', ) library = library / f"google-cloud-{service}-{version}-java" s.replace( library / f'proto-google-cloud-{service}-{version}-java/src/**/*.java', protobuf_header, f'{license_header}{protobuf_header}') if service == "firestore-admin": s.replace( library / f'grpc-google-cloud-{service}-{version}-java/src/**/*.java', bad_license_header, license_header) s.replace( library / f'proto-google-cloud-{service}-{version}-java/src/**/*.java', bad_license_header, license_header) pkg = package if package else f'com.google.{service}.{version}' s.replace( library / f'grpc-google-cloud-{service}-{version}-java/src/**/*.java', f'package {pkg};', f'{license_header}package {pkg};') s.copy(library / f'grpc-google-cloud-{service}-{version}-java/src', f'grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}-java/src', f'proto-google-cloud-{service}-{version}/src') java.format_code(f'grpc-google-cloud-{service}-{version}/src') java.format_code(f'proto-google-cloud-{service}-{version}/src') if include_gapic and service == "firestore-admin": s.copy(library / f'gapic-google-cloud-{service}-{version}-java/src', 'google-cloud-firestore-admin/src') java.format_code(f'google-cloud-firestore-admin/src') else: s.copy(library / f'gapic-google-cloud-{service}-{version}-java/src', 'google-cloud-firestore/src') java.format_code(f'google-cloud-firestore/src') return library
def main(): gapic = gcp.GAPICBazel() generate_data_api(gapic) generate_admin_api(gapic) java.format_code(f'./google-cloud-bigtable/src') java.common_templates(excludes=[ '.gitignore', '.kokoro/presubmit/integration.cfg', '.kokoro/nightly/integration.cfg', '.kokoro/presubmit/samples.cfg', '.kokoro/nightly/samples.cfg', # todo remove once template is updated '.github/ISSUE_TEMPLATE/bug_report.md', 'CONTRIBUTING.md', # exclude autogen 'codecov.yaml' # needed for extraFiles '.github/release-please.yml', ])
def main(): gapic = gcp.GAPICGenerator() # License header license = """ /* * Copyright 2019 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 * * https://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. */ """ generate_data_api(gapic, license) generate_admin_api(gapic, license) java.format_code(f'./google-cloud-bigtable/src') common_templates = gcp.CommonTemplates() templates = common_templates.java_library() s.copy( templates, excludes=[ '.gitignore', 'README.md', '.kokoro/presubmit/integration.cfg', # todo remove once template is updated '.github/ISSUE_TEMPLATE/bug_report.md', 'CONTRIBUTING.md', ])
def generate_data_api(gapic): library = gapic.java_library( service='bigtable', version='v2', config_path='/google/bigtable/artman_bigtable.yaml', artman_output_name='') # Excludes are relative to source `gapic-google-cloud-bigtable-v2/src` excludes = [ "build.gradle", "pom.xml", "README.md", "src/main/java/com/google/cloud/bigtable/data/v2/package-info.java", "src/main/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClient.java", "src/main/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataSettings.java", "src/test/java/com/google/cloud/bigtable/data/v2/BaseBigtableDataClientTest.java", "src/test/java/com/google/cloud/bigtable/data/v2/MockBigtable.java", "src/test/java/com/google/cloud/bigtable/data/v2/MockBigtableImpl.java", ] # Paths are relative to the destination, which is the current working directory internal_only = [ "src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStub.java", 'src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java', "src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableStub.java", "src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableCallableFactory.java", ] s.copy(library / 'gapic-google-cloud-bigtable-v2', '.', excludes=excludes) s.copy(library / 'grpc-google-cloud-bigtable-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-v2/src') s.copy(library / 'proto-google-cloud-bigtable-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-v2/src') make_internal_only(internal_only) java.format_code('../../google-api-grpc/grpc-google-cloud-bigtable-v2/src') java.format_code('../../google-api-grpc/proto-google-cloud-bigtable-v2/src')
def generate_client(service, version, config_path): library = gapic.java_library( service=service, version=version, config_path=config_path, artman_output_name='') s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') java.format_code('./src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')
def generate_client(service, version, config_path, package, include_gapic=True): library = gapic.java_library( service=service, version=version, config_path=config_path, artman_output_name='') s.replace( library / f'proto-google-cloud-{service}-{version}/src/**/*.java', protobuf_header, f'{license_header}{protobuf_header}' ) s.replace( library / f'grpc-google-cloud-{service}-{version}/src/**/*.java', bad_license_header, license_header ) s.replace( library / f'proto-google-cloud-{service}-{version}/src/**/*.java', bad_license_header, license_header ) s.replace( library / f'grpc-google-cloud-{service}-{version}/src/**/*.java', f'package {package};', f'{license_header}package {package};' ) s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'proto-google-cloud-{service}-{version}/src') java.format_code(f'grpc-google-cloud-{service}-{version}/src') java.format_code(f'proto-google-cloud-{service}-{version}/src') if include_gapic: s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'google-cloud-firestore/src') java.format_code(f'google-cloud-firestore/src') return library
service = 'orgpolicy' versions = ['v1'] gapic = gcp.GAPICBazel() library = gapic.java_library( service=service, version='v1', proto_path=f'google/cloud/orgpolicy/v1', bazel_target=f'//google/cloud/orgpolicy/v1:google-cloud-orgpolicy-v1-java', ) library = library / f"google-cloud-orgpolicy-v1-java" java.fix_proto_headers(library / f"proto-google-cloud-orgpolicy-v1-java") s.copy( [library / f"proto-google-cloud-orgpolicy-v1-java/src"], f"proto-google-cloud-orgpolicy-v1/src", required=True, ) java.format_code(f"proto-google-cloud-orgpolicy-v1/src") java.pregenerated_library( service=service, version='v2', path=f'google/cloud/{service}/v2', ) java.common_templates(excludes=[ 'README.md', 'samples/*', '.github/workflows/samples.yaml', ])
""" service = 'datastore' versions = ['v1'] for version in versions: library = gapic.java_library( service=service, version=version, bazel_target= f'//google/{service}/{version}:google-cloud-{service}-{version}-java', proto_path=f'google/{service}/{version}', ) library = library / f'google-cloud-{service}-{version}-java' s.replace( library / f'proto-google-cloud-{service}-{version}-java/src/**/*.java', protobuf_header, f'{license_header}{protobuf_header}') # Datastore only generates protos s.copy(library / f'proto-google-cloud-{service}-{version}-java/src', f'proto-google-cloud-{service}-{version}/src') java.format_code('google-cloud-datastore/src') java.format_code(f'proto-google-cloud-{service}-{version}/src') java.common_templates(excludes=[ 'README.md', ])
gapic = gcp.GAPICBazel() for version in versions: library = gapic.java_library( service=service, version=version, proto_path=f'google/identity/accesscontextmanager/{version}', bazel_target= f'//google/identity/accesscontextmanager/{version}:google-cloud-accesscontextmanager-{version}-java', ) library = library / f"google-cloud-accesscontextmanager-{version}-java" java.fix_proto_headers( library / f"proto-google-cloud-accesscontextmanager-{version}-java") s.copy( [ library / f"proto-google-cloud-accesscontextmanager-{version}-java/src" ], f"proto-google-identity-accesscontextmanager-{version}/src", required=True, ) java.format_code( f"proto-google-identity-accesscontextmanager-{version}/src") java.common_templates(excludes=[ 'README.md', 'samples/*', '.github/workflows/samples.yaml', ])
def generate_admin_api(gapic): library = gapic.java_library( service='bigtable-admin', version='v2', bazel_target= f'//google/bigtable/admin/v2:google-cloud-bigtable-admin-v2-java', proto_path=f'google/bigtable/admin/v2', ) library = library / 'google-cloud-bigtable-admin-v2-java' # Excludes are relative to source `gapic-google-cloud-bigtable-v2/src` excludes = [ "main/java/com/google/cloud/bigtable/admin/v2/package-info.java", ] # Paths are relative to the destination, which is the current working directory internal_only = [ 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java', 'google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java', ] package_name = f'com.google.cloud.bigtable.admin.v2' java.fix_proto_headers(library / f'proto-google-cloud-bigtable-admin-v2-java') java.fix_grpc_headers( library / f'grpc-google-cloud-bigtable-admin-v2-java', package_name) s.copy(library / f'gapic-google-cloud-bigtable-admin-v2-java/src', 'google-cloud-bigtable/src', excludes=excludes) s.copy(library / f'grpc-google-cloud-bigtable-admin-v2-java/src', f'grpc-google-cloud-bigtable-admin-v2/src') s.copy(library / f'proto-google-cloud-bigtable-admin-v2-java/src', f'proto-google-cloud-bigtable-admin-v2/src') #todo: fix in synthtool removing comments with method java.remove_method( f'./grpc-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BigtableInstanceAdminGrpc.java', "public UnaryCallSettings<Instance, Instance> updateInstanceSettings()" ) java.remove_method( f'./google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', "/** Returns the builder for the settings used for calls to updateInstance. */" ) java.remove_method( f'./google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', "public UnaryCallSettings.Builder<Instance, Instance> updateInstanceSettings()" ) java.remove_method( f'./google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', "/** Returns the object with the settings used for calls to updateInstance. */" ) java.remove_method( f'./google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java', "public UnaryCallSettings<Instance, Instance> updateInstanceSettings()" ) make_internal_only(internal_only) java.format_code(f'./grpc-google-cloud-bigtable-admin-v2/src') java.format_code(f'./proto-google-cloud-bigtable-admin-v2/src')
import synthtool.languages.java as java service = 'orgpolicy' versions = ['v1'] gapic = gcp.GAPICBazel() for version in versions: library = gapic.java_library( service=service, version=version, proto_path=f'google/cloud/orgpolicy/{version}', bazel_target= f'//google/cloud/orgpolicy/{version}:google-cloud-orgpolicy-{version}-java', ) library = library / f"google-cloud-orgpolicy-{version}-java" java.fix_proto_headers(library / f"proto-google-cloud-orgpolicy-{version}-java") s.copy( [library / f"proto-google-cloud-orgpolicy-{version}-java/src"], f"proto-google-cloud-orgpolicy-{version}/src", required=True, ) java.format_code(f"proto-google-cloud-orgpolicy-{version}/src") java.common_templates(excludes=[ 'README.md', 'samples/*', '.github/workflows/samples.yaml', ])
""" for version in versions: java.bazel_library( service=service, version=version, proto_path=f'google/devtools/containeranalysis/{version}', bazel_target=f'//google/devtools/containeranalysis/{version}:google-cloud-{service}-{version}-java', destination_name='containeranalysis', ) if version == 'v1': # add GrafeasClient import s.replace( f'google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/{version}/ContainerAnalysisClient.java', 'import com.google.iam.v1.TestIamPermissionsResponse;', 'import com.google.iam.v1.TestIamPermissionsResponse;\nimport io.grafeas.v1.GrafeasClient;' ) # add getGrafeasClient() s.replace( f'google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/{version}/ContainerAnalysisClient.java', r'(\s+private final ContainerAnalysisStub stub;.*)', f'\g<1>{get_grafeas_code}' ) java.format_code('google-cloud-containeranalysis/src') java.common_templates()
s.replace([ f"proto-google-cloud-securitycenter-{version}/**/SecurityMarksName.java" ], "newOrganizationAssetBuilder\(", "newOrganizationAssetSecurityMarksBuilder(") s.replace([ f"proto-google-cloud-securitycenter-{version}/**/SecurityMarksName.java" ], "newOrganizationSourceFindingBuilder\(", "newOrganizationSourceFindingSecurityMarksBuilder(") s.replace([ f"proto-google-cloud-securitycenter-{version}/**/SecurityMarksName.java" ], "ofOrganizationAssetName\(", "ofOrganizationAssetSecurityMarksName(") s.replace([ f"proto-google-cloud-securitycenter-{version}/**/SecurityMarksName.java" ], "ofOrganizationSourceFindingName\(", "ofOrganizationSourceFindingSecurityMarksName(") s.replace( [ f"proto-google-cloud-securitycenter-{version}/**/SecurityMarksName.java" ], "OrganizationSourceFindingBuilder", "OrganizationSourceFindingSecurityMarksBuilder", ) java.format_code(f"proto-google-cloud-securitycenter-{version}") s.replace([f"google-cloud-securitycenter/**/SecurityCenterClientTest.java"], "SecurityMarksName.ofOrganizationAssetName", "SecurityMarksName.ofOrganizationAssetSecurityMarksName") java.format_code(f"google-cloud-securitycenter") java.common_templates()
# # 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 import synthtool.gcp as gcp import synthtool.languages.java as java gapic = gcp.DiscoGAPICGenerator() service = 'compute' versions = ['v1'] config_pattern = '/gapic/google/compute/artman_compute.yaml' for version in versions: library = gapic.java_library( service=service, version=version, config_path=config_pattern.format(version=version), artman_output_name='') s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') java.format_code('./src')
s.copy(library / 'grpc-google-cloud-spanner-v1/src', '../../google-api-grpc/grpc-google-cloud-spanner-v1/src') s.copy(library / 'proto-google-cloud-spanner-v1/src', '../../google-api-grpc/proto-google-cloud-spanner-v1/src') library = gapic.java_library( service='spanner', version='v1', config_path='/google/spanner/admin/database/artman_spanner_admin_database.yaml', artman_output_name='') s.copy(library / 'gapic-google-cloud-spanner-admin-database-v1/src', 'src') s.copy(library / 'grpc-google-cloud-spanner-admin-database-v1/src', '../../google-api-grpc/grpc-google-cloud-spanner-admin-database-v1/src') s.copy(library / 'proto-google-cloud-spanner-admin-database-v1/src', '../../google-api-grpc/proto-google-cloud-spanner-admin-database-v1/src') library = gapic.java_library( service='spanner', version='v1', config_path='/google/spanner/admin/instance/artman_spanner_admin_instance.yaml', artman_output_name='') s.copy(library / 'gapic-google-cloud-spanner-admin-instance-v1/src', 'src') s.copy(library / 'grpc-google-cloud-spanner-admin-instance-v1/src', '../../google-api-grpc/grpc-google-cloud-spanner-admin-instance-v1/src') s.copy(library / 'proto-google-cloud-spanner-admin-instance-v1/src', '../../google-api-grpc/proto-google-cloud-spanner-admin-instance-v1/src') java.format_code('./src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-spanner-v1/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-spanner-v1/src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-spanner-admin-database-v1/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-spanner-admin-database-v1/src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-spanner-admin-instance-v1/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-spanner-admin-instance-v1/src')
import synthtool.languages.java as java gapic = gcp.GAPICGenerator() library = gapic.java_library( service='dialogflow', version='v2', config_path=f'/google/cloud/dialogflow/artman_dialogflow_v2.yaml', artman_output_name='') s.copy(library / f'gapic-google-cloud-dialogflow-v2/src', 'src') s.copy(library / f'grpc-google-cloud-dialogflow-v2/src', f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2/src') s.copy(library / f'proto-google-cloud-dialogflow-v2/src', f'../../google-api-grpc/proto-google-cloud-dialogflow-v2/src') # v2beta1 has a weird config name library = gapic.java_library( service='dialogflow', version='v2beta1', config_path=f'/google/cloud/dialogflow/artman_dialogflow_v2beta1_java.yaml', artman_output_name='') s.copy(library / f'gapic-google-cloud-dialogflow-v2beta1/src', 'src') s.copy(library / f'grpc-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src') s.copy(library / f'proto-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/proto-google-cloud-dialogflow-v2beta1/src') java.format_code('./src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-dialogflow-v2/src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-dialogflow-v2beta1/src')
s.replace( library / f'proto-google-cloud-{service}-{version}/src/**/*.java', protobuf_header, f"{license}{protobuf_header}") s.replace(library / f'grpc-google-cloud-{service}-{version}/src/**/*.java', f"package com.google.devtools.cloudtrace.{version};", f"{license}package com.google.devtools.cloudtrace.{version};") s.replace( library / f'proto-google-cloud-{service}-{version}/src/**/*Name.java', bad_license, license) s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'google-cloud-trace/src') s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'proto-google-cloud-{service}-{version}/src') s.copy(library / f'gapic-google-cloud-{service}-{version}/samples/src', 'samples/src') java.format_code(f'./grpc-google-cloud-{service}-{version}/src') java.format_code(f'./proto-google-cloud-{service}-{version}/src') java.format_code('./google-cloud-trace/src') common_templates = gcp.CommonTemplates() templates = common_templates.java_library() s.copy(templates, excludes=[ '.gitignore', 'README.md', ])
# 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 import synthtool.gcp as gcp import synthtool.languages.java as java gapic = gcp.DiscoGAPICGenerator() service = 'compute' versions = ['v1'] config_pattern = '/gapic/google/compute/artman_compute.yaml' for version in versions: library = gapic.java_library( service=service, version=version, config_path=config_pattern.format(version=version), artman_output_name='') s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') java.format_code('./src')
import synthtool.languages.java as java gapic = gcp.GAPICGenerator() data_library = gapic.java_library( service='bigtable', version='v2', config_path='/google/bigtable/artman_bigtable.yaml', artman_output_name='') s.copy(data_library / 'gapic-google-cloud-bigtable-v2/src', 'src') s.copy(data_library / 'grpc-google-cloud-bigtable-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-v2/src') s.copy(data_library / 'proto-google-cloud-bigtable-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-v2/src') java.format_code('../../google-api-grpc/grpc-google-cloud-bigtable-v2/src') java.format_code('../../google-api-grpc/proto-google-cloud-bigtable-v2/src') admin_library = gapic.java_library( service='bigtable-admin', version='v2', config_path='/google/bigtable/admin/artman_bigtableadmin.yaml', artman_output_name='') s.copy(admin_library / 'gapic-google-cloud-bigtable-admin-v2/src', 'src') s.copy(admin_library / 'grpc-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-admin-v2/src') s.copy(admin_library / 'proto-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-admin-v2/src') java.format_code('../../google-api-grpc/grpc-google-cloud-bigtable-admin-v2/src')
*/ @Deprecated public static final String parseProductFromReferenceImageName(String referenceImageName) { return REFERENCE_IMAGE_PATH_TEMPLATE.parse(referenceImageName).get("product"); } /** * Parses the reference_image from the given fully-qualified path which represents a * reference_image resource. * * @deprecated Use the {@link ReferenceImageName} class instead. */ @Deprecated public static final String parseReferenceImageFromReferenceImageName(String referenceImageName) { return REFERENCE_IMAGE_PATH_TEMPLATE.parse(referenceImageName).get("reference_image"); } """ s.replace( "google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java", "private final OperationsClient operationsClient;", f"private final OperationsClient operationsClient;\n{DEPRECATED_RESOURCE_NAME_HELPERS}" ) s.replace( "google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java", "import com.google.api.gax.rpc.UnaryCallable;", "import com.google.api.gax.rpc.UnaryCallable;\nimport com.google.api.pathtemplate.PathTemplate;" ) java.format_code( "google-cloud-vision/src/main/java/com/google/cloud/vision/v1/")
# 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 import synthtool.gcp as gcp import synthtool.languages.java as java gapic = gcp.GAPICGenerator() service = 'pubsub' versions = ['v1'] config_pattern = '/google/pubsub/artman_pubsub.yaml' for version in versions: library = gapic.java_library( service=service, version=version, config_path=config_pattern.format(version=version), artman_output_name='') s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') java.format_code('./src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')
f'//google/spanner/admin/instance/v1:google-cloud-admin-instance-v1-java', ) library = library / f"google-cloud-admin-instance-v1-java" java.fix_proto_headers(library / 'proto-google-cloud-admin-instance-v1-java') java.fix_grpc_headers(library / 'grpc-google-cloud-admin-instance-v1-java', 'com.google.spanner.admin.instance.v1') s.copy(library / 'gapic-google-cloud-admin-instance-v1-java/src', 'google-cloud-spanner/src') s.copy(library / 'grpc-google-cloud-admin-instance-v1-java/src', 'grpc-google-cloud-spanner-admin-instance-v1/src') s.copy(library / 'proto-google-cloud-admin-instance-v1-java/src', 'proto-google-cloud-spanner-admin-instance-v1/src') java.format_code('google-cloud-spanner/src') java.format_code('grpc-google-cloud-spanner-v1/src') java.format_code('proto-google-cloud-spanner-v1/src') java.format_code('grpc-google-cloud-spanner-admin-database-v1/src') java.format_code('proto-google-cloud-spanner-admin-database-v1/src') java.format_code('grpc-google-cloud-spanner-admin-instance-v1/src') java.format_code('proto-google-cloud-spanner-admin-instance-v1/src') java.common_templates(excludes=[ '.kokoro/continuous/common.cfg', '.kokoro/nightly/common.cfg', '.kokoro/nightly/java8-samples.cfg', '.kokoro/nightly/java11-samples.cfg', '.kokoro/nightly/samples.cfg', '.kokoro/presubmit/common.cfg', '.kokoro/presubmit/java8-samples.cfg',
java.fix_proto_headers(library / f'proto-google-cloud-{service}-{version}-java') java.fix_grpc_headers( library / f'grpc-google-cloud-{service}-{version}-java', "") s.replace( library / f'gapic-google-cloud-{service}-{version}-java/src/**/ErrorGroupServiceClient.java', ERROR_GROUP_OVERLOAD_PREVIOUS_METHOD, "\g<1>\n\n" + ERROR_GROUP_OVERLOAD) s.replace( library / f'gapic-google-cloud-{service}-{version}-java/src/**/ErrorGroupServiceClient.java', "import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupName;", "import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupName;\nimport com.google.devtools.clouderrorreporting.v1beta1.GroupName;" ) s.copy(library / f'gapic-google-cloud-{service}-{version}-java/src', f'google-cloud-errorreporting/src') s.copy(library / f'grpc-google-cloud-{service}-{version}-java/src', f'grpc-google-cloud-error-reporting-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}-java/src', f'proto-google-cloud-error-reporting-{version}/src') java.format_code(f'google-cloud-errorreporting/src') java.format_code(f'grpc-google-cloud-error-reporting-{version}/src') java.format_code(f'proto-google-cloud-error-reporting-{version}/src') java.common_templates()
version='v2', config_path=f'/google/cloud/dialogflow/artman_dialogflow_v2.yaml', artman_output_name='') s.copy(library / f'gapic-google-cloud-dialogflow-v2/src', 'src') s.copy(library / f'grpc-google-cloud-dialogflow-v2/src', f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2/src') s.copy(library / f'proto-google-cloud-dialogflow-v2/src', f'../../google-api-grpc/proto-google-cloud-dialogflow-v2/src') # v2beta1 has a weird config name library = gapic.java_library( service='dialogflow', version='v2beta1', config_path=f'/google/cloud/dialogflow/artman_dialogflow_v2beta1_java.yaml', artman_output_name='') s.copy(library / f'gapic-google-cloud-dialogflow-v2beta1/src', 'src') s.copy(library / f'grpc-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src') s.copy(library / f'proto-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/proto-google-cloud-dialogflow-v2beta1/src') java.format_code('./src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-dialogflow-v2/src') java.format_code( f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src') java.format_code( f'../../google-api-grpc/proto-google-cloud-dialogflow-v2beta1/src')
config_pattern = '/google/cloud/automl/artman_automl_{version}.yaml' for version in versions: library = gapic.java_library( service=service, version=version, config_path=config_pattern.format(version=version), artman_output_name='') package_name = f'com.google.cloud.{service}.{version}' java.fix_proto_headers(library / f'proto-google-cloud-{service}-{version}') java.fix_grpc_headers(library / f'grpc-google-cloud-{service}-{version}', package_name) s.copy(library / f'gapic-google-cloud-{service}-{version}/src', f'google-cloud-{service}/src') s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'proto-google-cloud-{service}-{version}/src') java.format_code(f'google-cloud-{service}/src') java.format_code(f'grpc-google-cloud-{service}-{version}/src') java.format_code(f'proto-google-cloud-{service}-{version}/src') common_templates = gcp.CommonTemplates() templates = common_templates.java_library() s.copy(templates, excludes=[ '.gitignore', 'README.md', ])
java.remove_method( "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java", "public static List<InspectTemplateName> parseList(List<String> formattedStrings)" ) java.remove_method( "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/InspectTemplateName.java", "public static List<String> toStringList(List<InspectTemplateName> values)" ) java.remove_method( "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java", "public static List<DeidentifyTemplateName> parseList(List<String> formattedStrings)" ) java.remove_method( "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/DeidentifyTemplateName.java", "public static List<String> toStringList(List<DeidentifyTemplateName> values)" ) java.remove_method( "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java", "public static List<StoredInfoTypeName> parseList(List<String> formattedStrings)" ) java.remove_method( "proto-google-cloud-dlp-v2/src/main/java/com/google/privacy/dlp/v2/StoredInfoTypeName.java", "public static List<String> toStringList(List<StoredInfoTypeName> values)") java.format_code("proto-google-cloud-dlp-v2") java.common_templates(excludes=[ '.kokoro/presubmit/samples.cfg', '.kokoro/nightly/samples.cfg', '.kokoro/build.sh', ])
# 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 import synthtool.gcp as gcp import synthtool.languages.java as java gapic = gcp.GAPICGenerator() common_templates = gcp.CommonTemplates() versions = ['{{version}}'] service = '{{service}}' for version in versions: library = gapic.java_library( service=service, version=version, config_path=f'{{config_path}}', artman_output_name='') s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') java.format_code('./src') java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')
s.copy(src_output / "src/com", "proto-google-iam-v1/src/main/java/com") def build_grpc(target): """Build a grpc build target and copy all generate source files.""" output = bazel_build( target=target, cwd=googleapis, ) src_output = Path(tempfile.mkdtemp()) for proto_jar in output.glob("*grpc-src.jar"): logger.debug(f"unzipping: {os.path.basename(proto_jar)}") shell.run(["unzip", "-o", proto_jar, "-d", src_output / "src"]) java.fix_grpc_headers(src_output, "") s.copy(src_output / "src/com", "grpc-google-iam-v1/src/main/java/com") for version in versions: build_proto(f"//google/iam/{version}:iam_java_proto") build_proto(f"//google/iam/{version}/logging:logging_java_proto") build_grpc(f"//google/iam/{version}:iam_java_grpc") java.format_code(f"proto-google-iam-{version}/src") java.format_code(f"grpc-google-iam-{version}/src") java.common_templates(excludes=[ 'README.md', 'samples/*', '.github/workflows/samples.yaml', ])