Rework workspace crates to get ready to publish them#645
Rework workspace crates to get ready to publish them#645slp merged 8 commits intocontainers:mainfrom
Conversation
1095226 to
af62343
Compare
To get ready for publishing the packages on crates.io, we need to prefix them with "krun-" to avoid potential name collisions. Signed-off-by: Sergio Lopez <slp@redhat.com>
af62343 to
d0bf370
Compare
| [package] | ||
| name = "krun-devices" | ||
| version = "0.1.0" | ||
| version = "1.17.3" |
There was a problem hiding this comment.
So this technically implies the API of the internal crates is stable (which it really isn't). Instead can we use something like 0.1.0-1.17.3, where 0.1.0 is an unstable API version, and 1.17.3 is the libkrun version this is for.
Longer term for libkrun 2.x I would eventually want to make things like a VirtioDevice trait public, but crucially IMO this has to be versioned totally independently from libkrun "core". Suppose libkrun-2.0 could depend on krun-devices 2.0, but libkrun 2.1, could start depending on devices 3.0.0 etc. (Or also start the version numbers with 0 - I'm not sure). So only users who implement custom devices have to follow frequent API changes (but they opted into it), users who just use builtin devices can just depend on libkrun 2.x not doing any breaking changes.
There was a problem hiding this comment.
If you wanted to avoid publishing the internal crates altogether, would it be feasible to refactor them into modules? Afaik that's the only way around it.
There was a problem hiding this comment.
If you wanted to avoid publishing the internal crates altogether, would it be feasible to refactor them into modules? Afaik that's the only way around it.
Yes but problem is this effects the compilation speed I think and doesn't do incremental builds. Each crate is a compilation unit.
There was a problem hiding this comment.
TBH, I wasn't contemplating the possibility of anyone beyond libkrun using those crates. But if there are plans to do so, we can use your suggested 0.1.0-1.17.3.
There was a problem hiding this comment.
Btw the krun-display and krun-input were meant to be consumed externally from the beginning, I wouldn't say they are fully stable though but for the rest of 1.x they might as well be.
They provide Rust bindings to our C API for providing GPU displays and input devices, gui_vm example already depends on them.
There was a problem hiding this comment.
@mtjhrc in that case, I'd be inclined to use 0.1.0, without the -0.17.3, so we remember those must be versioned independently.
There was a problem hiding this comment.
I'm more in favor of 0.1.0 and dropping the suffix. Do we really care what version of libkrun the internal crate is for if it's not stable?
There was a problem hiding this comment.
I'm more in favor of
0.1.0and dropping the suffix. Do we really care what version of libkrun the internal crate is for if it's not stable?
If we don't add the suffix, we'd need to manually bump the version to an arbitrary number on every crate changed between libkrun releases, since we can't publish crate updates with the same version number.
d0bf370 to
14f10c7
Compare
14f10c7 to
71b33db
Compare
We're setting up versioning in two different formats: - 0.1.0-$LIBKRUN_VERSION: For crates that are only intended to be consumed by libkrun, we're leaving the 0.1.0 and adding the main crate version. Only the latter will be updated. - 0.1.0: For display and input, we're giving them an independent version, and will be updated on its own pace accoding to SemVer. Signed-off-by: Sergio Lopez <slp@redhat.com>
Set it to be "The libkrun Authors" in every crate, and move the original content to AUTHORS. Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Sergio Lopez <slp@redhat.com>
Now that we have renamed every crate's package putting a "krun-" prefix on them, drop "krun_" prefix from krun_display and krun_input directories for consistency with the rest of the workspace. Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Sergio Lopez <slp@redhat.com>
71b33db to
5b4ae9c
Compare
|
Very cool, thanks for working on this. One question: have you thought through how things will work with the |
|
Might that be helped with #593? |
Good point. I'd think that may help as well. |
|
Sounds plausible. The reason I proposed the PR is because that's the DX I prefer so I think I'm totally biased 😅. |
|
I mean the env var isn't great, but not sure if now is the time to change it.
Yeah but what we really want is no built-in init by default, no? But that also means introducing a built-time option to disable the baked in init. (or make it a default enabled feature I suppose?) I mean this is the right direction, not sure how much of that we want to include in 1.18 though, In principle I am not against it, especially if we also want to publish the crates it might be nice to include this. On the other hand 1.18 was supposed to be released last week and we have a growing queue of changes waiting for 2.0. |
I was just worried about the UX when one attempts to consume the library as a |
|
I think this one gets us into a better (but not ideal) state for potential crates.io users. Then, for 2.0, we'll have the #593 and a Rust init, which will make everything smoother. |
Publishing libkrun to crates.io requires to be able to publish also every crate in the workspace. This requires the following changes, addressed in this PR:
We're setting up versioning in two different formats:
0.1.0-$LIBKRUN_VERSION: For crates that are only intended to be consumed by libkrun, we're leaving the 0.1.0 and adding the main crate version. Only the latter will be updated.
0.1.0: For display and input, we're giving them an independent version, and will be updated on its own pace accoding to SemVer.