From e53eaa385ea3eb53d15711f9ce5914f0485a0ddf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 7 Feb 2017 15:47:03 -0800 Subject: [PATCH] Rename manifest_version to manifest-version The current manifests encode this with a dash in the name, so we should preserve that! --- src/tools/build-manifest/src/main.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 8c15a6630a33c..548a11439f5cc 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -11,7 +11,7 @@ extern crate toml; extern crate rustc_serialize; -use std::collections::HashMap; +use std::collections::{BTreeMap, HashMap}; use std::env; use std::fs::File; use std::io::{self, Read, Write}; @@ -95,7 +95,6 @@ static MINGW: &'static [&'static str] = &[ "x86_64-pc-windows-gnu", ]; -#[derive(RustcEncodable)] struct Manifest { manifest_version: String, date: String, @@ -171,8 +170,18 @@ impl Builder { self.cargo_version = self.version("cargo", "x86_64-unknown-linux-gnu"); self.digest_and_sign(); - let manifest = self.build_manifest(); - let manifest = toml::encode(&manifest).to_string(); + 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::encode(&manifest_version)); + manifest.insert("date".to_string(), toml::encode(&date)); + manifest.insert("pkg".to_string(), toml::encode(&pkg)); + let manifest = toml::Value::Table(manifest).to_string(); let filename = format!("channel-rust-{}.toml", self.channel); self.write_manifest(&manifest, &filename);