-
Notifications
You must be signed in to change notification settings - Fork 7
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
Simplify Cargo metadata for publish = false
crates
#248
Conversation
As of Cargo 1.75 the `version` property in `Cargo.toml` is now optional, and if omitted is the same as having specified `version = "0.0.0"` and `publish = false`: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-175-2023-12-28 https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field Therefore for crates that we do not publish, we can now remove both the `version` and `publish` properties, avoiding the need for the fake `0.0.0` version that differs from the actual buildpack version in `buildpack.toml`. GUS-W-14821120.
Dependabot is currently failing since it doesn't like the fact that the version of the Ruby `commons` module (which is imported via a GitHub URL) has changed from `1.0.0` to `0.0.0` after: heroku/buildpacks-ruby#248 To fix this the lockfile entry for `commons` needs regenerating. However, whilst I'm here I've just regenerated the whole lockfile, to pick up any other in-range version updates.
The commons crate is intended to be used by other buildpacks even if it's never intended to be published to a registry. I'm in the process of deprecating some features from it right now. |
Yes, we know :-) Since it's a Git dep, other buildpacks use it via the Git repo URL, which Cargo resolves to a commit SHA, eg: ...so the version is unused and makes no difference on the consumer side. |
TIL, I assumed that you could use a version specifier with a git dependency, but no one had chosen to do so. This is how it works in Ruby:
|
I'm pretty sure with most language's packages managers, the way you manage a Git based dependency is via a Git ref rather than directly via the package version, and if a package version is involved at any point it's more of a ancillary side-effect rather than the actual means of picking the version to use. If instead the package version was the primary means of selecting the version, how would the packager manager know which branch/tag/revision to check out to install the package etc? :-) |
As of Cargo 1.75 the
version
property inCargo.toml
is now optional, and if omitted is the same as having specifiedversion = "0.0.0"
andpublish = false
:https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-175-2023-12-28
https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field
Therefore for crates that we do not publish, we can now remove both the
version
andpublish
properties, avoiding the need for the fake0.0.0
version that differs from the actual buildpack version inbuildpack.toml
.GUS-W-14821120.