From b953dc3a879ff1f48b1ceb9029631cb9e7adb901 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Wed, 20 Nov 2024 09:25:52 -0500 Subject: [PATCH 1/3] docs: explain default generation config --- hermetic_build/README.md | 11 ++++++-- .../library_generation/cli/entry_point.py | 26 ++++++------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/hermetic_build/README.md b/hermetic_build/README.md index 583e766bdf..7fd2087a05 100644 --- a/hermetic_build/README.md +++ b/hermetic_build/README.md @@ -25,13 +25,20 @@ for more information. ## Parameters to generate a repository using the docker image -### Generation configuration yaml (`generation-config-path`) +### Generation configuration yaml (`generation-config-path`), optional An absolute or relative path to a configuration file containing parameters to generate the repository. Please refer to [Configuration to generate a repository](#configuration-to-generate-a-repository) for more information. +The default value is `$(pwd)/generation_config.yaml`, i.e., `generation_config.yaml` +in the current working directory. + +Raise `FileNotFoundError` if the specified generation config does not exist or, +in the case `generation-config-path` is not specified, the default generation +config does not exist. + ### Repository path (`repository-path`), optional The path to where the generated repository goes. @@ -41,7 +48,7 @@ For example, `cd google-cloud-java && python /path/to/entry_point.py ...` withou specifying the `--repository_path` option will modify the `google-cloud-java` repository the user `cd`'d into. -Note that versions.txt has to exist in `repository_path` in order to generate +Note that `versions.txt` has to exist in `repository_path` in order to generate right version for each library. Please refer [here](go/java-client-releasing#versionstxt-manifest) for more info of versions.txt. diff --git a/hermetic_build/library_generation/cli/entry_point.py b/hermetic_build/library_generation/cli/entry_point.py index e568f831ab..3baed7ae53 100644 --- a/hermetic_build/library_generation/cli/entry_point.py +++ b/hermetic_build/library_generation/cli/entry_point.py @@ -78,28 +78,18 @@ def generate( api_definitions_path: str, ): """ - Compare baseline generation config and current generation config and - generate changed libraries based on current generation config. + Generate libraries based on a generation config. - If baseline generation config is not specified but current generation - config is specified, generate all libraries if `library_names` is not - specified, based on current generation config. - - If current generation config is not specified but baseline generation - config is specified, raise FileNotFoundError because current generation - config should be the source of truth of library generation. - - If both baseline generation config and current generation config are not - specified, generate all libraries based on the default generation config, - which is generation_config.yaml in the current working directory. + If the `generation-config-path` is not specified the default generation + config, `$(pwd)/generation_config.yaml`, will be used. If `library_names` is specified, only libraries whose name can be found in - the current generation config or default generation config, if current - generation config is not specified, will be generated. Changed libraries - will be ignored even if baseline and current generation config are - specified. + the generation config will be generated; otherwise all libraries in the + generation config will be generated. - Raise FileNotFoundError if the default config does not exist. + :raise FileNotFoundError if the specified generation config does not exist + or, in the case `generation-config-path` is not specified, the default + generation config does not exist. """ __generate_repo_impl( generation_config_path=generation_config_path, From 923d3a65737338213cb3ffde87d0e3cb40207e0a Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Wed, 20 Nov 2024 11:55:01 -0500 Subject: [PATCH 2/3] add a prerequisite --- hermetic_build/README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hermetic_build/README.md b/hermetic_build/README.md index 7fd2087a05..9b3da4a63a 100644 --- a/hermetic_build/README.md +++ b/hermetic_build/README.md @@ -18,7 +18,16 @@ for additional instructions. ## Prerequisites -In order to generate a version for each library, a versions.txt has to exist +### Generation configuration + +A generation configuration file is required to generate GAPIC Client Libraries. + +Please refer to [Generation configuration yaml](#generation-configuration-yaml--generation-config-path---optional) +for more information. + +### versions.txt + +In order to generate a version for each library, a `versions.txt` has to exist in `repository-path`. Please refer to [Repository path](#repository-path--repositorypath---optional) for more information. From c7a90e42840c159070a31f0a9a1f566a3c71d1bf Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Wed, 20 Nov 2024 11:57:19 -0500 Subject: [PATCH 3/3] rephrase after code review --- hermetic_build/README.md | 8 ++++---- hermetic_build/library_generation/cli/entry_point.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hermetic_build/README.md b/hermetic_build/README.md index 9b3da4a63a..c9ef8c6184 100644 --- a/hermetic_build/README.md +++ b/hermetic_build/README.md @@ -44,9 +44,9 @@ for more information. The default value is `$(pwd)/generation_config.yaml`, i.e., `generation_config.yaml` in the current working directory. -Raise `FileNotFoundError` if the specified generation config does not exist or, -in the case `generation-config-path` is not specified, the default generation -config does not exist. +This will raise `FileNotFoundError` if the specified generation config does not +exist or, in case `generation-config-path` is not specified, the default +generation config does not exist. ### Repository path (`repository-path`), optional @@ -58,7 +58,7 @@ specifying the `--repository_path` option will modify the `google-cloud-java` repository the user `cd`'d into. Note that `versions.txt` has to exist in `repository_path` in order to generate -right version for each library. +the right version for each library. Please refer [here](go/java-client-releasing#versionstxt-manifest) for more info of versions.txt. diff --git a/hermetic_build/library_generation/cli/entry_point.py b/hermetic_build/library_generation/cli/entry_point.py index 3baed7ae53..1d0e9f7de9 100644 --- a/hermetic_build/library_generation/cli/entry_point.py +++ b/hermetic_build/library_generation/cli/entry_point.py @@ -88,7 +88,7 @@ def generate( generation config will be generated. :raise FileNotFoundError if the specified generation config does not exist - or, in the case `generation-config-path` is not specified, the default + or, in case `generation-config-path` is not specified, the default generation config does not exist. """ __generate_repo_impl(