Skip to content

Commit

Permalink
docs: explain default generation config in README.md (#3388)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 authored Nov 20, 2024
1 parent 1080de4 commit 2ac86de
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
24 changes: 20 additions & 4 deletions hermetic_build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,36 @@ 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.

## 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.

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

The path to where the generated repository goes.
Expand All @@ -41,8 +57,8 @@ 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
right version for each library.
Note that `versions.txt` has to exist in `repository_path` in order to generate
the right version for each library.
Please refer [here](go/java-client-releasing#versionstxt-manifest) for more info
of versions.txt.

Expand Down
26 changes: 8 additions & 18 deletions hermetic_build/library_generation/cli/entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 case `generation-config-path` is not specified, the default
generation config does not exist.
"""
__generate_repo_impl(
generation_config_path=generation_config_path,
Expand Down

0 comments on commit 2ac86de

Please sign in to comment.