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

Function bump

scripts/publish.rs:419–435  ·  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, patch_bump: bool)

Source from the content-addressed store, hash-verified

417/// releases. This may end up getting tweaked as we stabilize crates and start
418/// doing more minor/patch releases, but for now this should do the trick.
419fn bump(version: &str, patch_bump: bool) -> String {
420 let mut iter = version.split('.').map(|s| s.parse::<u32>().unwrap());
421 let major = iter.next().expect("major version");
422 let minor = iter.next().expect("minor version");
423 let patch = iter.next().expect("patch version");
424
425 if patch_bump {
426 return format!("{}.{}.{}", major, minor, patch + 1);
427 }
428 if major != 0 {
429 format!("{}.0.0", major + 1)
430 } else if minor != 0 {
431 format!("0.{}.0", minor + 1)
432 } else {
433 format!("0.0.{}", patch + 1)
434 }
435}
436
437fn publish(krate: &Crate) -> bool {
438 if !krate.publish {

Callers 2

bump_versionFunction · 0.85
bump_resource_countsMethod · 0.85

Calls 5

splitMethod · 0.80
mapMethod · 0.45
unwrapMethod · 0.45
expectMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected