Esempio n. 1
0
def test_working_common_templates():
    def assert_valid_xml(file):
        try:
            ET.parse(file)
        except ET.ParseError:
            pytest.fail(f"unable to parse XML: {file}")

    def assert_valid_yaml(file):
        with open(file, "r") as stream:
            try:
                yaml.safe_load(stream)
            except yaml.YAMLError:
                pytest.fail(f"unable to parse YAML: {file}")

    with util.copied_fixtures_dir(FIXTURES / "java_templates" /
                                  "standard") as workdir:
        # generate the common templates
        java.common_templates(template_path=TEMPLATES_PATH)
        assert os.path.isfile("renovate.json")

        # lint xml, yaml files
        # use os.walk because glob ignores hidden directories
        for (dirpath, _, filenames) in os.walk(workdir):
            for file in filenames:
                (_, ext) = os.path.splitext(file)
                if ext == ".xml":
                    assert_valid_xml(os.path.join(dirpath, file))
                elif ext == ".yaml" or ext == ".yml":
                    assert_valid_yaml(os.path.join(dirpath, file))
Esempio n. 2
0
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',
    ])
Esempio n. 3
0
def test_release_please_handle_releases():
    with util.copied_fixtures_dir(FIXTURES / "java_templates" /
                                  "release-please-update"):
        # generate the common templates
        java.common_templates(template_path=TEMPLATES_PATH)

        assert os.path.isfile(".github/release-please.yml")
        with open(".github/release-please.yml") as fp:
            assert (fp.read() == """branches:
- branch: 1.127.12-sp
  bumpMinorPreMajor: true
  handleGHRelease: true
  releaseType: java-lts
bumpMinorPreMajor: true
handleGHRelease: true
releaseType: java-yoshi
""")
Esempio n. 4
0
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 test_working_common_templates():
    def assert_valid_xml(file):
        try:
            ET.parse(file)
        except ET.ParseError:
            pytest.fail(f"unable to parse XML: {file}")

    with tempfile.TemporaryDirectory() as tempdir:
        workdir = shutil.copytree(FIXTURES / "java_templates" / "standard",
                                  Path(tempdir) / "standard")
        cwd = os.getcwd()
        os.chdir(workdir)

        try:
            # generate the common templates
            java.common_templates()
            assert os.path.isfile("README.md")

            # ensure pom.xml files are valid XML
            for file in glob.glob("**/pom.xml", recursive=True):
                assert_valid_xml(file)
        finally:
            os.chdir(cwd)
Esempio n. 6
0
def test_working_common_templates():
    def assert_valid_xml(file):
        try:
            ET.parse(file)
        except ET.ParseError:
            pytest.fail(f"unable to parse XML: {file}")

    def assert_valid_yaml(file):
        with open(file, "r") as stream:
            try:
                yaml.safe_load(stream)
            except yaml.YAMLError:
                pytest.fail(f"unable to parse YAML: {file}")

    with tempfile.TemporaryDirectory() as tempdir:
        workdir = shutil.copytree(
            FIXTURES / "java_templates" / "standard", Path(tempdir) / "standard"
        )
        cwd = os.getcwd()
        os.chdir(workdir)

        try:
            # generate the common templates
            java.common_templates(template_path=TEMPLATES_PATH)
            assert os.path.isfile("README.md")

            # lint xml, yaml files
            # use os.walk because glob ignores hidden directories
            for (dirpath, _, filenames) in os.walk(tempdir):
                for file in filenames:
                    (_, ext) = os.path.splitext(file)
                    if ext == ".xml":
                        assert_valid_xml(os.path.join(dirpath, file))
                    elif ext == ".yaml" or ext == ".yml":
                        assert_valid_yaml(os.path.join(dirpath, file))
        finally:
            os.chdir(cwd)
Esempio n. 7
0
# Copyright 2021 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.

import synthtool as s
from synthtool.languages import java

for library in s.get_staging_dirs():
    # put any special-case replacements here
    s.move(library)

s.remove_staging_dirs()
java.common_templates(
    excludes=[".kokoro/dependencies.sh", ".github/CODEOWNERS"])
Esempio n. 8
0
        '**/TopicAdminClient.java',
        LIST_TOPIC_SUBSCRIPTIONS_PREVIOUS,
        "\g<1>\n\n" + LIST_TOPIC_SUBSCRIPTIONS
    )

    s.replace(
        '**/TopicAdminClient.java',
        GET_TOPIC_PREVIOUS,
        "\g<1>\n\n" + GET_TOPIC
    )

    s.replace(
        '**/SubscriptionAdminClient.java',
        CREATE_SUBSCRIPTION_PREVIOUS,
        "\g<1>\n\n" + CREATE_SUBSCRIPTION
    )

    s.replace(
        '**/*AdminClient.java',
        PACKAGE,
        PACKAGE + '\n\n' + IMPORT_PROJECT_TOPIC_NAME + '\n'
    )

    java.format_code('google-cloud-pubsub/src')
    java.format_code(f'grpc-google-cloud-{service}-{version}/src')
    java.format_code(f'proto-google-cloud-{service}-{version}/src')

java.common_templates(excludes=[
  ".github/workflows/samples.yaml",
])
Esempio n. 9
0
# Copyright 2021 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.

import synthtool as s
from synthtool.languages import java


for library in s.get_staging_dirs():
    # put any special-case replacements here
    s.move(library)

s.remove_staging_dirs()
java.common_templates(excludes=["README.md", ".kokoro/build.sh"])
    java.remove_method(
        'owl-bot-staging/v1/proto-google-cloud-bigquerydatatransfer-v1/src/main/java/com/google/cloud/bigquery/datatransfer/v1/DataSourceName.java',
        'public static List<DataSourceName> parseList(List<String> formattedStrings)'
    )
    java.remove_method(
        'owl-bot-staging/v1/proto-google-cloud-bigquerydatatransfer-v1/src/main/java/com/google/cloud/bigquery/datatransfer/v1/DataSourceName.java',
        'public static List<String> toStringList(List<DataSourceName> values)')
    java.remove_method(
        'owl-bot-staging/v1/proto-google-cloud-bigquerydatatransfer-v1/src/main/java/com/google/cloud/bigquery/datatransfer/v1/TransferConfigName.java',
        'public static List<TransferConfigName> parseList(List<String> formattedStrings)'
    )
    java.remove_method(
        'owl-bot-staging/v1/proto-google-cloud-bigquerydatatransfer-v1/src/main/java/com/google/cloud/bigquery/datatransfer/v1/TransferConfigName.java',
        'public static List<String> toStringList(List<TransferConfigName> values)'
    )
    java.remove_method(
        'owl-bot-staging/v1/proto-google-cloud-bigquerydatatransfer-v1/src/main/java/com/google/cloud/bigquery/datatransfer/v1/RunName.java',
        'public static List<RunName> parseList(List<String> formattedStrings)')
    java.remove_method(
        'owl-bot-staging/v1/proto-google-cloud-bigquerydatatransfer-v1/src/main/java/com/google/cloud/bigquery/datatransfer/v1/RunName.java',
        'public static List<String> toStringList(List<RunName> values)')

    s.move(library)

s.remove_staging_dirs()
java.common_templates(excludes=[
    ".kokoro/build.sh",
    ".kokoro/nightly/samples.cfg",
    ".kokoro/presubmit/samples.cfg",
])
Esempio n. 11
0
# 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.languages.java as java

AUTOSYNTH_MULTIPLE_COMMITS = True

service = 'documentai'
versions = ['v1', 'v1beta1', 'v1beta2', 'v1beta3']

for version in versions:
    java.bazel_library(
        service=service,
        version=version,
        destination_name='document-ai',
    )

java.common_templates(exclude=[
    '.kokoro/nightly/samples.cfg',
    '.kokoro/presubmit/samples.cfg',
])
Esempio n. 12
0
# Copyright 2020 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.languages.java as java

AUTOSYNTH_MULTIPLE_COMMITS = True

java.common_templates(excludes=[
    'README.md', 'CONTRIBUTING.md', '.github/ISSUE_TEMPLATE/bug_report.md',
    '.github/snippet-bot.yml', '.github/release-please.yml',
    '.github/workflows/*', '.kokoro/linkage-monitor.sh',
    '.kokoro/presubmit/linkage-monitor.cfg',
    '.kokoro/presubmit/integration.cfg', '.kokoro/nightly/integration.cfg',
    '.kokoro/presubmit/java7.cfg', '.kokoro/continuous/java7.cfg',
    '.kokoro/nightly/java7.cfg', '.kokoro/dependencies.sh', '.kokoro/build.sh',
    '.kokoro/build.bat', 'samples/*', 'renovate.json'
])
Esempio n. 13
0
        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


admin_v1 = generate_client(
    service='firestore-admin',
    version='v1',
    proto_path='google/firestore/admin/v1',
    bazel_target=
    '//google/firestore/admin/v1:google-cloud-firestore-admin-v1-java',
    package='com.google.firestore.admin.v1',
    include_gapic=True)

firestore_v1 = generate_client(service='firestore',
                               version='v1',
                               include_gapic=True)

java.common_templates(excludes=[
    # firestore uses a different project for its integration tests
    # due to the default project running datastore
    '.kokoro/presubmit/integration.cfg',
    '.kokoro/presubmit/samples.cfg',
    '.kokoro/nightly/integration.cfg',
    '.kokoro/nightly/samples.cfg'
])
# 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
#
#     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."""

from synthtool.languages import java

java.common_templates(excludes=[
    'README.md',
    'samples/*',
    'renovate.json',
    # excluding samples ci jobs since there are no samples in this repo
    '.github/workflows/samples.yaml',
    '.github/release-please.yml',
])
Esempio n. 15
0
# 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
import synthtool.gcp as gcp
import synthtool.languages.java as java

service = 'osconfig'
versions = ['v1']

for version in versions:
    java.bazel_library(
        service=service,
        version=version,
        package_pattern='com.google.cloud.{service}.{version}',
        proto_path=f'google/cloud/{service}/{version}',
        bazel_target=
        f'//google/cloud/{service}/{version}:google-cloud-{service}-{version}-java',
        destination_name='os-config',
    )

java.common_templates(excludes=['samples/install-without-bom/*'])
Esempio n. 16
0
# 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.languages.java as java

service = 'pubsublite'
version = 'v1'

library = java.bazel_library(
    service=service,
    version=version,
    bazel_target=f'//google/cloud/{service}/{version}:google-cloud-{service}-{version}-java',
)

java.common_templates(excludes=[
  '.kokoro/*/samples.cfg',
  # TODO: allow when pubsublite is available in libraries-bom
  'samples/install-without-bom/*',
])
# Copyright 2021 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.

import synthtool as s
from synthtool.languages import java

for library in s.get_staging_dirs():
    # put any special-case replacements here
    s.move(library)

s.remove_staging_dirs()
java.common_templates(excludes=[
    "README.md",
    "java.header",
    "checkstyle.xml",
    "license-checks.xml",
    ".github/workflows/samples.yaml",
])
Esempio n. 18
0
# Copyright 2020 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.languages.java as java

AUTOSYNTH_MULTIPLE_COMMITS = True

java.common_templates(excludes=[
    'README.md', '.github/ISSUE_TEMPLATE/bug_report.md',
    '.kokoro/presubmit/integration.cfg', '.kokoro/nightly/integration.cfg',
    '.kokoro/presubmit/java7.cfg', '.kokoro/continuous/java7.cfg',
    '.kokoro/nightly/java7.cfg', '.kokoro/dependencies.sh', '.kokoro/build.sh',
    'samples/*'
])
Esempio n. 19
0
  /**
   * Returns a new GrafeasClient with the same configured settings.
   *
   * @throws IOException
   */
  public GrafeasClient getGrafeasClient() throws IOException {
    return GrafeasClient.create(GrafeasUtils.transformSettings(settings));
  }
"""

for library in s.get_staging_dirs():
    # put any special-case replacements here
    s.replace(
        f'owl-bot-staging/v1/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java',
        'import com.google.iam.v1.TestIamPermissionsResponse;',
        'import com.google.iam.v1.TestIamPermissionsResponse;\nimport io.grafeas.v1.GrafeasClient;'
    )

    # add getGrafeasClient()
    s.replace(
        f'owl-bot-staging/v1/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient.java',
        r'(\s+private final ContainerAnalysisStub stub;.*)',
        f'\g<1>{get_grafeas_code}'
    )
    s.move(library)

s.remove_staging_dirs()
java.common_templates(excludes=[
                      '.kokoro/dependencies.sh',
                  ])
# Copyright 2020 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.languages.java as java

java.common_templates(excludes=[
    "LICENSE",
    "README.md",
    "java.header",
    "checkstyle.xml",
    "renovate.json",
    "license-checks.xml",
    "samples/**",
    ".github/workflows/approve-readme.yaml",
    ".github/workflows/samples.yaml",
])
Esempio n. 21
0
# 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
#
#     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.languages.java as java

AUTOSYNTH_MULTIPLE_COMMITS = True

java.common_templates(excludes=[
    '.kokoro/continuous/java8-samples.cfg',
    '.kokoro/continuous/java11-samples.cfg',
    '.kokoro/nightly/java8-samples.cfg', '.kokoro/nightly/java11-samples.cfg',
    '.kokoro/presubmit/java8-samples.cfg',
    '.kokoro/presubmit/java11-samples.cfg', 'codecov.yaml'
])
Esempio n. 22
0
# 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.languages.java as java

AUTOSYNTH_MULTIPLE_COMMITS = True

java.common_templates(excludes=[
    '.kokoro/nightly/integration.cfg', '.kokoro/presubmit/integration.cfg',
    'CONTRIBUTING.md'
])
Esempio n. 23
0
# Copyright 2021 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.

import synthtool as s
from synthtool.languages import java

for library in s.get_staging_dirs():
    # put any special-case replacements here
    s.move(library)

s.remove_staging_dirs()
java.common_templates(excludes=[
    ".github/workflows/samples.yaml",
    ".github/workflows/auto-release.yaml",
    "samples/*",
    "README.md",
])
Esempio n. 24
0
}

/**
  * 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");
}
"""

for library in s.get_staging_dirs():
    # put any special-case replacements here
    s.replace(
        "owl-bot-staging/v1/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(
        "owl-bot-staging/v1/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;"
    )
    s.move(library)

s.remove_staging_dirs()
java.common_templates(excludes=['.kokoro/nightly/integration.cfg'])
Esempio n. 25
0
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',
])
Esempio n. 26
0
       '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',
    '.kokoro/presubmit/java11-samples.cfg',
    '.kokoro/presubmit/samples.cfg',
    'samples/install-without-bom/pom.xml',
    'samples/snapshot/pom.xml',
    'samples/snippets/pom.xml',
    '.github/CODEOWNERS',
    '.github/sync-repo-settings.yaml',
    '.github/release-please.yml',
    '.github/blunderbuss.yml',
    '.github/workflows/samples.yaml',
    '.kokoro/build.sh',
])
Esempio n. 27
0
    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()
Esempio n. 28
0
        os.remove(
            "owl-bot-staging/v1/proto-google-common-protos/src/main/java/com/google/cloud/audit/BigQueryAuditMetadataOrBuilder.java"
        )
    if os.path.exists(
            "owl-bot-staging/v1/proto-google-common-protos/src/main/java/com/google/cloud/audit/BigQueryAuditMetadataProto.java"
    ):
        os.remove(
            "owl-bot-staging/v1/proto-google-common-protos/src/main/java/com/google/cloud/audit/BigQueryAuditMetadataProto.java"
        )
    if os.path.exists(
            "owl-bot-staging/v1/proto-google-common-protos/src/main/proto/google/cloud/audit/bigquery_audit_metadata.proto"
    ):
        os.remove(
            "owl-bot-staging/v1/proto-google-common-protos/src/main/proto/google/cloud/audit/bigquery_audit_metadata.proto"
        )
    if os.path.exists(
            "owl-bot-staging/v1/proto-google-common-protos/src/main/proto/google/cloud/common_resources.proto"
    ):
        os.remove(
            "owl-bot-staging/v1/proto-google-common-protos/src/main/proto/google/cloud/common_resources.proto"
        )
    s.move(library)

s.remove_staging_dirs()
java.common_templates(excludes=[
    'README.md',
    'samples/*',
    '.github/workflows/samples.yaml',
    '.kokoro/dependencies.sh',
])
Esempio n. 29
0
# 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.languages.java as java

AUTOSYNTH_MULTIPLE_COMMITS = True

java.common_templates(excludes=[
    'README.md',
])
Esempio n. 30
0
# Copyright 2021 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.languages.java as java

java.common_templates(excludes=[
    # TODO: allow when pubsublite-spark is available in libraries-bom
    'samples/install-without-bom/*',
    '.kokoro/build.sh',
    '.kokoro/presubmit/samples.cfg',
    '.kokoro/nightly/samples.cfg',
])