Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

chore: migrate to owlbot #431

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker:
digest: sha256:a4d7b2cfc6a9d6b378a6b2458740eae15fcab28854bd23dad3a15102d2e47c87
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
32 changes: 32 additions & 0 deletions .github/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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.

docker:
image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest"

deep-remove-regex:
- "/grpc-google-.*/src"
- "/proto-google-.*/src"
- "/google-.*/src"

deep-preserve-regex:
- "/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java"

deep-copy-regex:
- source: "/grafeas/(v.*)/.*-java/proto-google-.*/src"
dest: "/owl-bot-staging/$1/src"
- source: "/grafeas/(v.*)/.*-java/grpc-google-.*/src"
dest: "/owl-bot-staging/$1/src"
- source: "/grafeas/(v.*)/.*-java/gapic-google-.*/src"
dest: "/owl-bot-staging/$1/src"
1 change: 1 addition & 0 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"product_documentation": "https://grafeas.io",
"client_documentation": "https://googleapis.dev/java/google-cloud-clients/latest/index.html?io/grafeas/v1/package-summary.html",
"issue_tracker": "",
"api_description": "n/a",
"release_level": "ga",
"language": "java",
"repo": "googleapis/java-grafeas",
Expand Down
76 changes: 76 additions & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# 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

# License header
license = """
/*
* Copyright 2019 The Grafeas Authors. All rights reserved.
*
* 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.
*/
"""
protobuf_header = "// Generated by the protocol buffer compiler. DO NOT EDIT!"

for library in s.get_staging_dirs():
# put any special-case replacements here
s.replace(
f'owl-bot-staging/v1/src/**/*.java',
f"package io.grafeas.v1;",
f"{license}\npackage io.grafeas.v1;"
)
s.replace(
f'owl-bot-staging/v1/src/**/*.java',
protobuf_header,
f"{license}\n{protobuf_header}"
)


# strip out Google-specific parts
# Remove default scope
s.replace(
f'owl-bot-staging/v1/src/**/GrafeasStubSettings.java',
r'^(.*)ImmutableList\.<String>builder\(\).add\(".*"\)\.build\(\);',
'\g<1>ImmutableList.of();'
)
# Remove default service endpoint
s.replace(
f'owl-bot-staging/v1/src/**/GrafeasStubSettings.java',
' return "containeranalysis.googleapis.com:443";',
' return null;'
)
# Remove default service endpoint javadoc
s.replace(
f'owl-bot-staging/v1/src/**/GrafeasStubSettings.java',
'\s+\*.*default service address.*\n\s+\*.*',
''
)
s.move(library)

s.remove_staging_dirs()
java.common_templates(
excludes=["README.md", "samples/*", ".github/workflows/samples.yaml"]
)
99 changes: 0 additions & 99 deletions synth.py

This file was deleted.