summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2019-03-30 11:16:31 +0100
committerPietro Albini <pietro@pietroalbini.org>2019-03-30 11:28:37 +0100
commite5c6237c156065eca542867d1495d0ec48888397 (patch)
treed679fe84b064e25fc5186a18d921b6972280c40a
parent84fbef0d92829da723517cdbd87a97585ebba2d5 (diff)
add rfcbot configuration
-rw-r--r--rust_team_data/src/v1.rs12
-rw-r--r--src/schema.rs13
-rw-r--r--src/static_api.rs28
-rw-r--r--src/validate.rs14
-rw-r--r--teams/cargo.toml5
-rw-r--r--teams/compiler.toml5
-rw-r--r--teams/core.toml5
-rw-r--r--teams/crates-io.toml5
-rw-r--r--teams/devtools.toml5
-rw-r--r--teams/docs.toml5
-rw-r--r--teams/ides.toml5
-rw-r--r--teams/infra.toml5
-rw-r--r--teams/lang.toml5
-rw-r--r--teams/libs.toml5
-rw-r--r--teams/mods.toml5
-rw-r--r--teams/rustdoc.toml5
16 files changed, 127 insertions, 0 deletions
diff --git a/rust_team_data/src/v1.rs b/rust_team_data/src/v1.rs
index bb69449..50edebd 100644
--- a/rust_team_data/src/v1.rs
+++ b/rust_team_data/src/v1.rs
@@ -64,3 +64,15 @@ pub struct Lists {
pub struct Permission {
pub github_users: Vec<String>,
}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Rfcbot {
+ pub teams: IndexMap<String, RfcbotTeam>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct RfcbotTeam {
+ pub name: String,
+ pub ping: String,
+ pub members: Vec<String>,
+}
diff --git a/src/schema.rs b/src/schema.rs
index 0143301..be6b7a1 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -103,6 +103,7 @@ pub(crate) struct Team {
people: TeamPeople,
#[serde(default)]
permissions: Permissions,
+ rfcbot: Option<RfcbotData>,
website: Option<WebsiteData>,
#[serde(default)]
lists: Vec<TeamList>,
@@ -125,6 +126,10 @@ impl Team {
self.people.leads.iter().map(|s| s.as_str()).collect()
}
+ pub(crate) fn rfcbot_data(&self) -> Option<&RfcbotData> {
+ self.rfcbot.as_ref()
+ }
+
pub(crate) fn website_data(&self) -> Option<&WebsiteData> {
self.website.as_ref()
}
@@ -218,6 +223,14 @@ struct TeamPeople {
include_all_team_members: bool,
}
+#[derive(serde_derive::Deserialize, Debug)]
+#[serde(rename_all = "kebab-case", deny_unknown_fields)]
+pub(crate) struct RfcbotData {
+ pub(crate) label: String,
+ pub(crate) name: String,
+ pub(crate) ping: String,
+}
+
pub(crate) struct DiscordInvite<'a> {
pub(crate) url: &'a str,
pub(crate) channel: &'a str,
diff --git a/src/static_api.rs b/src/static_api.rs
index 24bd989..3348d74 100644
--- a/src/static_api.rs
+++ b/src/static_api.rs
@@ -25,6 +25,7 @@ impl<'a> Generator<'a> {
self.generate_teams()?;
self.generate_lists()?;
self.generate_permissions()?;
+ self.generate_rfcbot()?;
Ok(())
}
@@ -112,6 +113,33 @@ impl<'a> Generator<'a> {
Ok(())
}
+ fn generate_rfcbot(&self) -> Result<(), Error> {
+ let mut teams = IndexMap::new();
+
+ for team in self.data.teams() {
+ if let Some(rfcbot) = team.rfcbot_data() {
+ let mut members = team
+ .members(&self.data)?
+ .into_iter()
+ .map(|s| s.to_string())
+ .collect::<Vec<_>>();
+ members.sort();
+ teams.insert(
+ rfcbot.label.clone(),
+ v1::RfcbotTeam {
+ name: rfcbot.name.clone(),
+ ping: rfcbot.ping.clone(),
+ members,
+ },
+ );
+ }
+ }
+
+ teams.sort_keys();
+ self.add("v1/rfcbot.json", &v1::Rfcbot { teams })?;
+ Ok(())
+ }
+
fn add<T: serde::Serialize>(&self, path: &str, obj: &T) -> Result<(), Error> {
info!("writing API object {}...", path);
let dest = self.dest.join(path);
diff --git a/src/validate.rs b/src/validate.rs
index 90881fe..21570d2 100644
--- a/src/validate.rs
+++ b/src/validate.rs
@@ -18,6 +18,7 @@ static CHECKS: &[fn(&Data, &mut Vec<String>)] = &[
validate_discord_name,
validate_duplicate_permissions,
validate_permissions,
+ validate_rfcbot_labels,
];
pub(crate) fn validate(data: &Data) -> Result<(), Error> {
@@ -284,6 +285,19 @@ fn validate_permissions(data: &Data, errors: &mut Vec<String>) {
});
}
+/// Ensure there are no duplicate rfcbot labels
+fn validate_rfcbot_labels(data: &Data, errors: &mut Vec<String>) {
+ let mut labels = HashSet::new();
+ wrapper(data.teams(), errors, move |team, errors| {
+ if let Some(rfcbot) = team.rfcbot_data() {
+ if !labels.insert(rfcbot.label.clone()) {
+ errors.push(format!("duplicate rfcbot label: {}", rfcbot.label));
+ }
+ }
+ Ok(())
+ });
+}
+
fn wrapper<T, I, F>(iter: I, errors: &mut Vec<String>, mut func: F)
where
I: Iterator<Item = T>,
diff --git a/teams/cargo.toml b/teams/cargo.toml
index dbfe903..2f0541d 100644
--- a/teams/cargo.toml
+++ b/teams/cargo.toml
@@ -17,6 +17,11 @@ members = [
[permissions]
bors.cargo.review = true
+[rfcbot]
+label = "T-cargo"
+name = "Cargo"
+ping = "rust-lang/cargo"
+
[website]
name = "Cargo team"
description = "design and implementation of Cargo"
diff --git a/teams/compiler.toml b/teams/compiler.toml
index 518a8ec..32f88f3 100644
--- a/teams/compiler.toml
+++ b/teams/compiler.toml
@@ -21,6 +21,11 @@ perf = true
crater = true
bors.rust.review = true
+[rfcbot]
+label = "T-compiler"
+name = "Compiler"
+ping = "rust-lang/compiler"
+
[website]
name = "Compiler team"
description = "compiler internals, optimizations"
diff --git a/teams/core.toml b/teams/core.toml
index 2d2d33c..729dc2c 100644
--- a/teams/core.toml
+++ b/teams/core.toml
@@ -17,6 +17,11 @@ members = [
[permissions]
bors.rust.review = true
+[rfcbot]
+label = "T-core"
+name = "Core"
+ping = "rust-lang/core"
+
[website]
name = "Core team"
description = "Direction of the project, subteam leadership, cross-cutting concerns."
diff --git a/teams/crates-io.toml b/teams/crates-io.toml
index 7970f41..ab6fd01 100644
--- a/teams/crates-io.toml
+++ b/teams/crates-io.toml
@@ -13,6 +13,11 @@ members = [
"steveklabnik",
]
+[rfcbot]
+label = "T-crates-io"
+name = "Crates.io"
+ping = "rust-lang/crates-io"
+
[website]
name = "Crates.io team"
description = "management of operations, development, and policies for crates.io"
diff --git a/teams/devtools.toml b/teams/devtools.toml
index 677f740..341b775 100644
--- a/teams/devtools.toml
+++ b/teams/devtools.toml
@@ -4,6 +4,11 @@ name = "devtools"
leads = ["killercup", "Manishearth"]
members = ["killercup", "Manishearth", "Xanewok", "fitzgen", "GuillaumeGomez", "oli-obk", "dwijnand"]
+[rfcbot]
+label = "T-dev-tools"
+name = "Dev tols"
+ping = "rust-lang/dev-tools"
+
[website]
page = "dev-tools"
name = "Dev tools team"
diff --git a/teams/docs.toml b/teams/docs.toml
index 2da9f90..6d2845d 100644
--- a/teams/docs.toml
+++ b/teams/docs.toml
@@ -14,6 +14,11 @@ members = [
[permissions]
bors.rust.review = true
+[rfcbot]
+label = "T-doc"
+name = "Documentation"
+ping = "rust-lang/docs"
+
[website]
page = "documentation"
name = "Documentation team"
diff --git a/teams/ides.toml b/teams/ides.toml
index 7edf043..edad44c 100644
--- a/teams/ides.toml
+++ b/teams/ides.toml
@@ -14,6 +14,11 @@ members = [
"Xanewok",
]
+[rfcbot]
+label = "T-IDEs"
+name = "IDEs and editors"
+ping = "rust-lang/ides"
+
[website]
name = "IDEs and editors team"
description = "IDEs, editors, and supporting tools such as Racer and the RLS"
diff --git a/teams/infra.toml b/teams/infra.toml
index 52316e5..1c4fc0f 100644
--- a/teams/infra.toml
+++ b/teams/infra.toml
@@ -22,6 +22,11 @@ crater = true
bors.rust.review = true
bors.crater.review = true
+[rfcbot]
+label = "T-infra"
+name = "Infrastructure"
+ping = "rust-lang/infra"
+
[website]
name = "Infrastructure team"
description = "infrastructure supporting the Rust project itself: CI, releases, bots, metrics"
diff --git a/teams/lang.toml b/teams/lang.toml
index 4432697..7de5837 100644
--- a/teams/lang.toml
+++ b/teams/lang.toml
@@ -18,6 +18,11 @@ members = [
perf = true
bors.rust.review = true
+[rfcbot]
+label = "T-lang"
+name = "Language"
+ping = "rust-lang/lang"
+
[website]
name = "Language team"
description = "designing new language features"
diff --git a/teams/libs.toml b/teams/libs.toml
index 72a7050..6aebfb3 100644
--- a/teams/libs.toml
+++ b/teams/libs.toml
@@ -20,6 +20,11 @@ perf = true
crater = true
bors.rust.review = true
+[rfcbot]
+label = "T-libs"
+name = "Libraries"
+ping = "rust-lang/libs"
+
[website]
page = "library"
name = "Library team"
diff --git a/teams/mods.toml b/teams/mods.toml
index f6c1b64..b07fcee 100644
--- a/teams/mods.toml
+++ b/teams/mods.toml
@@ -10,6 +10,11 @@ members = [
"matthieu-m",
]
+[rfcbot]
+label = "T-moderation"
+name = "Moderation"
+ping = "rust-lang/moderation"
+
[website]
page = "moderation"
name = "Moderation team"
diff --git a/teams/rustdoc.toml b/teams/rustdoc.toml
index f959492..17272cf 100644
--- a/teams/rustdoc.toml
+++ b/teams/rustdoc.toml
@@ -14,6 +14,11 @@ members = [
crater = true
bors.rust.review = true
+[rfcbot]
+label = "T-rustdoc"
+name = "Rustdoc"
+ping = "rust-lang/rustdoc"
+
[website]
name = "Rustdoc team"
description = "Documentation tools including Rustdoc and docs.rs"