-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add Cargo Task to generate Deb packages #87
Add Cargo Task to generate Deb packages #87
Conversation
package_name=package_name, | ||
group="publish", | ||
) | ||
task.depends_on(":cargoBuildRelease") |
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.
It is a bit annoying because the task may not always be called cargoBuildRelease
, it can also be cargoBuildDebug
: https://github.com/kraken-build/kraken-build/blob/3011038a7b8c671c606c7c9f97e6b71771914a1c/kraken-std/src/kraken/std/cargo/__init__.py#L291-L292
Perhaps the cleaner solution here is to have CargoGenerateDebPackage
accept a list of package_name
s which can be list[str] | list[Property[BinaryArtifact]]
.
Then, when calling cargo_generate_deb_package
, you'd pass it the path to the binaries or libs coming from the build task:
Because if a task has a property which is another task's output property, kraken automatically creates a dependency between the two.
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.
I think this should be fine, as we only want to package release binaries for now. It could definitely be improved in the longer run.
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.
Still, we cannot leave it as is because sometimes the build task will not exist: for example, it might be cargoBuildRelease
on develop, and cargoBuildDebug
on a feature branch, in which case this will fail.
If we don't want to automatically generate the dependency via Property
s, then we should defer to the caller (who will know better) the responsibility of adding the dependency
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.
Wouldn't we want this to fail if someone has defined it, but there's no build? The only way to use this is manual, for now.
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.
Unfortunately, it is not the task that would fail, but the generation of the task graph. Meaning that you would not be able to run any kraken task, as building the dependency graph would fail with an error (something like No task matched the selector ':**:cargoBuildRelease'
)
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.
Just checked and I think I can safely remove the dependency on any cargoBuild*
. cargo deb
seems to build an optimised binary even if cargo build
wasn't run first, so it will work in any situation.
And it being part of the publish
group should limit repeating work.
This creates a Kraken Task that allows users to generate Debian packages from a Cargo project.
These packages can then be published as needed, most likely to apt repositories.