]> git.lizzy.rs Git - rust.git/commitdiff
Update to toml 0.4
authorMark Simulacrum <mark.simulacrum@gmail.com>
Tue, 4 Jul 2017 16:03:01 +0000 (10:03 -0600)
committerMark Simulacrum <mark.simulacrum@gmail.com>
Thu, 20 Jul 2017 17:23:59 +0000 (11:23 -0600)
src/Cargo.lock
src/bootstrap/Cargo.toml
src/bootstrap/builder.rs
src/bootstrap/config.rs
src/bootstrap/lib.rs
src/bootstrap/metadata.rs
src/bootstrap/tool.rs
src/tools/build-manifest/Cargo.toml
src/tools/build-manifest/src/main.rs

index c210f80431bd7d10681fea9e111eb0e88f2295b3..35d77eda951102d2cf89d3f5037881f841608daa 100644 (file)
@@ -136,11 +136,10 @@ dependencies = [
  "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
+ "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -156,8 +155,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "build-manifest"
 version = "0.1.0"
 dependencies = [
- "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1871,14 +1871,6 @@ dependencies = [
 name = "tidy"
 version = "0.1.0"
 
-[[package]]
-name = "toml"
-version = "0.1.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "toml"
 version = "0.2.1"
@@ -2173,7 +2165,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
 "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
 "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
-"checksum toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "0590d72182e50e879c4da3b11c6488dae18fccb1ae0c7a3eda18e16795844796"
 "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4"
 "checksum toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b0601da6c97135c8d330c7a13a013ca6cd4143221b01de2f8d4edc50a9e551c7"
 "checksum typed-arena 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5934776c3ac1bea4a9d56620d6bf2d483b20d394e49581db40f187e1118ff667"
index f557dcc476381c23b2dd080ac99f80f619d66352..00004d71aac250f6bedbd48c940647af49fa9652 100644 (file)
@@ -33,11 +33,10 @@ build_helper = { path = "../build_helper" }
 cmake = "0.1.23"
 filetime = "0.1"
 num_cpus = "1.0"
-toml = "0.1"
 getopts = "0.2"
-rustc-serialize = "0.3"
 gcc = "0.3.50"
 libc = "0.2"
-serde = "1.0"
-serde_json = "1.0"
-serde_derive = "1.0"
+serde = "1.0.8"
+serde_derive = "1.0.8"
+serde_json = "1.0.2"
+toml = "0.4"
index e6432e8938c1c5615f682c6b9b3aea64e893918e..e284e4b9d0ac7cef00fa93bae782adb6b0bfc6d5 100644 (file)
@@ -25,6 +25,7 @@
 use check;
 use flags::Subcommand;
 use doc;
+use tool;
 
 pub use Compiler;
 
@@ -144,7 +145,10 @@ pub fn run(build: &Build) {
         let builder = &builder;
         match builder.kind {
             Kind::Build => check!(builder, paths, compile::Std, compile::Test, compile::Rustc,
-                compile::StartupObjects),
+                compile::StartupObjects, tool::BuildManifest, tool::Rustbook, tool::ErrorIndex,
+                tool::UnstableBookGen, tool::Tidy, tool::Linkchecker, tool::CargoTest,
+                tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
+                tool::RustInstaller, tool::Cargo, tool::Rls),
             Kind::Test => check!(builder, paths, check::Tidy, check::Bootstrap, check::Compiletest,
                 check::Krate, check::KrateLibrustc, check::Linkcheck, check::Cargotest,
                 check::Cargo, check::Docs, check::ErrorIndex, check::Distcheck),
index 34628852ab3773a2ff50bc051d77231bfd96b438..810a9924765d8b955f3bb2bc856047e842a433a2 100644 (file)
@@ -21,8 +21,7 @@
 use std::process;
 
 use num_cpus;
-use rustc_serialize::Decodable;
-use toml::{Parser, Decoder, Value};
+use toml;
 use util::{exe, push_exe_path};
 
 /// Global configuration for the entire build and/or bootstrap.
@@ -138,7 +137,9 @@ pub struct Target {
 /// This structure uses `Decodable` to automatically decode a TOML configuration
 /// file into this format, and then this is traversed and written into the above
 /// `Config` structure.
-#[derive(RustcDecodable, Default)]
+#[derive(Deserialize, Default)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all = "kebab-case")]
 struct TomlConfig {
     build: Option<Build>,
     install: Option<Install>,
@@ -149,10 +150,14 @@ struct TomlConfig {
 }
 
 /// TOML representation of various global build decisions.
-#[derive(RustcDecodable, Default, Clone)]
+#[derive(Deserialize, Default, Clone)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all = "kebab-case")]
 struct Build {
     build: Option<String>,
+    #[serde(default)]
     host: Vec<String>,
+    #[serde(default)]
     target: Vec<String>,
     cargo: Option<String>,
     rustc: Option<String>,
@@ -174,7 +179,9 @@ struct Build {
 }
 
 /// TOML representation of various global install decisions.
-#[derive(RustcDecodable, Default, Clone)]
+#[derive(Deserialize, Default, Clone)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all = "kebab-case")]
 struct Install {
     prefix: Option<String>,
     sysconfdir: Option<String>,
@@ -185,7 +192,9 @@ struct Install {
 }
 
 /// TOML representation of how the LLVM build is configured.
-#[derive(RustcDecodable, Default)]
+#[derive(Deserialize, Default)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all = "kebab-case")]
 struct Llvm {
     ccache: Option<StringOrBool>,
     ninja: Option<bool>,
@@ -200,7 +209,9 @@ struct Llvm {
     clean_rebuild: Option<bool>,
 }
 
-#[derive(RustcDecodable, Default, Clone)]
+#[derive(Deserialize, Default, Clone)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all = "kebab-case")]
 struct Dist {
     sign_folder: Option<String>,
     gpg_password_file: Option<String>,
@@ -208,7 +219,8 @@ struct Dist {
     src_tarball: Option<bool>,
 }
 
-#[derive(RustcDecodable)]
+#[derive(Deserialize)]
+#[serde(untagged)]
 enum StringOrBool {
     String(String),
     Bool(bool),
@@ -221,7 +233,9 @@ fn default() -> StringOrBool {
 }
 
 /// TOML representation of how the Rust build is configured.
-#[derive(RustcDecodable, Default)]
+#[derive(Deserialize, Default)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all = "kebab-case")]
 struct Rust {
     optimize: Option<bool>,
     codegen_units: Option<u32>,
@@ -243,7 +257,9 @@ struct Rust {
 }
 
 /// TOML representation of how each build target is configured.
-#[derive(RustcDecodable, Default)]
+#[derive(Deserialize, Default)]
+#[serde(deny_unknown_fields)]
+#[serde(rename_all = "kebab-case")]
 struct TomlTarget {
     llvm_config: Option<String>,
     jemalloc: Option<String>,
@@ -273,27 +289,13 @@ pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
 
         let toml = file.map(|file| {
             let mut f = t!(File::open(&file));
-            let mut toml = String::new();
-            t!(f.read_to_string(&mut toml));
-            let mut p = Parser::new(&toml);
-            let table = match p.parse() {
-                Some(table) => table,
-                None => {
-                    println!("failed to parse TOML configuration '{}':", file.to_str().unwrap());
-                    for err in p.errors.iter() {
-                        let (loline, locol) = p.to_linecol(err.lo);
-                        let (hiline, hicol) = p.to_linecol(err.hi);
-                        println!("{}:{}-{}:{}: {}", loline, locol, hiline,
-                                 hicol, err.desc);
-                    }
-                    process::exit(2);
-                }
-            };
-            let mut d = Decoder::new(Value::Table(table));
-            match Decodable::decode(&mut d) {
-                Ok(cfg) => cfg,
-                Err(e) => {
-                    println!("failed to decode TOML: {}", e);
+            let mut contents = String::new();
+            t!(f.read_to_string(&mut contents));
+            match toml::from_str(&contents) {
+                Ok(table) => table,
+                Err(err) => {
+                    println!("failed to parse TOML configuration '{}': {}",
+                        file.display(), err);
                     process::exit(2);
                 }
             }
index d6b474ab3aff1aafc4266e105a66a8f821965383..d4ef6613a2a5e4667ee8376ea77702cf8ad9853e 100644 (file)
 extern crate gcc;
 extern crate getopts;
 extern crate num_cpus;
-extern crate rustc_serialize;
 extern crate toml;
 
 #[cfg(unix)]
index 9326bb7129afa7f59d50d8d72360fc3eaea2271f..ca0eed3ae86f844ae4b914fe519ce3210d53e188 100644 (file)
 use std::path::PathBuf;
 
 use build_helper::output;
-use rustc_serialize::json;
+use serde_json;
 
 use {Build, Crate};
 
-#[derive(RustcDecodable)]
+#[derive(Deserialize)]
 struct Output {
     packages: Vec<Package>,
     resolve: Resolve,
 }
 
-#[derive(RustcDecodable)]
+#[derive(Deserialize)]
 struct Package {
     id: String,
     name: String,
@@ -32,12 +32,12 @@ struct Package {
     manifest_path: String,
 }
 
-#[derive(RustcDecodable)]
+#[derive(Deserialize)]
 struct Resolve {
     nodes: Vec<ResolveNode>,
 }
 
-#[derive(RustcDecodable)]
+#[derive(Deserialize)]
 struct ResolveNode {
     id: String,
     dependencies: Vec<String>,
@@ -61,7 +61,7 @@ fn build_krate(build: &mut Build, krate: &str) {
          .arg("--format-version").arg("1")
          .arg("--manifest-path").arg(build.src.join(krate).join("Cargo.toml"));
     let output = output(&mut cargo);
-    let output: Output = json::decode(&output).unwrap();
+    let output: Output = serde_json::from_str(&output).unwrap();
     let mut id2name = HashMap::new();
     for package in output.packages {
         if package.source.is_none() {
index 50e76c324c3ea5712c67b6b69a24532b49904989..eecfbdc8b3dc73d53d96632cabf65b9b40366eb1 100644 (file)
@@ -238,7 +238,7 @@ fn run(self, builder: &Builder) -> PathBuf {
     //      .dep(|s| s.name("maybe-clean-tools"))
     //      .dep(|s| s.name("libstd-tool"))
     //      .run(move |s| compile::tool(build, s.stage, s.target, "build-manifest"));
-    BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Libstd;
+    BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Librustc;
     // rules.build("tool-remote-test-server", "src/tools/remote-test-server")
     //      .dep(|s| s.name("maybe-clean-tools"))
     //      .dep(|s| s.name("libstd-tool"))
index 4b876753b1fea48e92a80fe5a59a4eda790a407b..844b7aad72fde3732763bfeafd67588e4e9e64c7 100644 (file)
@@ -4,5 +4,6 @@ version = "0.1.0"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 
 [dependencies]
-toml = "0.1"
-rustc-serialize = "0.3"
+toml = "0.4"
+serde = "1.0"
+serde_derive = "1.0"
index ba37863b1f62d6af309bfac54385d15b6d9a31a3..b8efb88acfbdce3de9fc1ac64269ca5c56dcc87c 100644 (file)
@@ -9,7 +9,9 @@
 // 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>,
@@ -136,7 +140,7 @@ fn unavailable() -> Target {
     }
 }
 
-#[derive(RustcEncodable)]
+#[derive(Serialize)]
 struct Component {
     pkg: String,
     target: String,
@@ -199,28 +203,16 @@ fn build(&mut self) {
         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");
         }
     }