Skip to content

Commit

Permalink
chore: bump dependency versions and move to Rust 1.80 (#47)
Browse files Browse the repository at this point in the history
* Bump dependency versions, move to Rust 1.80

Update the version of dependencies to current versions, and move to Rust
1.80. Currently, the crate cannot be compiled on anything newer than
Rust 1.77 because that's the latest version supported by the previous
cargo dependency. Updating it to a more recent version fixes compile
problems that appear within gix.

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>

* chore: bump clap to 4.5.17

* chore: allow cfg(codspeed) with the check-cfg lint

---------

Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
Co-authored-by: Arthur Pastel <arthur.pastel@gmail.com>
  • Loading branch information
antiguru and art049 committed Sep 5, 2024
1 parent 6b96b80 commit 814fb2b
Show file tree
Hide file tree
Showing 10 changed files with 938 additions and 742 deletions.
1,610 changes: 900 additions & 710 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions crates/bencher_compat/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("cargo::rustc-check-cfg=cfg(codspeed)");
}
20 changes: 10 additions & 10 deletions crates/cargo-codspeed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ categories = [
keywords = ["codspeed", "benchmark", "cargo"]

[dependencies]
cargo = "0.78.1"
clap = { version = "=4.5.4", features = ["derive"] }
termcolor = "1.0"
anyhow = "1.0.66"
itertools = "0.10.5"
anstyle = "1.0.6"
cargo = "0.81.0"
clap = { version = "=4.5.17", features = ["derive"] }
termcolor = "1.4"
anyhow = "1.0.86"
itertools = "0.13.0"
anstyle = "1.0.8"

[dev-dependencies]
assert_cmd = "2.0.7"
fs_extra = "1.2.0"
predicates = "2.1.4"
uuid = { version = "1.2.2", features = ["v4"] }
assert_cmd = "2.0.15"
fs_extra = "1.3.0"
predicates = "3.1.2"
uuid = { version = "1.10.0", features = ["v4"] }

[features]
vendored-openssl = ["cargo/vendored-openssl"]
8 changes: 4 additions & 4 deletions crates/cargo-codspeed/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{ffi::OsString, process::exit};
use crate::helpers::style;
use crate::{prelude::*, run::run_benches};

use cargo::Config;
use cargo::GlobalContext;
use cargo::{ops::Packages, util::important_paths::find_root_manifest_for_wd};
use clap::{Args, Parser, Subcommand};

Expand Down Expand Up @@ -58,11 +58,11 @@ enum Commands {
},
}

pub fn get_cargo_config() -> Result<Config> {
pub fn get_cargo_config() -> Result<GlobalContext> {
let mut rustflags = std::env::var("RUSTFLAGS").unwrap_or_else(|_| "".into());
rustflags.push_str(" -g --cfg codspeed");
std::env::set_var("RUSTFLAGS", &rustflags);
Config::default()
GlobalContext::default()
}

pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
Expand Down Expand Up @@ -104,7 +104,7 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
};

if let Err(e) = res {
ws.config()
ws.gctx()
.shell()
.status_with_color("Error", e.to_string(), &style::ERROR)?;
exit(1);
Expand Down
16 changes: 8 additions & 8 deletions crates/cargo-codspeed/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use cargo::{
core::{FeatureValue, Package, Target, Verbosity, Workspace},
ops::{CompileFilter, CompileOptions, Packages},
util::{command_prelude::CompileMode, interning::InternedString},
Config,
GlobalContext,
};

fn get_compile_options(
config: &Config,
config: &GlobalContext,
features: &Option<Vec<String>>,
profile: &str,
package: &Package,
Expand Down Expand Up @@ -90,8 +90,8 @@ pub fn build_benches(

let actual_benches_count = benches_to_build.len();

ws.config().shell().set_verbosity(Verbosity::Normal);
ws.config().shell().status_with_color(
ws.gctx().shell().set_verbosity(Verbosity::Normal);
ws.gctx().shell().status_with_color(
"Collected",
format!(
"{} benchmark suite(s) to build{}",
Expand All @@ -108,7 +108,7 @@ pub fn build_benches(
&style::TITLE,
)?;

let config = ws.config();
let context = ws.gctx();
let codspeed_root_target_dir = get_codspeed_target_dir(ws);
// Create and clear packages target directories
for package in packages_to_build.iter() {
Expand All @@ -118,15 +118,15 @@ pub fn build_benches(
}
let mut built_benches = 0;
for bench in benches_to_build.iter() {
ws.config().shell().status_with_color(
ws.gctx().shell().status_with_color(
"Building",
format!("{} {}", bench.package.name(), bench.target.name()),
&style::ACTIVE,
)?;
let is_root_package = ws.current_opt().map_or(false, |p| p == bench.package);
let benches_names = vec![bench.target.name()];
let compile_opts = get_compile_options(
config,
context,
&features,
&profile,
bench.package,
Expand Down Expand Up @@ -158,7 +158,7 @@ pub fn build_benches(
Please add a benchmark target to your Cargo.toml"
);
}
ws.config().shell().status_with_color(
ws.gctx().shell().status_with_color(
"Finished",
format!("built {} benchmark suite(s)", built_benches),
&style::SUCCESS,
Expand Down
8 changes: 4 additions & 4 deletions crates/cargo-codspeed/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn run_benches(
} else {
to_run = benches.iter().collect();
}
ws.config().shell().status_with_color(
ws.gctx().shell().status_with_color(
"Collected",
format!("{} benchmark suite(s) to run", to_run.len()),
&style::TITLE,
Expand All @@ -86,7 +86,7 @@ pub fn run_benches(
// workspace_root is needed since file! returns the path relatively to the workspace root
// while CARGO_MANIFEST_DIR returns the path to the sub package
let workspace_root = ws.root().to_string_lossy();
ws.config().shell().status_with_color(
ws.gctx().shell().status_with_color(
"Running",
format!("{} {}", &bench.package_name, bench_name),
&style::ACTIVE,
Expand All @@ -106,13 +106,13 @@ pub fn run_benches(
))
}
})?;
ws.config().shell().status_with_color(
ws.gctx().shell().status_with_color(
"Done",
format!("running {}", bench_name),
&style::SUCCESS,
)?;
}
ws.config().shell().status_with_color(
ws.gctx().shell().status_with_color(
"Finished",
format!("running {} benchmark suite(s)", to_run.len()),
&style::SUCCESS,
Expand Down
2 changes: 1 addition & 1 deletion crates/codspeed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ keywords = ["codspeed", "benchmark"]
[dependencies]
colored = "2.0.0"
libc = "^0.2"
serde_json = "1.0.104"
serde_json = "1.0.120"

[[bench]]
name = "native"
Expand Down
8 changes: 4 additions & 4 deletions crates/criterion_compat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ keywords = ["codspeed", "benchmark", "criterion"]
[dependencies]
criterion = { version = "0.5.1", default-features = false }
codspeed = { path = "../codspeed", version = "=2.6.0" }
colored = "2.0.0"
colored = "2.1.0"

futures = { version = "0.3", default_features = false, optional = true }
smol = { version = "1.2", default-features = false, optional = true }
tokio = { version = "1.0", default-features = false, features = [
smol = { version = "2.0", default-features = false, optional = true }
tokio = { version = "1.39", default-features = false, features = [
"rt",
], optional = true }
async-std = { version = "1.9", optional = true }
async-std = { version = "1.12", optional = true }

[features]
default = ["rayon", "plotters", "cargo_bench_support"]
Expand Down
3 changes: 3 additions & 0 deletions crates/criterion_compat/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("cargo::rustc-check-cfg=cfg(codspeed)");
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.77.2"
channel = "1.80"

0 comments on commit 814fb2b

Please sign in to comment.