8000 feat: shared versioning for all binaries based on git by twitchyliquid64 · Pull Request #815 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 32 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ members = [
"crates/sessions",
"crates/stdlib",
"crates/switch",
"crates/version",
]
resolver = "3"

package.edition = "2024"
package.publish = false
# Shared base version for the workspace. This is the fallback the `version` crate
# reports when no `v*` git tag is reachable; the real release version comes from
# `git describe` at build time. See crates/version/build.rs.
package.version = "0.5.0-rc1"

[profile.release]
strip = true
Expand Down Expand Up @@ -148,28 +153,31 @@ walkdir = "2.5"

petgraph = "0.8"

# our crates
args = { version = "0.0.1", path = "crates/args" }
async-dialog = { version = "0.0.1", path = "crates/async-dialog" }
graph = { version = "0.0.1", path = "crates/graph" }
lcache = { version = "0.0.1", path = "crates/lcache" }
rcache = { version = "0.0.1", path = "crates/rcache" }
check = { version = "0.0.1", path = "crates/check" }
checkouts = { version = "0.0.1", path = "crates/checkouts" }
common = { version = "0.0.1", path = "crates/common" }
decode = { version = "0.0.1", path = "crates/decode" }
diagnostics = { version = "0.0.1", path = "crates/diagnostics" }
mctx = { version = "0.0.1", path = "crates/mctx" }
minimald-rpc = { version = "0.0.1", path = "crates/minimald-rpc" }
mfile = { version = "0.0.1", path = "crates/mfile" }
op = { version = "0.0.1", path = "crates/op" }
ot = { version = "0.0.1", path = "crates/ot" }
orchestrator = { version = "0.0.1", path = "crates/orchestrator" }
paths = { version = "0.0.1", path = "crates/paths" }
remote-proto = { version = "0.0.1", path = "crates/remote-proto" }
remote-client = { version = "0.0.1", path = "crates/remote-client" }
sandbox2 = { version = "0.0.1", path = "crates/sandbox2" }
sessions = { version = "0.0.1", path = "crates/sessions" }
switch = { version = "0.0.1", path = "crates/switch" }
# Our crates. These are path deps in a `publish = false` workspace, so no
# `version` requirement is needed (or used) — cargo resolves them by path. Adding
# one would just be a pin to keep in sync with each crate's own version.
args = { path = "crates/args" }
async-dialog = { path = "crates/async-dialog" }
graph = { path = "crates/graph" }
lcache = { path = "crates/lcache" }
rcache = { path = "crates/rcache" }
check = { path = "crates/check" }
checkouts = { path = "crates/checkouts" }
common = { path = "crates/common" }
decode = { path = "crates/decode" }
diagnostics = { path = "crates/diagnostics" }
mctx = { path = "crates/mctx" }
minimald-rpc = { path = "crates/minimald-rpc" }
mfile = { path = "crates/mfile" }
op = { path = "crates/op" }
ot = { path = "crates/ot" }
orchestrator = { path = "crates/orchestrator" }
paths = { path = "crates/paths" }
remote-proto = { path = "crates/remote-proto" }
remote-client = { path = "crates/remote-client" }
sandbox2 = { path = "crates/sandbox2" }
sessions = { path = "crates/sessions" }
switch = { path = "crates/switch" }
version = { path = "crates/version" }

stdlib = { version = "0.0.17", path = "crates/stdlib" }
stdlib = { path = "crates/stdlib" }
3 changes: 2 additions & 1 deletion crates/minimal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minimal"
version = "0.0.1"
version.workspace = true
edition.workspace = true
publish.workspace = true

Expand Down Expand Up @@ -42,6 +42,7 @@ sessions.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
version.workspace = true

# default-features = false drops minvmd's `libkrun` feature: the CLI only uses
# the client helpers (sock/lifecycle) and calls no krun code, so it must not
Expand Down
26 changes: 0 additions & 26 deletions crates/minimal/build.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/minimal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub mod git_remote;
pub mod loadouts;

#[derive(Parser)]
#[command(name = "min", version = env!("CARGO_PKG_VERSION"), long_version = env!("LONG_VERSION"))]
#[command(name = "min", version = version::VERSION, long_version = version::LONG_VERSION)]
#[command(about = "The Minimal CLI")]
pub struct Cli {
#[command(subcommand)]
Expand Down Expand Up @@ -1734,7 +1734,7 @@ pub async fn cmd_update(global: &GlobalArgs, _args: UpdateArgs) -> Result<(), mc
/// not autospawn the daemon — it is a lightweight diagnostic that should
/// report versions without starting a VM.
pub async fn cmd_version(global: &GlobalArgs) -> Result<(), anyhow::Error> {
println!("Client: minimal {}", env!("LONG_VERSION"));
println!("Client: minimal {}", version::LONG_VERSION);

let sock = match client::resolve_socket_path(global.minimal_dir.as_deref()) {
Ok(p) => p,
Expand Down
3 changes: 2 additions & 1 deletion crates/minimald/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minimald"
version = "0.0.1"
version.workspace = true
edition.workspace = true
publish.workspace = true

Expand Down Expand Up @@ -70,6 +70,7 @@ sandbox2.workspace = true
sessions.workspace = true
switch.workspace = true
stdlib.workspace = true
version.workspace = true

rcgen = { workspace = true, optional = true }
rustls = { workspace = true, optional = true }
Expand Down
26 changes: 0 additions & 26 deletions crates/minimald/build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/minimald/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DEFAULT_VSOCK_PORT_BASE: u32 = 2222;
const DETACHED_ENV: &str = "MINIMALD_DETACHED";

#[derive(Parser)]
#[command(name = "minimald", version = env!("CARGO_PKG_VERSION"), long_version = env!("LONG_VERSION"))]
#[command(name = "minimald", version = version::VERSION, long_version = version::LONG_VERSION)]
#[command(about = "The Minimal daemon")]
struct Cli {
#[command(subcommand)]
Expand Down
10 changes: 5 additions & 5 deletions crates/minimald/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ async fn serve_get_version(c: RuChannel<Msg>) {
let res = GetVersion
.handle_channel(c, async |_req| {
Ok(GetVersionResponse {
version: env!("CARGO_PKG_VERSION").to_string(),
long_version: env!("LONG_VERSION").to_string(),
version: version::VERSION.to_string(),
long_version: version::LONG_VERSION.to_string(),
stdlib_version: stdlib::VERSION.to_string(),
})
})
Expand Down Expand Up @@ -757,8 +757,8 @@ mod tests {

let resp = client.call::<GetVersion>(&()).await;

assert_eq!(resp.version, env!("CARGO_PKG_VERSION"));
assert_eq!(resp.long_version, env!("LONG_VERSION"));
assert_eq!(resp.version, version::VERSION);
assert_eq!(resp.long_version, version::LONG_VERSION);
assert_eq!(resp.stdlib_version, stdlib::VERSION);
}

Expand Down Expand Up @@ -809,7 +809,7 @@ mod tests {
for _ in 0..3 {
let mut client = server.connect().await;
let resp = client.call::<GetVersion>(&()).await;
assert_eq!(resp.version, env!("CARGO_PKG_VERSION"));
assert_eq!(resp.version, version::VERSION);
}
}

Expand Down
3 changes: 2 additions & 1 deletion crates/minvmd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minvmd"
version = "0.0.1"
version.workspace = true
edition.workspace = true
publish.workspace = true

Expand Down Expand Up @@ -43,6 +43,7 @@ russh.workspace = true
# Canonical state-dir base + provider-instance dir layout (`state`, `sock`,
# `volume`).
paths.workspace = true
version.workspace = true

[dev-dependencies]
serial_test.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/minvmd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use clap_complete::Shell;
use tracing_subscriber::{EnvFilter, fmt, prelude::*};

#[derive(Parser)]
#[command(name = "minvmd", version = env!("CARGO_PKG_VERSION"))]
#[command(name = "minvmd", version = version::VERSION, long_version = version::LONG_VERSION)]
#[command(
about = "Host daemon that brings up a Linux microVM via libkrun (macOS/HVF or Linux/KVM)"
)]
Expand Down
3 changes: 2 additions & 1 deletion crates/mip/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mip"
version = "0.4.1"
version.workspace = true
edition.workspace = true
publish.workspace = true

Expand Down Expand Up @@ -42,6 +42,7 @@ anyhow.workspace = true

petgraph.workspace = true
smallvec.workspace = true
version.workspace = true

[dev-dependencies]
serial_test.workspace = true
26 changes: 0 additions & 26 deletions crates/mip/build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/ CA64 mip/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod cmd_remote_build;
use cmd_remote_build::{RemoteBuildArgs, cmd_remote_build};

#[derive(Parser)]
#[command(name = "minimal", version = env!("CARGO_PKG_VERSION"), long_version = env!("LONG_VERSION"))]
#[command(name = "minimal", version = version::VERSION, long_version = version::LONG_VERSION)]
#[command(about = "The Minimal CLI")]
struct Cli {
#[command(subcommand)]
Expand Down
7 changes: 7 additions & 0 deletions crates/version/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "version"
version.workspace = true
edition.workspace = true
publish.workspace = true

[dependencies]
Loading
0