Skip to content

Commit ff38e61

Browse files
committed
run_parser
1 parent 6ef9fb3 commit ff38e61

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.

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use bencher_json::{project::branch::BRANCH_MAIN_STR, GitHash, NameId};
22

33
use crate::{
44
bencher::sub::project::branch::start_point::StartPoint,
5-
parser::project::run::{CliRunBranch, CliRunHash},
5+
parser::run::{CliRunBranch, CliRunHash},
66
};
77

88
#[allow(clippy::struct_field_names)]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use bencher_comment::ReportComment;
44

5-
use crate::parser::project::run::CliRunCi;
5+
use crate::parser::run::CliRunCi;
66

77
mod github_actions;
88

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub enum RunError {
99
#[error("{0}")]
1010
Branch(#[from] super::branch::BranchError),
1111
#[error("{0}")]
12-
Thresholds(#[from] crate::bencher::sub::project::report::thresholds::ThresholdsError),
12+
Thresholds(#[from] crate::bencher::sub::project::report::ThresholdsError),
1313

1414
#[error("No default shell command path for target family. Try setting a custom shell with the `--shell` argument.")]
1515
Shell,

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::parser::project::run::CliRunFormat;
1+
use crate::parser::run::CliRunFormat;
22

33
#[derive(Debug, Clone, Copy)]
44
pub enum Format {

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ use project::local_project;
88
use crate::{
99
bencher::backend::AuthBackend,
1010
cli_eprintln_quietable, cli_println, cli_println_quietable,
11-
parser::project::run::{CliRun, CliRunOutput},
11+
parser::run::{CliRun, CliRunOutput},
1212
CliError,
1313
};
1414

15-
mod adapter;
16-
mod average;
1715
mod branch;
1816
mod ci;
1917
mod error;
20-
mod fold;
2118
mod format;
2219
mod project;
2320
pub mod runner;
@@ -32,7 +29,7 @@ use sub_adapter::SubAdapter;
3229

3330
use crate::bencher::SubCmd;
3431

35-
use super::project::report::thresholds::Thresholds;
32+
use super::project::report::Thresholds;
3633

3734
#[derive(Debug)]
3835
#[allow(clippy::struct_excessive_bools)]

services/cli/src/bencher/sub/run/runner/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use super::build_time::{BuildCommand, BuildTime};
77
use super::file_path::FilePath;
88
use super::file_size::FileSize;
99
use super::{flag::Flag, output::Output, shell::Shell};
10-
use crate::{bencher::sub::RunError, parser::project::run::CliRunShell};
10+
use crate::{bencher::sub::RunError, parser::run::CliRunShell};
1111
use crate::{cli_eprintln_quietable, cli_println_quietable};
1212

1313
#[derive(Debug, Clone)]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::fmt;
44

5-
use crate::parser::project::run::CliRunCommand;
5+
use crate::parser::run::CliRunCommand;
66

77
mod build_time;
88
pub mod command;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::parser::project::run::CliRunCommand;
1+
use crate::parser::run::CliRunCommand;
22

33
#[derive(Debug, Clone, Copy)]
44
pub struct SubAdapter {

services/cli/src/parser/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub mod docker;
77
pub mod mock;
88
pub mod organization;
99
pub mod project;
10+
pub mod run;
1011
pub mod system;
1112
pub mod user;
1213

@@ -16,8 +17,9 @@ use organization::{member::CliMember, CliOrganization};
1617
use project::{
1718
alert::CliAlert, archive::CliArchive, benchmark::CliBenchmark, branch::CliBranch,
1819
measure::CliMeasure, metric::CliMetric, perf::CliPerf, plot::CliPlot, report::CliReport,
19-
run::CliRun, testbed::CliTestbed, threshold::CliThreshold, CliProject,
20+
testbed::CliTestbed, threshold::CliThreshold, CliProject,
2021
};
22+
use run::CliRun;
2123
use system::{auth::CliAuth, server::CliServer};
2224
use user::{token::CliToken, CliUser};
2325

services/cli/src/parser/project/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub mod metric;
1414
pub mod perf;
1515
pub mod plot;
1616
pub mod report;
17-
pub mod run;
1817
pub mod testbed;
1918
pub mod threshold;
2019

0 commit comments

Comments
 (0)