Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Core/tests/Snippet/ServiceBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function serviceBuilderMethods()
{
return [
['bigQuery', BigQueryClient::class, 'bigQuery'],
['datastore', DatastoreClient::class, 'datastore'],
['firestore', FirestoreClient::class, 'firestore', true],
['logging', LoggingClient::class, 'logging'],
['language', LanguageClient::class, 'language'],
Expand Down
6 changes: 1 addition & 5 deletions Core/tests/Unit/ServiceBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Google\Cloud\Core\ServiceBuilder;
use Google\Cloud\Core\Testing\CheckForClassTrait;
use Google\Cloud\Core\Testing\GrpcTestTrait;
use Google\Cloud\Datastore\DatastoreClient;
use Google\Cloud\Firestore\FirestoreClient;
use Google\Cloud\Language\LanguageClient;
use Google\Cloud\Logging\LoggingClient;
Expand Down Expand Up @@ -147,10 +146,7 @@ public function serviceProvider()
[
'bigQuery',
BigQueryClient::class
], [
'datastore',
DatastoreClient::class
], [
],[
'firestore',
FirestoreClient::class,
[],
Expand Down
3 changes: 2 additions & 1 deletion Datastore/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"squizlabs/php_codesniffer": "2.*",
"phpdocumentor/reflection": "^5.3.3||^6.0",
"phpdocumentor/reflection-docblock": "^5.3",
"erusev/parsedown": "^1.6"
"erusev/parsedown": "^1.6",
"dg/bypass-finals": "^1.9"
},
"extra": {
"component": {
Expand Down
76 changes: 19 additions & 57 deletions Datastore/owlbot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,65 +30,27 @@
# Added so that we can pass copy_excludes in the owlbot_main() call
_tracked_paths.add(src)

php.owlbot_main(
src=src,
dest=dest,
copy_excludes=[
src / "*/proto/src/Google/Cloud/Datastore/V1/TransactionOptions/ReadOnly.php"
]
)
php.owlbot_main(src=src, dest=dest)


# Fix class references in gapic samples
for version in ['V1']:
pathExpr = 'src/' + version + '/Gapic/DatastoreGapicClient.php'

types = {
'= new DatastoreClient': r'= new Google\\Cloud\\Datastore\\' + version + r'\\DatastoreClient',
'= Mode::': r'= Google\\Cloud\\Datastore\\' + version + r'\\CommitRequest\\Mode::',
'new PartitionId': r'new Google\\Cloud\\Datastore\\' + version + r'\\PartitionId',
}

for search, replace in types.items():
s.replace(
pathExpr,
search,
replace)

# remove ReadOnly class_alias code
# remove 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",
r"(.{0,})\]\((/.{0,})\)",
r"\1](https://cloud.google.com\2)"
)

# Address breaking changes
subprocess.run('git show 8ada2c97c72ffabf5c3031021378874f8caa8804 | git apply', shell=True)
# format generated clients
subprocess.run([
'npm',
'exec',
'--yes',
'--package=@prettier/plugin-php@^0.19',
'--',
'prettier',
'**/Client/*',
'--write',
'--parser=php',
'--single-quote',
'--print-width=120'])
2 changes: 1 addition & 1 deletion Datastore/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/Unit/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src</directory>
Expand Down
62 changes: 0 additions & 62 deletions Datastore/src/Connection/ConnectionInterface.php

This file was deleted.

Loading
Loading