Skip to content

Commit

Permalink
chore: readonly fix in owlbot (#5430)
Browse files Browse the repository at this point in the history
* add ReadOnly fix to Spanner owlbot

* add ReadOnly fix to Datastore/Firestore owlbot
  • Loading branch information
bshaffer authored Aug 2, 2022
1 parent 6a8ac25 commit 8389959
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
19 changes: 16 additions & 3 deletions Datastore/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
# Added so that we can pass copy_excludes in the owlbot_main() call
_tracked_paths.add(src)

php.owlbot_main(src=src, dest=dest)


php.owlbot_main(
src=src,
dest=dest,
copy_excludes=[
src / "src/V1/TransactionOptions/ReadOnly.php"
]
)

# document and utilize apiEndpoint instead of serviceAddress
s.replace(
Expand Down Expand Up @@ -68,6 +72,15 @@
search,
replace)

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

### [START] protoc backwards compatibility fixes

# roll back to private properties.
Expand Down
10 changes: 10 additions & 0 deletions Firestore/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
copy_excludes=[
src / '*/src/V1/FirestoreClient.php',
src / '*/src/Admin/V1/FirestoreAdminClient.php',
src / "*/src/V1/TransactionOptions/ReadOnly.php",
]
)

Expand Down Expand Up @@ -115,6 +116,15 @@
r'@group admin',
'@group firestore-admin')

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

### [START] protoc backwards compatibility fixes

# roll back to private properties.
Expand Down
14 changes: 11 additions & 3 deletions Spanner/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
src=src,
dest=dest,
copy_excludes=[
src / "*/src/V1/SpannerClient.php"
src / "*/src/V1/SpannerClient.php",
src / "*/src/V1/TransactionOptions/ReadOnly.php",
]
)



# Spanner Database Admin also lives here
admin_library = Path(f"../{php.STAGING_DIR}/Spanner/v1/Admin/Database/v1").resolve()

Expand Down Expand Up @@ -108,6 +107,15 @@
'@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.$"
+ "\n"
+ r"^class_alias\(PBReadOnly::class, __NAMESPACE__ . '\\ReadOnly'\);$"
+ "\n",
'')

## START fixing commit() breaking change

# move $mutations back into commit() signature
Expand Down

0 comments on commit 8389959

Please sign in to comment.