Skip to content

Commit

Permalink
changes to owlbot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Nov 16, 2024
1 parent 8c27502 commit eeba775
Showing 1 changed file with 4 additions and 45 deletions.
49 changes: 4 additions & 45 deletions Spanner/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,56 +70,15 @@
# copy GPBMetadata file to metadata
s.move(admin_library / f'proto/src/GPBMetadata/Google/Spanner', f'metadata/', merge=php._merge)


# Fix test namespaces
s.replace(
'tests/Unit/Admin/Database/*/*.php',
r'namespace Google\\Cloud\\Spanner\\Admin\\Database\\Tests\\Unit',
r'namespace Google\\Cloud\\Spanner\\Tests\\Unit\\Admin\\Database')
# remove class_alias code
s.replace(
'tests/Unit/Admin/Instance/*/*.php',
r'namespace Google\\Cloud\\Spanner\\Admin\\Instance\\Tests\\Unit',
r'namespace Google\\Cloud\\Spanner\\Tests\\Unit\\Admin\\Instance')

# fix test group
s.replace(
'tests/**/Admin/Database/V1/*Test.php',
'@group database',
'@group spanner-admin-database')

s.replace(
'tests/**/Admin/Instance/V1/*Test.php',
'@group instance',
'@group spanner-admin-instance')

# remove ReadOnly class_alias code
s.replace(
"src/V*/**/PBReadOnly.php",
r"^// Adding a class alias for backwards compatibility with the \"readonly\" keyword.$"
"src/V*/**/*.php",
r"^// Adding a class alias for backwards compatibility with the previous class name.$"
+ "\n"
+ r"^class_alias\(PBReadOnly::class, __NAMESPACE__ . '\\ReadOnly'\);$"
+ r"^class_alias\(.*\);$"
+ "\n",
'')

### [START] protoc backwards compatibility fixes

# roll back to private properties.
s.replace(
"src/**/V*/**/*.php",
r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$",
r"""Generated from protobuf field \1
*/
private $""")

# Replace "Unwrapped" with "Value" for method names.
s.replace(
"src/**/V*/**/*.php",
r"public function ([s|g]\w{3,})Unwrapped",
r"public function \1Value"
)

### [END] protoc backwards compatibility fixes

# fix relative cloud.google.com links
s.replace(
"src/**/V*/**/*.php",
Expand Down

0 comments on commit eeba775

Please sign in to comment.