From 2ef9c08755d20f91cc75b1b2dd822bd85284ad7b Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 13:27:42 -0400 Subject: [PATCH 1/9] feat: add libraries_bom_version --- synthtool/languages/java.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/synthtool/languages/java.py b/synthtool/languages/java.py index 90bd0eb8f..55556c35e 100644 --- a/synthtool/languages/java.py +++ b/synthtool/languages/java.py @@ -62,6 +62,8 @@ \\*/ """ DEFAULT_MIN_SUPPORTED_JAVA_VERSION = 8 +METADATA = "metadata" +LIBRARIES_BOM_VERSION = "libraries_bom_version" def format_code( @@ -490,7 +492,7 @@ def common_templates( :param kwargs: Additional options for CommonTemplates.java_library() """ metadata = _common_template_metadata() - kwargs["metadata"] = metadata + kwargs[METADATA] = metadata # Generate flat to tell this repository is a split repo that have migrated # to monorepo. The owlbot.py in the monorepo sets monorepo=True. @@ -499,6 +501,8 @@ def common_templates( split_repo = not monorepo repo_metadata = metadata["repo"] repo_short = repo_metadata["repo_short"] + if LIBRARIES_BOM_VERSION in kwargs: + kwargs[METADATA][LIBRARIES_BOM_VERSION] = kwargs.get(LIBRARIES_BOM_VERSION) # Special libraries that are not GAPIC_AUTO but in the monorepo special_libs_in_monorepo = [ "java-translate", From a5f263491a06b606cf9f4b0532807183351dbaa9 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 14:35:13 -0400 Subject: [PATCH 2/9] add unit tests --- .../gcp/templates/java_library/README.md | 6 +- .../java_templates/readme/.repo-metadata.json | 18 ++ ...EADME-with-libraries-bom-version-golden.md | 219 ++++++++++++++++++ tests/test_language_java.py | 11 + 4 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/java_templates/readme/.repo-metadata.json create mode 100644 tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md diff --git a/synthtool/gcp/templates/java_library/README.md b/synthtool/gcp/templates/java_library/README.md index e849a9714..9c4f2ef03 100644 --- a/synthtool/gcp/templates/java_library/README.md +++ b/synthtool/gcp/templates/java_library/README.md @@ -44,7 +44,11 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom + {%- if 'libraries_bom_version' in metadata %} + {{ metadata['libraries_bom_version'] }} + {%- else %} {{ metadata['latest_bom_version'] }} + {%- endif %} pom import @@ -285,4 +289,4 @@ Java is a registered trademark of Oracle and/or its affiliates. [cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained [apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries [oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html -[g-c-j]: http://github.com/googleapis/google-cloud-java +[g-c-j]: http://github.com/googleapis/google-cloud-java \ No newline at end of file diff --git a/tests/fixtures/java_templates/readme/.repo-metadata.json b/tests/fixtures/java_templates/readme/.repo-metadata.json new file mode 100644 index 000000000..0688c36d3 --- /dev/null +++ b/tests/fixtures/java_templates/readme/.repo-metadata.json @@ -0,0 +1,18 @@ +{ + "api_shortname": "cloudasset", + "name_pretty": "Cloud Asset Inventory", + "product_documentation": "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview", + "api_reference": "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview", + "api_description": "provides inventory services based on a time series database. This database keeps a five week history of Google Cloud asset metadata. The Cloud Asset Inventory export service allows you to export all asset metadata at a certain timestamp or export event change history during a timeframe.", + "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-asset/latest/overview", + "issue_tracker": "https://issuetracker.google.com/issues/new?component=187210&template=0", + "release_level": "stable", + "transport": "both", + "requires_billing": true, + "language": "java", + "repo": "googleapis/google-cloud-java", + "repo_short": "java-asset", + "distribution_name": "com.google.cloud:google-cloud-asset", + "library_type": "GAPIC_AUTO", + "api_id": "cloudasset.googleapis.com" +} \ No newline at end of file diff --git a/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md b/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md new file mode 100644 index 000000000..95805e87a --- /dev/null +++ b/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md @@ -0,0 +1,219 @@ +# Google Cloud Asset Inventory Client for Java + +Java idiomatic client for [Cloud Asset Inventory][product-docs]. + +[![Maven][maven-version-image]][maven-version-link] +![Stability][stability-image] + +- [Product Documentation][product-docs] +- [Client Library Documentation][javadocs] + + +## Quickstart + + +If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: + +```xml + + + + com.google.cloud + libraries-bom + 26.36.0 + pom + import + + + + + + + com.google.cloud + google-cloud-asset + +``` + +If you are using Maven without the BOM, add this to your dependencies: + + + +```xml + + com.google.cloud + google-cloud-asset + 3.45.0 + +``` + +If you are using Gradle without BOM, add this to your dependencies: + +```Groovy +implementation 'com.google.cloud:google-cloud-asset:3.45.0' +``` + +If you are using SBT, add this to your dependencies: + +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-asset" % "3.45.0" +``` + + +## Authentication + +See the [Authentication][authentication] section in the base directory's README. + +## Authorization + +The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired Cloud Asset Inventory APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the Cloud Asset Inventory API calls. + +## Getting Started + +### Prerequisites + +You will need a [Google Cloud Platform Console][developer-console] project with the Cloud Asset Inventory [API enabled][enable-api]. +You will need to [enable billing][enable-billing] to use Google Cloud Asset Inventory. +[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by +[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line: +`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. + +### Installation and setup + +You'll need to obtain the `google-cloud-asset` library. See the [Quickstart](#quickstart) section +to add `google-cloud-asset` as a dependency in your code. + +## About Cloud Asset Inventory + + +[Cloud Asset Inventory][product-docs] provides inventory services based on a time series database. This database keeps a five week history of Google Cloud asset metadata. The Cloud Asset Inventory export service allows you to export all asset metadata at a certain timestamp or export event change history during a timeframe. + +See the [Cloud Asset Inventory client library docs][javadocs] to learn how to +use this Cloud Asset Inventory Client Library. + + + + + + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## Transport + +Cloud Asset Inventory uses both gRPC and HTTP/JSON for the transport layer. + +## Supported Java Versions + +Java 8 or above is required for using this client. + +Google's Java client libraries, +[Google Cloud Client Libraries][cloudlibs] +and +[Google Cloud API Libraries][apilibs], +follow the +[Oracle Java SE support roadmap][oracle] +(see the Oracle Java SE Product Releases section). + +### For new development + +In general, new feature development occurs with support for the lowest Java +LTS version covered by Oracle's Premier Support (which typically lasts 5 years +from initial General Availability). If the minimum required JVM for a given +library is changed, it is accompanied by a [semver][semver] major release. + +Java 11 and (in September 2021) Java 17 are the best choices for new +development. + +### Keeping production systems current + +Google tests its client libraries with all current LTS versions covered by +Oracle's Extended Support (which typically lasts 8 years from initial +General Availability). + +#### Legacy support + +Google's client libraries support legacy versions of Java runtimes with long +term stable libraries that don't receive feature updates on a best efforts basis +as it may not be possible to backport all patches. + +Google provides updates on a best efforts basis to apps that continue to use +Java 7, though apps might need to upgrade to current versions of the library +that supports their JVM. + +#### Where to find specific information + +The latest versions and the supported Java versions are identified on +the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` +and on [google-cloud-java][g-c-j]. + +## Versioning + + +This library follows [Semantic Versioning](http://semver.org/). + + + +## Contributing + + +Contributions to this library are always welcome and highly encouraged. + +See [CONTRIBUTING][contributing] for more information how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in +this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more +information. + + +## License + +Apache 2.0 - See [LICENSE][license] for more information. + +## CI Status + +Java Version | Status +------------ | ------ +Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] +Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] +Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] +Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] + +Java is a registered trademark of Oracle and/or its affiliates. + +[product-docs]: https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview +[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-asset/latest/overview +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html +[stability-image]: https://img.shields.io/badge/stability-stable-green +[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-asset.svg +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-asset/3.45.0 +[authentication]: https://github.com/googleapis/google-cloud-java#authentication +[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes +[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles +[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy +[developer-console]: https://console.developers.google.com/ +[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects +[cloud-cli]: https://cloud.google.com/cli +[troubleshooting]: https://github.com/googleapis/google-cloud-java/blob/main/TROUBLESHOOTING.md +[contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE +[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing +[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com +[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png + +[semver]: https://semver.org/ +[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained +[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries +[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html +[g-c-j]: http://github.com/googleapis/google-cloud-java \ No newline at end of file diff --git a/tests/test_language_java.py b/tests/test_language_java.py index 30bf86da4..1d4e30351 100644 --- a/tests/test_language_java.py +++ b/tests/test_language_java.py @@ -107,6 +107,17 @@ def assert_valid_yaml(file): assert_valid_yaml(os.path.join(dirpath, file)) +def test_render_readme_with_libraries_bom_version(): + with util.copied_fixtures_dir(FIXTURES / "java_templates" / "readme"): + java.common_templates( + template_path=TEMPLATES_PATH, monorepo=True, libraries_bom_version="26.36.0" + ) + assert os.path.isfile("README.md") + assert_matches_golden( + "README-with-libraries-bom-version-golden.md", "README.md" + ) + + def test_remove_method(): with tempfile.TemporaryDirectory() as tempdir: shutil.copyfile( From 0cdfe5c50ab7a4bfbf32d3eccffe2d05dbdbd052 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 14:48:54 -0400 Subject: [PATCH 3/9] remove isfile --- tests/test_language_java.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_language_java.py b/tests/test_language_java.py index 1d4e30351..47b83abc4 100644 --- a/tests/test_language_java.py +++ b/tests/test_language_java.py @@ -112,7 +112,6 @@ def test_render_readme_with_libraries_bom_version(): java.common_templates( template_path=TEMPLATES_PATH, monorepo=True, libraries_bom_version="26.36.0" ) - assert os.path.isfile("README.md") assert_matches_golden( "README-with-libraries-bom-version-golden.md", "README.md" ) From 04521036a9748da043e8134bd3bd528eaae786e1 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 15:00:30 -0400 Subject: [PATCH 4/9] add tempdir --- tests/test_language_java.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_language_java.py b/tests/test_language_java.py index 47b83abc4..c84b8b1fd 100644 --- a/tests/test_language_java.py +++ b/tests/test_language_java.py @@ -108,12 +108,13 @@ def assert_valid_yaml(file): def test_render_readme_with_libraries_bom_version(): - with util.copied_fixtures_dir(FIXTURES / "java_templates" / "readme"): + with util.copied_fixtures_dir(FIXTURES / "java_templates" / "readme") as tempdir: java.common_templates( template_path=TEMPLATES_PATH, monorepo=True, libraries_bom_version="26.36.0" ) + os.path.isfile(f"{tempdir}/README.md") assert_matches_golden( - "README-with-libraries-bom-version-golden.md", "README.md" + "README-with-libraries-bom-version-golden.md", f"{tempdir}/README.md" ) From 1eefbc5f40b416074ca6fdc366f9f6aafd026954 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 15:11:12 -0400 Subject: [PATCH 5/9] restore --- tests/test_language_java.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_language_java.py b/tests/test_language_java.py index c84b8b1fd..840b5198a 100644 --- a/tests/test_language_java.py +++ b/tests/test_language_java.py @@ -108,13 +108,13 @@ def assert_valid_yaml(file): def test_render_readme_with_libraries_bom_version(): - with util.copied_fixtures_dir(FIXTURES / "java_templates" / "readme") as tempdir: + with util.copied_fixtures_dir(FIXTURES / "java_templates" / "readme"): java.common_templates( template_path=TEMPLATES_PATH, monorepo=True, libraries_bom_version="26.36.0" ) - os.path.isfile(f"{tempdir}/README.md") + os.path.isfile("README.md") assert_matches_golden( - "README-with-libraries-bom-version-golden.md", f"{tempdir}/README.md" + "README-with-libraries-bom-version-golden.md", "README.md" ) From 67e49f2aae31f9de4f328c661ca2becb40ef0c9c Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 15:26:07 -0400 Subject: [PATCH 6/9] add current dir --- tests/test_language_java.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_language_java.py b/tests/test_language_java.py index 840b5198a..1fe098fc8 100644 --- a/tests/test_language_java.py +++ b/tests/test_language_java.py @@ -114,7 +114,7 @@ def test_render_readme_with_libraries_bom_version(): ) os.path.isfile("README.md") assert_matches_golden( - "README-with-libraries-bom-version-golden.md", "README.md" + "README-with-libraries-bom-version-golden.md", "./README.md" ) From 500cbfe54ce99c389268ec125a53e9ecba516b9d Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 15:34:11 -0400 Subject: [PATCH 7/9] restore template --- synthtool/gcp/templates/java_library/README.md | 2 +- .../readme/README-with-libraries-bom-version-golden.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/synthtool/gcp/templates/java_library/README.md b/synthtool/gcp/templates/java_library/README.md index 9c4f2ef03..cf3cb235c 100644 --- a/synthtool/gcp/templates/java_library/README.md +++ b/synthtool/gcp/templates/java_library/README.md @@ -289,4 +289,4 @@ Java is a registered trademark of Oracle and/or its affiliates. [cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained [apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries [oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html -[g-c-j]: http://github.com/googleapis/google-cloud-java \ No newline at end of file +[g-c-j]: http://github.com/googleapis/google-cloud-java diff --git a/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md b/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md index 95805e87a..a01bb4407 100644 --- a/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md +++ b/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md @@ -216,4 +216,4 @@ Java is a registered trademark of Oracle and/or its affiliates. [cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained [apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries [oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html -[g-c-j]: http://github.com/googleapis/google-cloud-java \ No newline at end of file +[g-c-j]: http://github.com/googleapis/google-cloud-java From 826d2a62a482fe70a068ab890c5698bbfaa564ac Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 15:44:44 -0400 Subject: [PATCH 8/9] remove unit test --- .../java_templates/readme/.repo-metadata.json | 18 -- ...EADME-with-libraries-bom-version-golden.md | 219 ------------------ tests/test_language_java.py | 11 - 3 files changed, 248 deletions(-) delete mode 100644 tests/fixtures/java_templates/readme/.repo-metadata.json delete mode 100644 tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md diff --git a/tests/fixtures/java_templates/readme/.repo-metadata.json b/tests/fixtures/java_templates/readme/.repo-metadata.json deleted file mode 100644 index 0688c36d3..000000000 --- a/tests/fixtures/java_templates/readme/.repo-metadata.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "api_shortname": "cloudasset", - "name_pretty": "Cloud Asset Inventory", - "product_documentation": "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview", - "api_reference": "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview", - "api_description": "provides inventory services based on a time series database. This database keeps a five week history of Google Cloud asset metadata. The Cloud Asset Inventory export service allows you to export all asset metadata at a certain timestamp or export event change history during a timeframe.", - "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-asset/latest/overview", - "issue_tracker": "https://issuetracker.google.com/issues/new?component=187210&template=0", - "release_level": "stable", - "transport": "both", - "requires_billing": true, - "language": "java", - "repo": "googleapis/google-cloud-java", - "repo_short": "java-asset", - "distribution_name": "com.google.cloud:google-cloud-asset", - "library_type": "GAPIC_AUTO", - "api_id": "cloudasset.googleapis.com" -} \ No newline at end of file diff --git a/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md b/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md deleted file mode 100644 index a01bb4407..000000000 --- a/tests/fixtures/java_templates/readme/README-with-libraries-bom-version-golden.md +++ /dev/null @@ -1,219 +0,0 @@ -# Google Cloud Asset Inventory Client for Java - -Java idiomatic client for [Cloud Asset Inventory][product-docs]. - -[![Maven][maven-version-image]][maven-version-link] -![Stability][stability-image] - -- [Product Documentation][product-docs] -- [Client Library Documentation][javadocs] - - -## Quickstart - - -If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: - -```xml - - - - com.google.cloud - libraries-bom - 26.36.0 - pom - import - - - - - - - com.google.cloud - google-cloud-asset - -``` - -If you are using Maven without the BOM, add this to your dependencies: - - - -```xml - - com.google.cloud - google-cloud-asset - 3.45.0 - -``` - -If you are using Gradle without BOM, add this to your dependencies: - -```Groovy -implementation 'com.google.cloud:google-cloud-asset:3.45.0' -``` - -If you are using SBT, add this to your dependencies: - -```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-asset" % "3.45.0" -``` - - -## Authentication - -See the [Authentication][authentication] section in the base directory's README. - -## Authorization - -The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired Cloud Asset Inventory APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the Cloud Asset Inventory API calls. - -## Getting Started - -### Prerequisites - -You will need a [Google Cloud Platform Console][developer-console] project with the Cloud Asset Inventory [API enabled][enable-api]. -You will need to [enable billing][enable-billing] to use Google Cloud Asset Inventory. -[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by -[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line: -`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. - -### Installation and setup - -You'll need to obtain the `google-cloud-asset` library. See the [Quickstart](#quickstart) section -to add `google-cloud-asset` as a dependency in your code. - -## About Cloud Asset Inventory - - -[Cloud Asset Inventory][product-docs] provides inventory services based on a time series database. This database keeps a five week history of Google Cloud asset metadata. The Cloud Asset Inventory export service allows you to export all asset metadata at a certain timestamp or export event change history during a timeframe. - -See the [Cloud Asset Inventory client library docs][javadocs] to learn how to -use this Cloud Asset Inventory Client Library. - - - - - - -## Troubleshooting - -To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. - -## Transport - -Cloud Asset Inventory uses both gRPC and HTTP/JSON for the transport layer. - -## Supported Java Versions - -Java 8 or above is required for using this client. - -Google's Java client libraries, -[Google Cloud Client Libraries][cloudlibs] -and -[Google Cloud API Libraries][apilibs], -follow the -[Oracle Java SE support roadmap][oracle] -(see the Oracle Java SE Product Releases section). - -### For new development - -In general, new feature development occurs with support for the lowest Java -LTS version covered by Oracle's Premier Support (which typically lasts 5 years -from initial General Availability). If the minimum required JVM for a given -library is changed, it is accompanied by a [semver][semver] major release. - -Java 11 and (in September 2021) Java 17 are the best choices for new -development. - -### Keeping production systems current - -Google tests its client libraries with all current LTS versions covered by -Oracle's Extended Support (which typically lasts 8 years from initial -General Availability). - -#### Legacy support - -Google's client libraries support legacy versions of Java runtimes with long -term stable libraries that don't receive feature updates on a best efforts basis -as it may not be possible to backport all patches. - -Google provides updates on a best efforts basis to apps that continue to use -Java 7, though apps might need to upgrade to current versions of the library -that supports their JVM. - -#### Where to find specific information - -The latest versions and the supported Java versions are identified on -the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` -and on [google-cloud-java][g-c-j]. - -## Versioning - - -This library follows [Semantic Versioning](http://semver.org/). - - - -## Contributing - - -Contributions to this library are always welcome and highly encouraged. - -See [CONTRIBUTING][contributing] for more information how to get started. - -Please note that this project is released with a Contributor Code of Conduct. By participating in -this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more -information. - - -## License - -Apache 2.0 - See [LICENSE][license] for more information. - -## CI Status - -Java Version | Status ------------- | ------ -Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] -Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] -Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] -Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] - -Java is a registered trademark of Oracle and/or its affiliates. - -[product-docs]: https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview -[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-asset/latest/overview -[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.svg -[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.html -[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.svg -[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.html -[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.svg -[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.html -[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.svg -[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.html -[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.svg -[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html -[stability-image]: https://img.shields.io/badge/stability-stable-green -[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-asset.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-asset/3.45.0 -[authentication]: https://github.com/googleapis/google-cloud-java#authentication -[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes -[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles -[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy -[developer-console]: https://console.developers.google.com/ -[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects -[cloud-cli]: https://cloud.google.com/cli -[troubleshooting]: https://github.com/googleapis/google-cloud-java/blob/main/TROUBLESHOOTING.md -[contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md -[code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct -[license]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE -[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing -[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com -[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png - -[semver]: https://semver.org/ -[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained -[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries -[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html -[g-c-j]: http://github.com/googleapis/google-cloud-java diff --git a/tests/test_language_java.py b/tests/test_language_java.py index 1fe098fc8..30bf86da4 100644 --- a/tests/test_language_java.py +++ b/tests/test_language_java.py @@ -107,17 +107,6 @@ def assert_valid_yaml(file): assert_valid_yaml(os.path.join(dirpath, file)) -def test_render_readme_with_libraries_bom_version(): - with util.copied_fixtures_dir(FIXTURES / "java_templates" / "readme"): - java.common_templates( - template_path=TEMPLATES_PATH, monorepo=True, libraries_bom_version="26.36.0" - ) - os.path.isfile("README.md") - assert_matches_golden( - "README-with-libraries-bom-version-golden.md", "./README.md" - ) - - def test_remove_method(): with tempfile.TemporaryDirectory() as tempdir: shutil.copyfile( From b7415efc777c79b7497ce25c3cd82f126c250325 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 Apr 2024 16:28:29 -0400 Subject: [PATCH 9/9] restore templates --- synthtool/gcp/templates/java_library/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/synthtool/gcp/templates/java_library/README.md b/synthtool/gcp/templates/java_library/README.md index cf3cb235c..e849a9714 100644 --- a/synthtool/gcp/templates/java_library/README.md +++ b/synthtool/gcp/templates/java_library/README.md @@ -44,11 +44,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - {%- if 'libraries_bom_version' in metadata %} - {{ metadata['libraries_bom_version'] }} - {%- else %} {{ metadata['latest_bom_version'] }} - {%- endif %} pom import