Skip to content
Merged
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
41 changes: 38 additions & 3 deletions .generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,35 @@ def _write_json_file(path: str, updated_content: Dict):
f.write("\n")


def handle_configure():
def handle_configure(
librarian: str = LIBRARIAN_DIR,
source: str = SOURCE_DIR,
repo: str = REPO_DIR,
input: str = INPUT_DIR,
):
"""Onboards a new library by completing its configuration.

This function reads a partial library definition from `configure-request.json`,
fills in missing fields like the version, source roots, and preservation
rules, and writes the complete configuration to `configure-response.json`.
It ensures that new libraries conform to the repository's standard structure.

See https://github.com/googleapis/librarian/blob/main/doc/container-contract.md#configure-container-command

Args:
librarian(str): Path to the directory in the container which contains
the librarian configuration.
source(str): Path to the directory in the container which contains
API protos.
repo(str): This directory will contain all directories that make up a
library, the .librarian folder, and any global file declared in
the config.yaml.
input(str): The path to the directory in the container
which contains additional generator input.

Raises:
ValueError: If configuring a new library fails.
"""
# TODO(https://github.com/googleapis/librarian/issues/466): Implement configure command and update docstring.
logger.info("'configure' command executed.")

Expand Down Expand Up @@ -407,7 +435,7 @@ def _run_nox_sessions(library_id: str, repo: str):
Args:
library_id(str): The library id under test.
repo(str): This directory will contain all directories that make up a
library, the .librarian folder, and any global file declared in
library, the .librarian folder, and any global files declared in
the config.yaml.
"""
sessions = [
Expand Down Expand Up @@ -997,7 +1025,14 @@ def handle_release_init(
args = parser.parse_args()

# Pass specific arguments to the handler functions for generate/build
if args.command == "generate":
if args.command == "configure":
args.func(
librarian=args.librarian,
source=args.source,
repo=args.repo,
input=args.input,
)
elif args.command == "generate":
args.func(
librarian=args.librarian,
source=args.source,
Expand Down
Loading