|
| 1 | +# Copyright 2018 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +"""This script is used to synthesize generated parts of this library.""" |
| 16 | + |
| 17 | +import synthtool as s |
| 18 | +import synthtool.gcp as gcp |
| 19 | +import logging |
| 20 | + |
| 21 | +logging.basicConfig(level=logging.DEBUG) |
| 22 | + |
| 23 | +gapic = gcp.GAPICGenerator() |
| 24 | +common = gcp.CommonTemplates() |
| 25 | + |
| 26 | +library = gapic.php_library( |
| 27 | + service='dialogflow', |
| 28 | + version='v2', |
| 29 | + artman_output_name='google-cloud-dialogflow-v2') |
| 30 | + |
| 31 | +# copy all src including partial veneer classes |
| 32 | +s.move(library / 'src') |
| 33 | + |
| 34 | +# copy proto files to src also |
| 35 | +s.move(library / 'proto/src/Google/Cloud/Dialogflow', 'src/') |
| 36 | +s.move(library / 'tests/') |
| 37 | + |
| 38 | +# copy GPBMetadata file to metadata |
| 39 | +s.move(library / 'proto/src/GPBMetadata/Google/Cloud/Dialogflow', 'metadata/') |
| 40 | + |
| 41 | +# fix year |
| 42 | +s.replace( |
| 43 | + '**/Gapic/*GapicClient.php', |
| 44 | + r'Copyright \d{4}', |
| 45 | + 'Copyright 2018') |
| 46 | +for client in ['Agents', 'Contexts', 'EntityTypes', 'Intents', 'SessionEntityTypes', 'Sessions']: |
| 47 | + s.replace( |
| 48 | + f'**/V1/{client}Client.php', |
| 49 | + r'Copyright \d{4}', |
| 50 | + 'Copyright 2018') |
| 51 | +s.replace( |
| 52 | + 'tests/**/V2/*Test.php', |
| 53 | + r'Copyright \d{4}', |
| 54 | + 'Copyright 2018') |
0 commit comments