Files
floci/tools/java_sources.py
T
Hector Ventura e8ef0b147e chore(ci): name the Java package in one place for tools and CI (#6596)
The docs tools, the partition gate and their registries each spelled
out src/main/java/io/github/hectorvent/floci/. tools/java_sources.py
now holds the package path, the tools import it, and services.yaml and
service_matrix.yaml list sources relative to the package root, so the
move to io.floci.aws changes one line here. A registry entry still in
the repo-relative form fails with a message naming the new form.
prefetch-images.sh finds TestImages.java by name.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-26 23:06:11 -04:00

20 lines
941 B
Python

"""Where Floci's Java sources live: the one place the tools under tools/ name the Java package.
Tools import the paths from here instead of writing src/main/java/<package>/... themselves, so a
package rename changes this file and nothing else in tools/. Registries that list source files
(tools/docs/services.yaml, tools/docs/service_matrix.yaml) hold paths relative to PACKAGE_DIR.
"""
from __future__ import annotations
SOURCE_ROOT = "src/main/java"
PACKAGE_DIR = f"{SOURCE_ROOT}/io/github/hectorvent/floci"
SERVICES_PACKAGE_DIR = f"{PACKAGE_DIR}/services"
def package_source(relative: str) -> str:
"""The repo-relative path of a source file a registry lists relative to PACKAGE_DIR."""
if relative.startswith(("src/", "/")):
raise ValueError(f"{relative}: registry paths are relative to {PACKAGE_DIR}/, "
f"for example services/sqs/SqsJsonHandler.java")
return f"{PACKAGE_DIR}/{relative}"