BuildPlanService

The BuildPlanService uses Craft Platforms to create build plans. Apps that need to generate custom build plans that Craft Platforms can’t handle must override _gen_exhaustive_build_plan().

API documentation

class craft_application.services.buildplan.BuildPlanService

A service for generating and filtering build plans.

setup() None

Set up the build plan service.

set_platforms(*platform: str) None

Set the platforms for the build plan.

set_build_fors(*build_for: DebianArchitecture | str) None

Set the build-for (target) platforms for the build plan.

final plan() Sequence[craft_platforms.BuildInfo]

Plan the current build.

_gen_exhaustive_build_plan(project_data: dict[str, Any]) Iterable[craft_platforms.BuildInfo]

Generate the exhaustive build plan with craft-platforms.

Parameters:

project_data – The unprocessed project data retrieved from a YAML file.

Returns:

An iterable of BuildInfo objects that make the exhaustive build plan.

_filter_plan(exhaustive_build_plan: Iterable[craft_platforms.BuildInfo], *, platforms: Collection[str] | None, build_for: Collection[craft_platforms.DebianArchitecture | Literal['all']] | None, build_on: Collection[craft_platforms.DebianArchitecture] | None) Iterable[craft_platforms.BuildInfo]

Filter the build plan.

This method filters the given build plan based on the provided filter values. An application may override this if it needs to filter the build plan in non-default ways. It exists to allow applications to only change the build plan filter and should only be used by get_build_plan() except in testing.

Parameters:
  • platforms – A collection of platform names to keep after filtering, or None to not filter on the platform name.

  • build_for – A collection of target architectures to keep after filtering, or None to not filter on the build-for architecture.

  • build_on – A collection of build-on architectures to keep after filtering, or None to not filter on the build-on architecture.

Yields:

Build info objects based on the given filter.

final create_build_plan(*, platforms: Collection[str] | None, build_for: Collection[str | craft_platforms.DebianArchitecture] | None, build_on: Collection[str | craft_platforms.DebianArchitecture] | None) Sequence[craft_platforms.BuildInfo]

Generate a build plan based on the given platforms, build-fors and build-ons.

Parameters:
  • platforms – A collection of platform names to select, or None to not filter on platform names

  • build_for – A collection of build-for architecture names to select, or None to not filter on build-for architectures.

  • build_on – A collection of build-on architecture names to select. Defaults to the current architecture.

Returns:

A build plan for the given