From 490d49a7688db4e1e91a983c808650ef5b667824 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 26 Oct 2021 09:06:03 -0500 Subject: [PATCH] Adjust dependency directives between crates (#3420) * Adjust dependency directives between crates This commit is a preparation for the release process for Wasmtime. The specific changes here are to delineate which crates are "public", and all version requirements on non-public crates will now be done with `=A.B.C` version requirements instead of today's `A.B.C` version requirements. The purpose for doing this is to assist with patch releases that might happen in the future. Patch releases of wasmtime are already required to not break the APIs of "public" crates, but no such guarantee is given about "internal" crates. This means that a patch release runs the risk, for example, of breaking an internal API. In doing so though we would also need to release a new major version of the internal crate, but we wouldn't have a great hole in the number scheme of major versions to do so. By using `=A.B.C` requirements for internal crates it means we can safely ignore strict semver-compatibility between releases of internal crates for patch releases, since the only consumers of the crate will be the corresponding patch release of the `wasmtime` crate itself (or other public crates). The `publish.rs` script has been updated with a check to verify that dependencies on internal crates are all specified with an `=` dependency, and dependnecies on all public crates are without a `=` dependency. This will hopefully make it so we don't have to worry about what to use where, we just let CI tell us what to do. Using this modification all version dependency declarations have been updated. Note that some crates were adjusted to simply remove their `version` requirement in cases such as the crate wasn't published anyway (`publish = false` was specified) or it's in the `dev-dependencies` section which doesn't need version specifiers for path dependencies. * Switch to normal sever deps for cranelift dependencies These crates will now all be considered "public" where in patch releases they will be guaranteed to not have breaking changes. --- Cargo.lock | 2 - Cargo.toml | 9 ++- cranelift/codegen/Cargo.toml | 6 +- cranelift/peepmatic/Cargo.toml | 10 ++-- cranelift/peepmatic/crates/runtime/Cargo.toml | 6 +- cranelift/peepmatic/crates/souper/Cargo.toml | 4 +- .../peepmatic/crates/test-operator/Cargo.toml | 2 +- crates/cranelift/Cargo.toml | 4 +- crates/jit/Cargo.toml | 4 +- crates/runtime/Cargo.toml | 4 +- crates/wasi-common/Cargo.toml | 2 +- crates/wasi-common/cap-std-sync/Cargo.toml | 2 +- crates/wasi-common/tokio/Cargo.toml | 6 +- crates/wasi-crypto/Cargo.toml | 2 +- crates/wasi-nn/Cargo.toml | 3 +- crates/wasi/Cargo.toml | 8 +-- crates/wasmtime/Cargo.toml | 12 ++-- crates/wiggle/Cargo.toml | 2 +- crates/wiggle/macro/Cargo.toml | 2 +- scripts/publish.rs | 60 ++++++++++++++++++- 20 files changed, 100 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5631a2d6c6..92eaf12aac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3488,7 +3488,6 @@ dependencies = [ "wasmtime-cranelift", "wasmtime-environ", "wasmtime-fuzzing", - "wasmtime-jit", "wasmtime-runtime", "wasmtime-wasi", "wasmtime-wasi-crypto", @@ -3678,7 +3677,6 @@ dependencies = [ "thiserror", "walkdir", "wasmtime", - "wasmtime-runtime", "wasmtime-wasi", "wiggle", ] diff --git a/Cargo.toml b/Cargo.toml index a5d19c3c88..1f2bc42713 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,11 +22,10 @@ doc = false [dependencies] wasmtime = { path = "crates/wasmtime", version = "0.30.0", default-features = false, features = ['cache', 'cranelift'] } -wasmtime-cache = { path = "crates/cache", version = "0.30.0" } -wasmtime-cranelift = { path = "crates/cranelift", version = "0.30.0" } -wasmtime-environ = { path = "crates/environ", version = "0.30.0" } -wasmtime-jit = { path = "crates/jit", version = "0.30.0" } -wasmtime-wast = { path = "crates/wast", version = "0.30.0" } +wasmtime-cache = { path = "crates/cache", version = "=0.30.0" } +wasmtime-cranelift = { path = "crates/cranelift", version = "=0.30.0" } +wasmtime-environ = { path = "crates/environ", version = "=0.30.0" } +wasmtime-wast = { path = "crates/wast", version = "=0.30.0" } wasmtime-wasi = { path = "crates/wasi", version = "0.30.0" } wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.30.0", optional = true } wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.30.0", optional = true } diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml index db677ac45d..548ac0473c 100644 --- a/cranelift/codegen/Cargo.toml +++ b/cranelift/codegen/Cargo.toml @@ -23,9 +23,9 @@ serde = { version = "1.0.94", features = ["derive"], optional = true } bincode = { version = "1.2.1", optional = true } gimli = { version = "0.25.0", default-features = false, features = ["write"], optional = true } smallvec = { version = "1.6.1" } -peepmatic = { path = "../peepmatic", optional = true, version = "0.77.0" } -peepmatic-traits = { path = "../peepmatic/crates/traits", optional = true, version = "0.77.0" } -peepmatic-runtime = { path = "../peepmatic/crates/runtime", optional = true, version = "0.77.0" } +peepmatic = { path = "../peepmatic", optional = true, version = "=0.77.0" } +peepmatic-traits = { path = "../peepmatic/crates/traits", optional = true, version = "=0.77.0" } +peepmatic-runtime = { path = "../peepmatic/crates/runtime", optional = true, version = "=0.77.0" } regalloc = { version = "0.0.32" } souper-ir = { version = "2.1.0", optional = true } wast = { version = "38.0.0", optional = true } diff --git a/cranelift/peepmatic/Cargo.toml b/cranelift/peepmatic/Cargo.toml index e497554dcc..62e3b6f3f3 100644 --- a/cranelift/peepmatic/Cargo.toml +++ b/cranelift/peepmatic/Cargo.toml @@ -10,13 +10,13 @@ description = "DSL and compiler for generating peephole optimizers" [dependencies] anyhow = "1.0.27" -peepmatic-automata = { version = "0.77.0", path = "crates/automata", features = ["dot"] } -peepmatic-macro = { version = "0.77.0", path = "crates/macro" } -peepmatic-runtime = { version = "0.77.0", path = "crates/runtime", features = ["construct"] } -peepmatic-traits = { version = "0.77.0", path = "crates/traits" } +peepmatic-automata = { version = "=0.77.0", path = "crates/automata", features = ["dot"] } +peepmatic-macro = { version = "=0.77.0", path = "crates/macro" } +peepmatic-runtime = { version = "=0.77.0", path = "crates/runtime", features = ["construct"] } +peepmatic-traits = { version = "=0.77.0", path = "crates/traits" } serde = { version = "1.0.105", features = ["derive"] } wast = "38.0.0" z3 = { version = "0.7.1", features = ["static-link-z3"] } [dev-dependencies] -peepmatic-test-operator = { version = "0.77.0", path = "crates/test-operator" } +peepmatic-test-operator = { path = "crates/test-operator" } diff --git a/cranelift/peepmatic/crates/runtime/Cargo.toml b/cranelift/peepmatic/crates/runtime/Cargo.toml index 3cf97de9ad..09b71824c3 100644 --- a/cranelift/peepmatic/crates/runtime/Cargo.toml +++ b/cranelift/peepmatic/crates/runtime/Cargo.toml @@ -12,14 +12,14 @@ description = "Runtime support for peepmatic peephole optimizers" bincode = "1.2.1" bumpalo = "3.2.0" log = "0.4.8" -peepmatic-automata = { version = "0.77.0", path = "../automata", features = ["serde"] } -peepmatic-traits = { version = "0.77.0", path = "../traits" } +peepmatic-automata = { version = "=0.77.0", path = "../automata", features = ["serde"] } +peepmatic-traits = { version = "=0.77.0", path = "../traits" } serde = { version = "1.0.105", features = ["derive"] } thiserror = "1.0.15" wast = { version = "38.0.0", optional = true } [dev-dependencies] -peepmatic-test-operator = { version = "0.77.0", path = "../test-operator" } +peepmatic-test-operator = { path = "../test-operator" } serde_test = "1.0.114" [features] diff --git a/cranelift/peepmatic/crates/souper/Cargo.toml b/cranelift/peepmatic/crates/souper/Cargo.toml index cdb16ea3c1..ae65097912 100644 --- a/cranelift/peepmatic/crates/souper/Cargo.toml +++ b/cranelift/peepmatic/crates/souper/Cargo.toml @@ -14,6 +14,6 @@ souper-ir = { version = "2.1.0", features = ["parse"] } log = "0.4.8" [dev-dependencies] -peepmatic = { path = "../..", version = "0.77.0" } -peepmatic-test-operator = { version = "0.77.0", path = "../test-operator" } +peepmatic = { path = "../..", version = "=0.77.0" } +peepmatic-test-operator = { version = "=0.77.0", path = "../test-operator" } wast = "38.0.0" diff --git a/cranelift/peepmatic/crates/test-operator/Cargo.toml b/cranelift/peepmatic/crates/test-operator/Cargo.toml index 03ed818929..8ae98c4d58 100644 --- a/cranelift/peepmatic/crates/test-operator/Cargo.toml +++ b/cranelift/peepmatic/crates/test-operator/Cargo.toml @@ -9,6 +9,6 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -peepmatic-traits = { version = "0.77.0", path = "../traits" } +peepmatic-traits = { version = "=0.77.0", path = "../traits" } serde = { version = "1.0.105", features = ["derive"] } wast = "38.0.0" diff --git a/crates/cranelift/Cargo.toml b/crates/cranelift/Cargo.toml index 6f5a435e48..473070682a 100644 --- a/crates/cranelift/Cargo.toml +++ b/crates/cranelift/Cargo.toml @@ -13,12 +13,12 @@ edition = "2018" [dependencies] anyhow = "1.0" log = "0.4" -wasmtime-environ = { path = "../environ", version = "0.30.0" } +wasmtime-environ = { path = "../environ", version = "=0.30.0" } cranelift-wasm = { path = "../../cranelift/wasm", version = "0.77.0" } cranelift-codegen = { path = "../../cranelift/codegen", version = "0.77.0" } cranelift-frontend = { path = "../../cranelift/frontend", version = "0.77.0" } cranelift-entity = { path = "../../cranelift/entity", version = "0.77.0" } -cranelift-native = { path = '../../cranelift/native', version = '0.77.0' } +cranelift-native = { path = "../../cranelift/native", version = "0.77.0" } wasmparser = "0.81.0" target-lexicon = "0.12" gimli = { version = "0.25.0", default-features = false, features = ['read', 'std'] } diff --git a/crates/jit/Cargo.toml b/crates/jit/Cargo.toml index 47656d764b..d7dab0dce8 100644 --- a/crates/jit/Cargo.toml +++ b/crates/jit/Cargo.toml @@ -11,8 +11,8 @@ repository = "https://github.com/bytecodealliance/wasmtime" edition = "2018" [dependencies] -wasmtime-environ = { path = "../environ", version = "0.30.0" } -wasmtime-runtime = { path = "../runtime", version = "0.30.0" } +wasmtime-environ = { path = "../environ", version = "=0.30.0" } +wasmtime-runtime = { path = "../runtime", version = "=0.30.0" } region = "2.2.0" thiserror = "1.0.4" target-lexicon = { version = "0.12.0", default-features = false } diff --git a/crates/runtime/Cargo.toml b/crates/runtime/Cargo.toml index 002747f67b..ea464e202d 100644 --- a/crates/runtime/Cargo.toml +++ b/crates/runtime/Cargo.toml @@ -11,8 +11,8 @@ repository = "https://github.com/bytecodealliance/wasmtime" edition = "2018" [dependencies] -wasmtime-environ = { path = "../environ", version = "0.30.0" } -wasmtime-fiber = { path = "../fiber", version = "0.30.0", optional = true } +wasmtime-environ = { path = "../environ", version = "=0.30.0" } +wasmtime-fiber = { path = "../fiber", version = "=0.30.0", optional = true } region = "2.1.0" libc = { version = "0.2.82", default-features = false } log = "0.4.8" diff --git a/crates/wasi-common/Cargo.toml b/crates/wasi-common/Cargo.toml index 85f2304b0b..ec500d9a5f 100644 --- a/crates/wasi-common/Cargo.toml +++ b/crates/wasi-common/Cargo.toml @@ -20,7 +20,7 @@ links = "wasi-common-19" [dependencies] anyhow = "1.0" thiserror = "1.0" -wiggle = { path = "../wiggle", default-features = false, version = "0.30.0" } +wiggle = { path = "../wiggle", default-features = false, version = "=0.30.0" } tracing = "0.1.19" cap-std = "0.19.1" cap-rand = "0.19.1" diff --git a/crates/wasi-common/cap-std-sync/Cargo.toml b/crates/wasi-common/cap-std-sync/Cargo.toml index 3c093f679b..7a416c803e 100644 --- a/crates/wasi-common/cap-std-sync/Cargo.toml +++ b/crates/wasi-common/cap-std-sync/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" include = ["src/**/*", "README.md", "LICENSE" ] [dependencies] -wasi-common = { path = "../", version = "0.30.0" } +wasi-common = { path = "../", version = "=0.30.0" } async-trait = "0.1" anyhow = "1.0" cap-std = "0.19.1" diff --git a/crates/wasi-common/tokio/Cargo.toml b/crates/wasi-common/tokio/Cargo.toml index bf3fbce231..e09803a1ec 100644 --- a/crates/wasi-common/tokio/Cargo.toml +++ b/crates/wasi-common/tokio/Cargo.toml @@ -11,9 +11,9 @@ edition = "2018" include = ["src/**/*", "LICENSE" ] [dependencies] -wasi-common = { path = "../", version = "0.30.0" } -wasi-cap-std-sync = { path = "../cap-std-sync", version = "0.30.0" } -wiggle = { path = "../../wiggle", version = "0.30.0" } +wasi-common = { path = "../", version = "=0.30.0" } +wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.30.0" } +wiggle = { path = "../../wiggle", version = "=0.30.0" } tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] } cap-std = "0.19.1" cap-fs-ext = "0.19.1" diff --git a/crates/wasi-crypto/Cargo.toml b/crates/wasi-crypto/Cargo.toml index ae4f8b1cdb..be6e6fb09a 100644 --- a/crates/wasi-crypto/Cargo.toml +++ b/crates/wasi-crypto/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" anyhow = "1.0" wasi-crypto = { path = "spec/implementations/hostcalls/rust", version = "0.1.5" } wasmtime = { path = "../wasmtime", version = "0.30.0", default-features = false } -wiggle = { path = "../wiggle", version = "0.30.0" } +wiggle = { path = "../wiggle", version = "=0.30.0" } [badges] maintenance = { status = "experimental" } diff --git a/crates/wasi-nn/Cargo.toml b/crates/wasi-nn/Cargo.toml index 2d4d71e68e..32b7e00f7a 100644 --- a/crates/wasi-nn/Cargo.toml +++ b/crates/wasi-nn/Cargo.toml @@ -16,9 +16,8 @@ edition = "2018" anyhow = "1.0" log = { version = "0.4", default-features = false } wasmtime = { path = "../wasmtime", version = "0.30.0", default-features = false } -wasmtime-runtime = { path = "../runtime", version = "0.30.0" } wasmtime-wasi = { path = "../wasi", version = "0.30.0" } -wiggle = { path = "../wiggle", version = "0.30.0" } +wiggle = { path = "../wiggle", version = "=0.30.0" } # These dependencies are necessary for the wasi-nn implementation: openvino = { version = "0.3.1", features = ["runtime-linking"] } diff --git a/crates/wasi/Cargo.toml b/crates/wasi/Cargo.toml index ce52c1aa2f..957e876d37 100644 --- a/crates/wasi/Cargo.toml +++ b/crates/wasi/Cargo.toml @@ -13,10 +13,10 @@ include = ["src/**/*", "README.md", "LICENSE", "build.rs"] build = "build.rs" [dependencies] -wasi-common = { path = "../wasi-common", version = "0.30.0" } -wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "0.30.0", optional = true } -wasi-tokio = { path = "../wasi-common/tokio", version = "0.30.0", optional = true } -wiggle = { path = "../wiggle", default-features = false, version = "0.30.0", features = ["wasmtime_integration"] } +wasi-common = { path = "../wasi-common", version = "=0.30.0" } +wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "=0.30.0", optional = true } +wasi-tokio = { path = "../wasi-common/tokio", version = "=0.30.0", optional = true } +wiggle = { path = "../wiggle", default-features = false, version = "=0.30.0", features = ["wasmtime_integration"] } wasmtime = { path = "../wasmtime", default-features = false, version = "0.30.0" } anyhow = "1.0" diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml index daa9edadaf..ce81f55a0d 100644 --- a/crates/wasmtime/Cargo.toml +++ b/crates/wasmtime/Cargo.toml @@ -13,12 +13,12 @@ edition = "2018" rustdoc-args = ["--cfg", "nightlydoc"] [dependencies] -wasmtime-runtime = { path = "../runtime", version = "0.30.0" } -wasmtime-environ = { path = "../environ", version = "0.30.0" } -wasmtime-jit = { path = "../jit", version = "0.30.0" } -wasmtime-cache = { path = "../cache", version = "0.30.0", optional = true } -wasmtime-fiber = { path = "../fiber", version = "0.30.0", optional = true } -wasmtime-cranelift = { path = "../cranelift", version = "0.30.0", optional = true } +wasmtime-runtime = { path = "../runtime", version = "=0.30.0" } +wasmtime-environ = { path = "../environ", version = "=0.30.0" } +wasmtime-jit = { path = "../jit", version = "=0.30.0" } +wasmtime-cache = { path = "../cache", version = "=0.30.0", optional = true } +wasmtime-fiber = { path = "../fiber", version = "=0.30.0", optional = true } +wasmtime-cranelift = { path = "../cranelift", version = "=0.30.0", optional = true } target-lexicon = { version = "0.12.0", default-features = false } wasmparser = "0.81" anyhow = "1.0.19" diff --git a/crates/wiggle/Cargo.toml b/crates/wiggle/Cargo.toml index b157c876ab..fdc7701853 100644 --- a/crates/wiggle/Cargo.toml +++ b/crates/wiggle/Cargo.toml @@ -13,7 +13,7 @@ include = ["src/**/*", "README.md", "LICENSE"] [dependencies] thiserror = "1" witx = { path = "../wasi-common/WASI/tools/witx", version = "0.9.1", optional = true } -wiggle-macro = { path = "macro", version = "0.30.0" } +wiggle-macro = { path = "macro", version = "=0.30.0" } tracing = "0.1.26" bitflags = "1.2" async-trait = "0.1.42" diff --git a/crates/wiggle/macro/Cargo.toml b/crates/wiggle/macro/Cargo.toml index c0718833df..fb1b0138de 100644 --- a/crates/wiggle/macro/Cargo.toml +++ b/crates/wiggle/macro/Cargo.toml @@ -21,7 +21,7 @@ test = false doctest = false [dependencies] -wiggle-generate = { path = "../generate", version = "0.30.0" } +wiggle-generate = { path = "../generate", version = "=0.30.0" } witx = { version = "0.9.1", path = "../../wasi-common/WASI/tools/witx" } quote = "1.0" syn = { version = "1.0", features = ["full"] } diff --git a/scripts/publish.rs b/scripts/publish.rs index 30b3fe0c5c..be55bb0bba 100644 --- a/scripts/publish.rs +++ b/scripts/publish.rs @@ -63,12 +63,49 @@ const CRATES_TO_PUBLISH: &[&str] = &[ "wasmtime-wasi", "wasmtime-wasi-nn", "wasmtime-wasi-crypto", - "wasmtime-rust-macro", - "wasmtime-rust", "wasmtime-wast", "wasmtime-cli", ]; +// Anything **not** mentioned in this array is required to have an `=a.b.c` +// dependency requirement on it to enable breaking api changes even in "patch" +// releases since everything not mentioned here is just an organizational detail +// that no one else should rely on. +const PUBLIC_CRATES: &[&str] = &[ + // just here to appease the script because these are submodules of this + // repository. + "wasi-crypto", + "witx", + // these are actually public crates which we cannot break the API of in + // patch releases. + "wasmtime", + "wasmtime-wasi", + "wasmtime-wasi-nn", + "wasmtime-wasi-crypto", + "wasmtime-cli", + // all cranelift crates are considered "public" in that they can't + // have breaking API changes in patch releases + "cranelift-entity", + "cranelift-bforest", + "cranelift-codegen-shared", + "cranelift-codegen-meta", + "cranelift-codegen", + "cranelift-reader", + "cranelift-serde", + "cranelift-module", + "cranelift-preopt", + "cranelift-frontend", + "cranelift-wasm", + "cranelift-native", + "cranelift-object", + "cranelift-interpreter", + "cranelift", + "cranelift-jit", + // This is a dependency of cranelift crates and as a result can't break in + // patch releases as well + "wasmtime-types", +]; + struct Crate { manifest: PathBuf, name: String, @@ -235,7 +272,7 @@ fn bump_version(krate: &Crate, crates: &[Crate]) { continue; } if !line.contains(&other.version) { - if !line.contains("version =") { + if !line.contains("version =") || !krate.publish { continue; } panic!( @@ -243,6 +280,23 @@ fn bump_version(krate: &Crate, crates: &[Crate]) { krate.manifest, other.name, other.version ); } + if krate.publish { + if PUBLIC_CRATES.contains(&other.name.as_str()) { + assert!( + !line.contains("\"="), + "{} should not have an exact version requirement on {}", + krate.name, + other.name + ); + } else { + assert!( + line.contains("\"="), + "{} should have an exact version requirement on {}", + krate.name, + other.name + ); + } + } rewritten = true; new_manifest.push_str(&line.replace(&other.version, &other.next_version)); break;