Skip to content

Commit

Permalink
feat: add new LongRunning client, rename LongRunning namespace (and a…
Browse files Browse the repository at this point in the history
…dd alias for BC) (#6675)
  • Loading branch information
bshaffer committed Apr 10, 2024
1 parent b053b15 commit 2fe9eaf
Show file tree
Hide file tree
Showing 20 changed files with 1,417 additions and 547 deletions.
3 changes: 2 additions & 1 deletion Core/src/Testing/TestHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public static function snippetBootstrap()
'/vendor/',
'/dev/',
new RegexFileFilter('/\w{0,}\/vendor\//'),
new RegexFileFilter('/\w{0,}\/V\d{1,}\w{0,}\//')
new RegexFileFilter('/\w{0,}\/V\d{1,}\w{0,}\//'),
'LongRunning/', // LongRunning doesn't match the GAPIC regex, but should still be excluded
]);
$coverage = new Coverage($scanner);
$coverage->buildListToCover();
Expand Down
2 changes: 1 addition & 1 deletion LongRunning/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
deep-copy-regex:
- source: /google/longrunning/.*-php/src/(.*)
dest: /owl-bot-staging/LongRunning/src/ApiCore/LongRunning/$1
dest: /owl-bot-staging/LongRunning/src/LongRunning/$1
- source: /google/longrunning/.*-php/tests/(.*)
dest: /owl-bot-staging/LongRunning/tests/$1
- source: /google/longrunning/.*-php/proto/src/(.*)
Expand Down
Binary file modified LongRunning/metadata/Longrunning/Operations.php
Binary file not shown.
28 changes: 4 additions & 24 deletions LongRunning/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,11 @@
version_string="longrunning",
)

# Fix namespace for LongRunning GAPIC (ApiCore)
# This is defined in longrunning_gapic.yaml, but not being used by
# gapic-generator-php
# Add an alias for the previous namespace
s.replace(
"src/ApiCore/**/*.php",
r"^namespace Google\\LongRunning(.*);$",
r"namespace Google\\ApiCore\\LongRunning\1;")
s.replace(
"src/ApiCore/LongRunning/OperationsClient.php",
r"^use Google\\LongRunning\\Gapic\\OperationsGapicClient;$",
r"use Google\\ApiCore\\LongRunning\\Gapic\\OperationsGapicClient;")
s.replace(
"tests/**/*.php",
r"\\Google\\LongRunning\\OperationsClient",
r"\\Google\\ApiCore\\LongRunning\\OperationsClient")

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

"src/LongRunning/OperationsClient.php",
r"^}$\n",
r"}\n\nclass_alias('Google\\LongRunning\\OperationsClient', 'Google\\ApiCore\\LongRunning\\OperationsClient');\n")

### [START] protoc backwards compatibility fixes

Expand Down
Loading

0 comments on commit 2fe9eaf

Please sign in to comment.