MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / bump

Function bump

ci/publish.rs:283–303  ·  view source on GitHub ↗

Performs a major version bump increment on the semver version `version`. This function will perform a semver-major-version bump on the `version` specified. This is used to calculate the next version of a crate in this repository since we're currently making major version bumps for all our releases. This may end up getting tweaked as we stabilize crates and start doing more minor/patch releases, b

(version: &str, bump: BumpKind)

Source from the content-addressed store, hash-verified

281/// releases. This may end up getting tweaked as we stabilize crates and start
282/// doing more minor/patch releases, but for now this should do the trick.
283fn bump(version: &str, bump: BumpKind) -> String {
284 let mut iter = version.split('.').map(|s| s.parse::<u32>().unwrap());
285 let major = iter.next().expect("major version");
286 let minor = iter.next().expect("minor version");
287 let patch = iter.next().expect("patch version");
288
289 match bump {
290 BumpKind::Patch => {
291 format!("{}.{}.{}", major, minor, patch + 1)
292 }
293 BumpKind::Major if major != 0 => {
294 format!("{}.0.0", major + 1)
295 }
296 BumpKind::Major if minor != 0 => {
297 format!("0.{}.0", minor + 1)
298 }
299 BumpKind::Major => {
300 format!("0.0.{}", patch + 1)
301 }
302 }
303}
304
305fn publish(krate: &Crate) -> bool {
306 if !CRATES_TO_PUBLISH.iter().any(|s| *s == krate.name) {

Callers 1

bump_versionFunction · 0.85

Calls 2

splitMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected