Sort native library paths for deterministic builds
authorKornel <kornel@geekhood.net>
Wed, 15 Nov 2017 18:16:34 +0000 (18:16 +0000)
committerKornel <kornel@geekhood.net>
Wed, 15 Nov 2017 18:16:34 +0000 (18:16 +0000)
#3800

src/cargo/ops/cargo_rustc/compilation.rs

index b3643b6bf29347bf0787c602a9ea3b32bce12971..1c79ade6aa8d15c1432868f7ee392356c08498be 100644 (file)
@@ -1,4 +1,4 @@
-use std::collections::{HashMap, HashSet};
+use std::collections::{HashMap, HashSet, BTreeSet};
 use std::ffi::OsStr;
 use std::path::PathBuf;
 use semver::Version;
@@ -22,8 +22,10 @@ pub struct Compilation<'cfg> {
     ///
     /// This is currently used to drive some entries which are added to the
     /// LD_LIBRARY_PATH as appropriate.
+    ///
+    /// The order should be deterministic.
     // TODO: deprecated, remove
-    pub native_dirs: HashSet<PathBuf>,
+    pub native_dirs: BTreeSet<PathBuf>,
 
     /// Root output directory (for the local package's artifacts)
     pub root_output: PathBuf,
@@ -61,7 +63,7 @@ impl<'cfg> Compilation<'cfg> {
     pub fn new(config: &'cfg Config) -> Compilation<'cfg> {
         Compilation {
             libraries: HashMap::new(),
-            native_dirs: HashSet::new(),  // TODO: deprecated, remove
+            native_dirs: BTreeSet::new(),  // TODO: deprecated, remove
             root_output: PathBuf::from("/"),
             deps_output: PathBuf::from("/"),
             host_deps_output: PathBuf::from("/"),