PackageService¶
The PackageService takes the final output of the prime step
and assembles it into the final package. Because this step is unique to the app,
the pack() and metadata() methods are abstract
and must be implemented by the app.
API documentation¶
- class craft_application.services.package.PackageService[source]¶
The business logic for creating packages.
- __init__(app: AppMetadata, services: ServiceFactory) None[source]¶
- pack(prime_dir: Path, dest: Path) list[Path][source]¶
Create one or more packages.
- Parameters:
prime_dir – Directory path to the default prime directory. DEPRECATED in favour of retrieving this information from the
LifecycleService.dest – Directory into which to write the package(s).
- Returns:
A list of paths to the created packages.
- write_state(artifact: Path | None, resources: dict[str, Path] | None) None[source]¶
Write the packaging state.
- write_artifacts_state(artifacts: Mapping[str | None, pathlib.Path]) None[source]¶
Write artifact-oriented packaging state.
- read_state(platform: str | None = None) PackState[source]¶
Read the packaging state.
- Parameters:
platform – The name of the platform to read. If not provided, uses the first platform in the build plan.
- Returns:
A PackState object containing the artifact and resources.
- abstract property metadata: BaseMetadata¶
The metadata model for this project.
- property supports_conditional_repack: bool¶
Whether this service implements the metadata mediation API.
- write_metadata(path: Path) None[source]¶
Write the project metadata to metadata.yaml in the given directory.
- Parameters:
path – The path to the prime directory.
- get_artifacts() dict[str | None, Path][source]¶
Get the output artifacts for this application.
Subclasses must override this to opt in to conditional repacking.