Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use craft-platforms build planning #501

Closed
wants to merge 2 commits into from

Conversation

lengau
Copy link
Contributor

@lengau lengau commented Oct 3, 2024

This also fully deprecates BuildPlanner classes, but doesn't remove them.

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox?

This also fully deprecates BuildPlanner classes, but doesn't remove them.
@lengau lengau force-pushed the work/391/CRAFT-3321/deprecate-planner branch from 0fc5954 to f84844d Compare October 3, 2024 18:55
@lengau lengau marked this pull request as ready for review October 3, 2024 19:20
@lengau lengau requested a review from a team October 3, 2024 19:20
@mr-cal mr-cal requested a review from a team October 4, 2024 14:12
BuildPlannerClass: type[models.BuildPlanner] = models.BuildPlanner
BuildPlannerClass: Annotated[
type[models.BuildPlanner] | None,
pydantic.Field(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does annotating this as a pydantic.Field do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In auto-generated documentation for the AppMetadata class it'll use those pydantic docs - in this case the deprecation warning.

@@ -261,6 +273,40 @@ def _resolve_project_path(self, project_dir: pathlib.Path | None) -> pathlib.Pat

return (project_dir / f"{self.app.name}.yaml").resolve(strict=True)

def get_build_plan(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are applications expected to override this? For instance rockcraft, that needs to call get_rock_build_plan() instead of the default get_platforms_build_plan()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - instead of implementing a BuildPlanner class.

return build_planner.get_build_plan()

return craft_platforms.get_platforms_build_plan(
base=cast(str, yaml_data.get("base")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do the validation errors look like now? For example, what gets output if a project file is missing the base?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I should probably move up the pydantic validation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe too late to suggest this but have you considered just having BuildPlannerClass.get_build_plan() return a list of craft_platform BuildInfos?

@lengau
Copy link
Contributor Author

lengau commented Oct 4, 2024

Closing per team discussion - this will need to be handled separately.

@lengau lengau closed this Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants