Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: promote Language to v1 #7385

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .repo-metadata-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@
"Language": {
"language": "php",
"distribution_name": "google/cloud-language",
"release_level": "preview",
"release_level": "stable",
"client_documentation": "https://cloud.google.com/php/docs/reference/cloud-language/latest",
"library_type": "GAPIC_COMBO",
"api_shortname": "language"
Expand Down
6 changes: 3 additions & 3 deletions Core/src/ServiceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Google\Cloud\BigQuery\BigQueryClient;
use Google\Cloud\Datastore\DatastoreClient;
use Google\Cloud\Firestore\FirestoreClient;
use Google\Cloud\Language\LanguageClient;
use Google\Cloud\Language\V2\Client\LanguageServiceClient;
use Google\Cloud\Logging\LoggingClient;
use Google\Cloud\PubSub\PubSubClient;
use Google\Cloud\Spanner\SpannerClient;
Expand Down Expand Up @@ -211,11 +211,11 @@ public function logging(array $config = [])
*
* @param array $config [optional] Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the available options.
* @return LanguageClient
* @return LanguageServiceClient
*/
public function language(array $config = [])
{
return $this->createClient(LanguageClient::class, 'language', $config);
return $this->createClient(LanguageServiceClient::class, 'language', $config);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Language/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
deep-copy-regex:
- source: /google/cloud/language/(.*)/.*-php/(.*)
- source: /google/cloud/language/(v2|v1)/.*-php/(.*)
dest: /owl-bot-staging/Language/$1/$2
api-name: Language
5 changes: 2 additions & 3 deletions Language/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ foreach ($tokens as $token) {

### Version

This component is considered beta. As such, it should be expected to be mostly
stable and we're working towards a release candidate. We will address issues
and requests with a higher priority.
This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in
any minor or patch releases. We will address issues and requests with the highest priority.

### Next Steps

Expand Down
71 changes: 28 additions & 43 deletions Language/owlbot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC
# Copyright 2023 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,48 +30,33 @@
# Added so that we can pass copy_excludes in the owlbot_main() call
_tracked_paths.add(src)

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


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

types = {
'new LanguageServiceClient': r'new Google\\Cloud\\Language\\'+ version + r'\\LanguageServiceClient',
'new Document': r'new Google\\Cloud\\Language\\'+ version + r'\\Document',
'new Features': r'new Google\\Cloud\\Language\\'+ version + r'\\AnnotateTextRequest\\Features',
}

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

### [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"
php.owlbot_main(
src=src,
dest=dest,
copy_excludes=[
src / "**/[A-Z]*_*.php",
]
)

### [END] protoc backwards compatibility fixes

# fix relative cloud.google.com links
# remove class_alias code
s.replace(
"src/**/V*/**/*.php",
r"(.{0,})\]\((/.{0,})\)",
r"\1](https://cloud.google.com\2)"
)
"src/V*/**/*.php",
r"^// Adding a class alias for backwards compatibility with the previous class name.$"
+ "\n"
+ r"^class_alias\(.*\);$"
+ "\n",
'')

# format generated clients
subprocess.run([
'npm',
'exec',
'--yes',
'--package=@prettier/plugin-php@^0.16',
'--',
'prettier',
'**/Client/*',
'--write',
'--parser=php',
'--single-quote',
'--print-width=120'])
16 changes: 0 additions & 16 deletions Language/phpunit-snippets.xml.dist

This file was deleted.

Loading
Loading