Add metadata to targets
This adds four pieces of metadata to every target: - description - tier - host tools - std This information is currently scattered across target docs and both - not machine readable, making validation harder - sometimes subtly encoding by the table it's in, causing mistakes and making it harder to review changes to the properties By putting it in the compiler, we improve this. Later, we will use this canonical information to generate target documentation from it.
This commit is contained in:
parent
af69f4c48c
commit
5bcb66cfb3
232 changed files with 1422 additions and 238 deletions
|
@ -2,7 +2,9 @@ use std::borrow::Cow;
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
pub use serde_json::Value as Json;
|
||||
use serde_json::{Map, Number};
|
||||
use serde_json::{json, Map, Number};
|
||||
|
||||
use crate::spec::TargetMetadata;
|
||||
|
||||
pub trait ToJson {
|
||||
fn to_json(&self) -> Json;
|
||||
|
@ -120,3 +122,14 @@ impl ToJson for crate::abi::call::Conv {
|
|||
Json::String(s.to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for TargetMetadata {
|
||||
fn to_json(&self) -> Json {
|
||||
json!({
|
||||
"description": self.description,
|
||||
"tier": self.tier,
|
||||
"host_tools": self.host_tools,
|
||||
"std": self.std,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue