mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Use kebab-case for CompileMode, & discard some info
This commit is contained in:
parent
7b081569ed
commit
27424e2dba
@ -1,6 +1,8 @@
|
||||
use std::path::Path;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use serde::ser;
|
||||
|
||||
use util::{CargoResult, CargoResultExt, Config, RustfixDiagnosticServer};
|
||||
|
||||
/// Configuration information for a rustc build.
|
||||
@ -111,7 +113,7 @@ pub enum MessageFormat {
|
||||
/// `compile_ws` to tell it the general execution strategy. This influences
|
||||
/// the default targets selected. The other use is in the `Unit` struct
|
||||
/// to indicate what is being done with a specific target.
|
||||
#[derive(Clone, Copy, PartialEq, Debug, Eq, Hash, PartialOrd, Ord, Serialize)]
|
||||
#[derive(Clone, Copy, PartialEq, Debug, Eq, Hash, PartialOrd, Ord)]
|
||||
pub enum CompileMode {
|
||||
/// A target being built for a test.
|
||||
Test,
|
||||
@ -136,6 +138,24 @@ pub enum CompileMode {
|
||||
RunCustomBuild,
|
||||
}
|
||||
|
||||
impl ser::Serialize for CompileMode {
|
||||
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: ser::Serializer,
|
||||
{
|
||||
use self::CompileMode::*;
|
||||
match *self {
|
||||
Test => "test".serialize(s),
|
||||
Build => "build".serialize(s),
|
||||
Check { .. } => "check".serialize(s),
|
||||
Bench => "bench".serialize(s),
|
||||
Doc { .. } => "doc".serialize(s),
|
||||
Doctest => "doctest".serialize(s),
|
||||
RunCustomBuild => "run-custom-build".serialize(s),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CompileMode {
|
||||
/// Returns true if the unit is being checked.
|
||||
pub fn is_check(self) -> bool {
|
||||
|
@ -29,7 +29,7 @@ fn cargo_build_plan_simple() {
|
||||
"package_version": "0.5.0",
|
||||
"program": "rustc",
|
||||
"target_kind": ["bin"],
|
||||
"compile_mode": "Build"
|
||||
"compile_mode": "build"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -88,7 +88,7 @@ fn cargo_build_plan_single_dep() {
|
||||
"package_version": "0.0.1",
|
||||
"program": "rustc",
|
||||
"target_kind": ["lib"],
|
||||
"compile_mode": "Build"
|
||||
"compile_mode": "build"
|
||||
},
|
||||
{
|
||||
"args": "{...}",
|
||||
@ -104,7 +104,7 @@ fn cargo_build_plan_single_dep() {
|
||||
"package_version": "0.5.0",
|
||||
"program": "rustc",
|
||||
"target_kind": ["lib"],
|
||||
"compile_mode": "Build"
|
||||
"compile_mode": "build"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -152,7 +152,7 @@ fn cargo_build_plan_build_script() {
|
||||
"package_version": "0.5.0",
|
||||
"program": "rustc",
|
||||
"target_kind": ["custom-build"],
|
||||
"compile_mode": "Build"
|
||||
"compile_mode": "build"
|
||||
},
|
||||
{
|
||||
"args": "{...}",
|
||||
@ -166,7 +166,7 @@ fn cargo_build_plan_build_script() {
|
||||
"package_version": "0.5.0",
|
||||
"program": "[..]/build-script-build",
|
||||
"target_kind": ["custom-build"],
|
||||
"compile_mode": "RunCustomBuild"
|
||||
"compile_mode": "run-custom-build"
|
||||
},
|
||||
{
|
||||
"args": "{...}",
|
||||
@ -180,7 +180,7 @@ fn cargo_build_plan_build_script() {
|
||||
"package_version": "0.5.0",
|
||||
"program": "rustc",
|
||||
"target_kind": ["bin"],
|
||||
"compile_mode": "Build"
|
||||
"compile_mode": "build"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user