Skip to content

Commit

Permalink
chore: update synth replacements to fix copyright dates (#2570)
Browse files Browse the repository at this point in the history
* chore: update synth replacements to fix copyright dates

* fix firestore
  • Loading branch information
jdpedrie authored and dwsupplee committed Jan 16, 2020
1 parent fe62c50 commit ff460df
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 53 deletions.
32 changes: 20 additions & 12 deletions AutoMl/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,26 @@
)

# fix year
s.replace(
'**/Gapic/*GapicClient.php',
r'Copyright \d{4}',
r'Copyright 2019')
s.replace(
'tests/**/V1beta1/*Test.php',
r'Copyright \d{4}',
r'Copyright 2019')
s.replace(
'tests/**/V1/*Test.php',
r'Copyright \d{4}',
r'Copyright 2019')
clients = ['AutoMl', 'PredictionService']
versions = ['V1', 'V1beta1']
for client in clients:
for version in versions:
s.replace(
f'src/{version}/Gapic/{client}GapicClient.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
f'src/{version}/{client}Client.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
f'src/{version}/{client}GrpcClient.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
f'tests/**/{version}/{client}ClientTest.php',
r'Copyright \d{4}',
'Copyright 2019')

# temporary namespace fix for V1
s.replace(
Expand Down
69 changes: 28 additions & 41 deletions Firestore/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,47 +97,34 @@
r"public function \1Value"
)

# fix year
s.replace(
'**/V1beta1/Gapic/*GapicClient.php',
r'Copyright \d{4}',
'Copyright 2017')
s.replace(
'**/V1beta1/FirestoreClient.php',
r'Copyright \d{4}',
'Copyright 2017')
s.replace(
'tests/**/V1beta1/*Test.php',
r'Copyright \d{4}',
'Copyright 2018')

# fix year
s.replace(
'**/V1/Gapic/*GapicClient.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
'**/V1/FirestoreClient.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
'tests/**/V1/*Test.php',
r'Copyright \d{4}',
'Copyright 2019')

# fix year
s.replace(
'src/Admin/V1/Gapic/*GapicClient.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
'src/Admin/V1/FirestoreAdminGrpcClient.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
'tests/Unit/Admin/V1/FirestoreAdminClientTest.php',
r'Copyright \d{4}',
'Copyright 2019')
yearFixes = [
{
"year": "2017",
"files": [
"src/V1beta1/Gapic/*GapicClient.php",
"src/V1beta1/*Client.php",
"tests/**/V1beta1/*Test.php"
]
}, {
"year": "2019",
"files": [
"src/V1/Gapic/*GapicClient.php",
"src/V1/*Client.php",
"tests/**/V1/*Test.php",
"src/Admin/V1/*Client.php",
'src/Admin/V1/Gapic/*GapicClient.php',
]
}
]

for fix in yearFixes:
year = fix.get("year")
for path in fix.get("files"):
s.replace(
path,
r'Copyright \d{4}',
f'Copyright {year}'
)

# fix test group
s.replace(
Expand Down
11 changes: 11 additions & 0 deletions Talent/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@
r'Copyright \d{4}',
r'Copyright 2019')

clients = ['ApplicationService', 'CompanyService', 'Completion', 'EventService', 'JobService', 'ProfileService', 'TenantService']
for client in clients:
s.replace(
f'src/V*/{client}Client.php',
r'Copyright \d{4}',
'Copyright 2019')
s.replace(
f'src/V*/{client}GrpcClient.php',
r'Copyright \d{4}',
'Copyright 2019')

# Use correct namespace
s.replace(
'src/V4beta1/Gapic/*.php',
Expand Down
4 changes: 4 additions & 0 deletions WebRisk/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
'**/Gapic/*GapicClient.php',
r'Copyright \d{4}',
r'Copyright 2019')
s.replace(
'**/*Client.php',
r'Copyright \d{4}',
r'Copyright 2019')
s.replace(
'tests/**/V1beta1/*Test.php',
r'Copyright \d{4}',
Expand Down

0 comments on commit ff460df

Please sign in to comment.