-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
This also fully deprecates BuildPlanner classes, but doesn't remove them.
0fc5954
to
f84844d
Compare
BuildPlannerClass: type[models.BuildPlanner] = models.BuildPlanner | ||
BuildPlannerClass: Annotated[ | ||
type[models.BuildPlanner] | None, | ||
pydantic.Field( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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()
?
There was a problem hiding this comment.
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")), |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Closing per team discussion - this will need to be handled separately. |
This also fully deprecates BuildPlanner classes, but doesn't remove them.
tox
?