// except according to those terms.
extern crate toml;
-extern crate rustc_serialize;
+#[macro_use]
+extern crate serde_derive;
+extern crate serde;
use std::collections::BTreeMap;
use std::env;
"x86_64-pc-windows-gnu",
];
+#[derive(Serialize)]
+#[serde(rename_all = "kebab-case")]
struct Manifest {
manifest_version: String,
date: String,
pkg: BTreeMap<String, Package>,
}
-#[derive(RustcEncodable)]
+#[derive(Serialize)]
struct Package {
version: String,
target: BTreeMap<String, Target>,
}
-#[derive(RustcEncodable)]
+#[derive(Serialize)]
struct Target {
available: bool,
url: Option<String>,
}
}
-#[derive(RustcEncodable)]
+#[derive(Serialize)]
struct Component {
pkg: String,
target: String,
self.rls_version = self.version("rls", "x86_64-unknown-linux-gnu");
self.digest_and_sign();
- let Manifest { manifest_version, date, pkg } = self.build_manifest();
-
- // Unfortunately we can't use derive(RustcEncodable) here because the
- // version field is called `manifest-version`, not `manifest_version`.
- // In lieu of that just create the table directly here with a `BTreeMap`
- // and wrap it up in a `Value::Table`.
- let mut manifest = BTreeMap::new();
- manifest.insert("manifest-version".to_string(),
- toml::Value::String(manifest_version));
- manifest.insert("date".to_string(), toml::Value::String(date.clone()));
- manifest.insert("pkg".to_string(), toml::encode(&pkg));
- let manifest = toml::Value::Table(manifest).to_string();
-
+ let manifest = self.build_manifest();
let filename = format!("channel-rust-{}.toml", self.rust_release);
- self.write_manifest(&manifest, &filename);
+ self.write_manifest(&toml::to_string(&manifest).unwrap(), &filename);
let filename = format!("channel-rust-{}-date.txt", self.rust_release);
- self.write_date_stamp(&date, &filename);
+ self.write_date_stamp(&manifest.date, &filename);
if self.rust_release != "beta" && self.rust_release != "nightly" {
- self.write_manifest(&manifest, "channel-rust-stable.toml");
- self.write_date_stamp(&date, "channel-rust-stable-date.txt");
+ self.write_manifest(&toml::to_string(&manifest).unwrap(), "channel-rust-stable.toml");
+ self.write_date_stamp(&manifest.date, "channel-rust-stable-date.txt");
}
}