Skip to content

Commit ff38e61

Browse files
committed
run_parser
1 parent 6ef9fb3 commit ff38e61

File tree

24 files changed

+242
-243
lines changed

24 files changed

+242
-243
lines changed

services/cli/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ publish = false
1010
default = ["plus"]
1111
plus = ["bencher_client/plus", "bencher_comment/plus", "bencher_json/plus"]
1212

13-
[build-dependencies]
14-
bencher_json = { workspace = true, features = ["lite"] }
15-
1613
[dependencies]
1714
# Workspace
1815
bencher_adapter.workspace = true

services/cli/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
// This is here to test that the fingerprinting is working correctly on all platforms.
3-
#[allow(clippy::expect_used)]
4-
let _ = bencher_json::Fingerprint::new().expect("Failed to create fingerprint");
3+
// #[allow(clippy::expect_used)]
4+
// let _ = bencher_valid::Fingerprint::new().expect("Failed to create fingerprint");
55
}

services/cli/src/bencher/sub/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ use project::{
2828
testbed::Testbed,
2929
threshold::Threshold,
3030
};
31-
pub use project::{
32-
archive::ArchiveError, report::thresholds::ThresholdsError, threshold::ThresholdError,
33-
};
31+
pub use project::{archive::ArchiveError, report::ThresholdsError, threshold::ThresholdError};
3432
pub use run::RunError;
3533
use run::{runner::output::Output, Run};
3634
pub use sub_cmd::SubCmd;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
use bencher_client::types::Adapter;
2+
3+
use crate::parser::project::report::CliReportAdapter;
4+
5+
impl From<CliReportAdapter> for Adapter {
6+
fn from(adapter: CliReportAdapter) -> Self {
7+
match adapter {
8+
CliReportAdapter::Magic => Self::Magic,
9+
CliReportAdapter::Json => Self::Json,
10+
CliReportAdapter::CSharp => Self::CSharp,
11+
CliReportAdapter::CSharpDotNet => Self::CSharpDotNet,
12+
CliReportAdapter::Cpp => Self::Cpp,
13+
CliReportAdapter::CppCatch2 => Self::CppCatch2,
14+
CliReportAdapter::CppGoogle => Self::CppGoogle,
15+
CliReportAdapter::Go => Self::Go,
16+
CliReportAdapter::GoBench => Self::GoBench,
17+
CliReportAdapter::Java => Self::Java,
18+
CliReportAdapter::JavaJmh => Self::JavaJmh,
19+
CliReportAdapter::Js => Self::Js,
20+
CliReportAdapter::JsBenchmark => Self::JsBenchmark,
21+
CliReportAdapter::JsTime => Self::JsTime,
22+
CliReportAdapter::Python => Self::Python,
23+
CliReportAdapter::PythonAsv => Self::PythonAsv,
24+
CliReportAdapter::PythonPytest => Self::PythonPytest,
25+
CliReportAdapter::Ruby => Self::Ruby,
26+
CliReportAdapter::RubyBenchmark => Self::RubyBenchmark,
27+
CliReportAdapter::Rust => Self::Rust,
28+
CliReportAdapter::RustBench => Self::RustBench,
29+
CliReportAdapter::RustCriterion => Self::RustCriterion,
30+
CliReportAdapter::RustIai => Self::RustIai,
31+
CliReportAdapter::RustIaiCallgrind => Self::RustIaiCallgrind,
32+
CliReportAdapter::Shell => Self::Shell,
33+
CliReportAdapter::ShellHyperfine => Self::ShellHyperfine,
34+
}
35+
}
36+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use bencher_client::types::JsonAverage;
2+
3+
use crate::parser::project::report::CliReportAverage;
4+
5+
impl From<CliReportAverage> for JsonAverage {
6+
fn from(average: CliReportAverage) -> Self {
7+
match average {
8+
CliReportAverage::Mean => Self::Mean,
9+
CliReportAverage::Median => Self::Median,
10+
}
11+
}
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use bencher_client::types::JsonFold;
2+
3+
use crate::parser::project::report::CliReportFold;
4+
5+
impl From<CliReportFold> for JsonFold {
6+
fn from(fold: CliReportFold) -> Self {
7+
match fold {
8+
CliReportFold::Min => Self::Min,
9+
CliReportFold::Max => Self::Max,
10+
CliReportFold::Mean => Self::Mean,
11+
CliReportFold::Median => Self::Median,
12+
}
13+
}
14+
}

services/cli/src/bencher/sub/project/report/create.rs renamed to services/cli/src/bencher/sub/project/report/create/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ use crate::{
1313
CliError,
1414
};
1515

16-
use super::thresholds::Thresholds;
16+
mod adapter;
17+
mod average;
18+
mod fold;
19+
mod thresholds;
20+
21+
pub use thresholds::{Thresholds, ThresholdsError};
1722

1823
#[derive(Debug, Clone)]
1924
pub struct Create {

services/cli/src/bencher/sub/project/report/thresholds.rs renamed to services/cli/src/bencher/sub/project/report/create/thresholds.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
bencher::sub::project::threshold::model::Model,
88
parser::{
99
project::{
10-
run::CliRunThresholds,
10+
report::CliReportThresholds,
1111
threshold::{CliModel, CliModelTest},
1212
},
1313
ElidedOption,
@@ -44,11 +44,11 @@ pub enum ThresholdsError {
4444
ExtraUpperBoundaries(Vec<ElidedOption<Boundary>>),
4545
}
4646

47-
impl TryFrom<CliRunThresholds> for Thresholds {
47+
impl TryFrom<CliReportThresholds> for Thresholds {
4848
type Error = ThresholdsError;
4949

50-
fn try_from(thresholds: CliRunThresholds) -> Result<Self, Self::Error> {
51-
let CliRunThresholds {
50+
fn try_from(thresholds: CliReportThresholds) -> Result<Self, Self::Error> {
51+
let CliReportThresholds {
5252
threshold_measure,
5353
threshold_test,
5454
threshold_min_sample_size,

services/cli/src/bencher/sub/project/report/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ use crate::{bencher::sub::SubCmd, parser::project::report::CliReport, CliError};
33
mod create;
44
mod delete;
55
mod list;
6-
pub mod thresholds;
76
mod view;
87

8+
pub use create::{Thresholds, ThresholdsError};
9+
910
#[derive(Debug)]
1011
pub enum Report {
1112
List(list::List),

services/cli/src/bencher/sub/run/adapter.rs

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)