Bug 1455623 part 2 - Not copy generated binding files into dist. r?emilio draft
authorXidorn Quan <me@upsuper.org>
Sat, 21 Apr 2018 00:38:08 +1000
changeset 785633 edb15350c42ea8279850418a7c9e996a3c05d2d6
parent 785629 ec3bfb3ed306aa19e68857623ea7b71f64f63091
child 785634 02fb4fc2631f33ea64df299d3ca2d475d1679c8b
push id107285
push userxquan@mozilla.com
push dateFri, 20 Apr 2018 14:45:30 +0000
reviewersemilio
bugs1455623
milestone61.0a1
Bug 1455623 part 2 - Not copy generated binding files into dist. r?emilio MozReview-Commit-ID: GBnkmwjDS8Y
servo/components/style/build_gecko.rs
--- a/servo/components/style/build_gecko.rs
+++ b/servo/components/style/build_gecko.rs
@@ -1,38 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 mod common {
-    use std::{env, fs, io};
-    use std::path::{Path, PathBuf};
+    use std::env;
+    use std::path::PathBuf;
 
     lazy_static! {
         pub static ref OUTDIR_PATH: PathBuf =
             PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("gecko");
     }
-
-    /// Copy contents of one directory into another.
-    /// It currently only does a shallow copy.
-    pub fn copy_dir<P, Q, F>(from: P, to: Q, callback: F) -> io::Result<()>
-    where
-        P: AsRef<Path>,
-        Q: AsRef<Path>,
-        F: Fn(&Path),
-    {
-        let to = to.as_ref();
-        for entry in from.as_ref().read_dir()? {
-            let entry = entry?;
-            let path = entry.path();
-            callback(&path);
-            fs::copy(&path, to.join(entry.file_name()))?;
-        }
-        Ok(())
-    }
 }
 
 #[cfg(feature = "bindgen")]
 mod bindings {
     use bindgen::{Builder, CodegenConfig};
     use regex::Regex;
     use std::cmp;
     use std::collections::{HashMap, HashSet};
@@ -608,24 +590,16 @@ mod bindings {
                 }
             }
         }
         run_tasks! {
             generate_structs(),
             generate_bindings(),
             generate_atoms(),
         }
-
-        // Copy all generated files to dist for the binding package
-        let path = DISTDIR_PATH.join("rust_bindings/style");
-        if path.exists() {
-            fs::remove_dir_all(&path).expect("Fail to remove binding dir in dist");
-        }
-        fs::create_dir_all(&path).expect("Fail to create bindings dir in dist");
-        copy_dir(&*OUTDIR_PATH, &path, |_| {}).expect("Fail to copy generated files to dist dir");
     }
 }
 
 #[cfg(not(feature = "bindgen"))]
 mod bindings {
     use std::env;
     use std::path::PathBuf;
     use super::common::*;