]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/build-manifest/src/main.rs
Add a profiles section to the manifest
[rust.git] / src / tools / build-manifest / src / main.rs
index aba0472ae366e4853cdfd6ce9fe45cb3e5d9ba9d..b00daa716777fd3a298c0f223995c5c3a5fee040 100644 (file)
@@ -1,13 +1,3 @@
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 extern crate toml;
 #[macro_use]
 extern crate serde_derive;
@@ -141,7 +131,8 @@ struct Manifest {
     manifest_version: String,
     date: String,
     pkg: BTreeMap<String, Package>,
-    renames: BTreeMap<String, Rename>
+    renames: BTreeMap<String, Rename>,
+    profiles: BTreeMap<String, Vec<String>>,
 }
 
 #[derive(Serialize)]
@@ -202,6 +193,7 @@ struct Builder {
     rustfmt_release: String,
     llvm_tools_release: String,
     lldb_release: String,
+    miri_release: String,
 
     input: PathBuf,
     output: PathBuf,
@@ -217,6 +209,7 @@ struct Builder {
     rustfmt_version: Option<String>,
     llvm_tools_version: Option<String>,
     lldb_version: Option<String>,
+    miri_version: Option<String>,
 
     rust_git_commit_hash: Option<String>,
     cargo_git_commit_hash: Option<String>,
@@ -225,6 +218,7 @@ struct Builder {
     rustfmt_git_commit_hash: Option<String>,
     llvm_tools_git_commit_hash: Option<String>,
     lldb_git_commit_hash: Option<String>,
+    miri_git_commit_hash: Option<String>,
 
     should_sign: bool,
 }
@@ -247,13 +241,14 @@ fn main() {
     let output = PathBuf::from(args.next().unwrap());
     let date = args.next().unwrap();
     let rust_release = args.next().unwrap();
+    let s3_address = args.next().unwrap();
     let cargo_release = args.next().unwrap();
     let rls_release = args.next().unwrap();
     let clippy_release = args.next().unwrap();
+    let miri_release = args.next().unwrap();
     let rustfmt_release = args.next().unwrap();
     let llvm_tools_release = args.next().unwrap();
     let lldb_release = args.next().unwrap();
-    let s3_address = args.next().unwrap();
 
     // Do not ask for a passphrase while manually testing
     let mut passphrase = String::new();
@@ -269,6 +264,7 @@ fn main() {
         rustfmt_release,
         llvm_tools_release,
         lldb_release,
+        miri_release,
 
         input,
         output,
@@ -284,6 +280,7 @@ fn main() {
         rustfmt_version: None,
         llvm_tools_version: None,
         lldb_version: None,
+        miri_version: None,
 
         rust_git_commit_hash: None,
         cargo_git_commit_hash: None,
@@ -292,6 +289,7 @@ fn main() {
         rustfmt_git_commit_hash: None,
         llvm_tools_git_commit_hash: None,
         lldb_git_commit_hash: None,
+        miri_git_commit_hash: None,
 
         should_sign,
     }.build();
@@ -307,6 +305,7 @@ fn build(&mut self) {
         self.llvm_tools_version = self.version("llvm-tools", "x86_64-unknown-linux-gnu");
         // lldb is only built for macOS.
         self.lldb_version = self.version("lldb", "x86_64-apple-darwin");
+        self.miri_version = self.version("miri", "x86_64-unknown-linux-gnu");
 
         self.rust_git_commit_hash = self.git_commit_hash("rust", "x86_64-unknown-linux-gnu");
         self.cargo_git_commit_hash = self.git_commit_hash("cargo", "x86_64-unknown-linux-gnu");
@@ -316,6 +315,7 @@ fn build(&mut self) {
         self.llvm_tools_git_commit_hash = self.git_commit_hash("llvm-tools",
                                                                "x86_64-unknown-linux-gnu");
         self.lldb_git_commit_hash = self.git_commit_hash("lldb", "x86_64-unknown-linux-gnu");
+        self.miri_git_commit_hash = self.git_commit_hash("miri", "x86_64-unknown-linux-gnu");
 
         self.digest_and_sign();
         let manifest = self.build_manifest();
@@ -341,6 +341,7 @@ fn build_manifest(&mut self) -> Manifest {
             date: self.date.to_string(),
             pkg: BTreeMap::new(),
             renames: BTreeMap::new(),
+            profiles: BTreeMap::new(),
         };
 
         self.package("rustc", &mut manifest.pkg, HOSTS);
@@ -356,6 +357,20 @@ fn build_manifest(&mut self) -> Manifest {
         self.package("llvm-tools-preview", &mut manifest.pkg, TARGETS);
         self.package("lldb-preview", &mut manifest.pkg, TARGETS);
 
+        self.profile("minimal",
+                     &mut manifest.profiles,
+                     &["rustc", "cargo", "rust-std", "rust-mingw"]);
+        self.profile("default",
+                     &mut manifest.profiles,
+                     &["rustc", "cargo", "rust-std", "rust-mingw",
+                       "rust-docs", "rustfmt-preview", "clippy-preview"]);
+        self.profile("complete",
+                     &mut manifest.profiles,
+                     &["rustc", "cargo", "rust-std", "rust-mingw",
+                       "rust-docs", "rustfmt-preview", "clippy-preview",
+                       "rls-preview", "rust-src", "llvm-tools-preview",
+                       "lldb-preview", "rust-analysis"]);
+
         manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() });
         manifest.renames.insert("rustfmt".to_owned(), Rename { to: "rustfmt-preview".to_owned() });
         manifest.renames.insert("clippy".to_owned(), Rename { to: "clippy-preview".to_owned() });
@@ -454,6 +469,13 @@ fn build_manifest(&mut self) -> Manifest {
         return manifest;
     }
 
+    fn profile(&mut self,
+               profile_name: &str,
+               dst: &mut BTreeMap<String, Vec<String>>,
+               pkgs: &[&str]) {
+        dst.insert(profile_name.to_owned(), pkgs.iter().map(|s| (*s).to_owned()).collect());
+    }
+
     fn package(&mut self,
                pkgname: &str,
                dst: &mut BTreeMap<String, Package>,
@@ -526,6 +548,8 @@ fn filename(&self, component: &str, target: &str) -> String {
             format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target)
         } else if component == "lldb" || component == "lldb-preview" {
             format!("lldb-{}-{}.tar.gz", self.lldb_release, target)
+        } else if component == "miri" || component == "miri-preview" {
+            format!("miri-{}-{}.tar.gz", self.miri_release, target)
         } else {
             format!("{}-{}-{}.tar.gz", component, self.rust_release, target)
         }
@@ -544,6 +568,8 @@ fn cached_version(&self, component: &str) -> &Option<String> {
             &self.llvm_tools_version
         } else if component == "lldb" || component == "lldb-preview" {
             &self.lldb_version
+        } else if component == "miri" || component == "miri-preview" {
+            &self.miri_version
         } else {
             &self.rust_version
         }
@@ -562,6 +588,8 @@ fn cached_git_commit_hash(&self, component: &str) -> &Option<String> {
             &self.llvm_tools_git_commit_hash
         } else if component == "lldb" || component == "lldb-preview" {
             &self.lldb_git_commit_hash
+        } else if component == "miri" || component == "miri-preview" {
+            &self.miri_git_commit_hash
         } else {
             &self.rust_git_commit_hash
         }