@@ -20,8 +20,6 @@ use std::path::{Path, PathBuf};
2020use std:: process:: Command ;
2121use std:: time:: Instant ;
2222
23- use filetime:: FileTime ;
24-
2523/// Returns the `name` as the filename of a static library for `target`.
2624pub fn staticlib ( name : & str , target : & str ) -> String {
2725 if target. contains ( "windows" ) {
@@ -31,13 +29,6 @@ pub fn staticlib(name: &str, target: &str) -> String {
3129 }
3230}
3331
34- /// Returns the last-modified time for `path`, or zero if it doesn't exist.
35- pub fn mtime ( path : & Path ) -> FileTime {
36- fs:: metadata ( path) . map ( |f| {
37- FileTime :: from_last_modification_time ( & f)
38- } ) . unwrap_or ( FileTime :: zero ( ) )
39- }
40-
4132/// Copies a file from `src` to `dst`, attempting to use hard links and then
4233/// falling back to an actually filesystem copy if necessary.
4334pub fn copy ( src : & Path , dst : & Path ) {
@@ -132,34 +123,6 @@ pub fn add_lib_path(path: Vec<PathBuf>, cmd: &mut Command) {
132123 cmd. env ( dylib_path_var ( ) , t ! ( env:: join_paths( list) ) ) ;
133124}
134125
135- /// Returns whether `dst` is up to date given that the file or files in `src`
136- /// are used to generate it.
137- ///
138- /// Uses last-modified time checks to verify this.
139- pub fn up_to_date ( src : & Path , dst : & Path ) -> bool {
140- let threshold = mtime ( dst) ;
141- let meta = match fs:: metadata ( src) {
142- Ok ( meta) => meta,
143- Err ( e) => panic ! ( "source {:?} failed to get metadata: {}" , src, e) ,
144- } ;
145- if meta. is_dir ( ) {
146- dir_up_to_date ( src, & threshold)
147- } else {
148- FileTime :: from_last_modification_time ( & meta) <= threshold
149- }
150- }
151-
152- fn dir_up_to_date ( src : & Path , threshold : & FileTime ) -> bool {
153- t ! ( fs:: read_dir( src) ) . map ( |e| t ! ( e) ) . all ( |e| {
154- let meta = t ! ( e. metadata( ) ) ;
155- if meta. is_dir ( ) {
156- dir_up_to_date ( & e. path ( ) , threshold)
157- } else {
158- FileTime :: from_last_modification_time ( & meta) < * threshold
159- }
160- } )
161- }
162-
163126/// Returns the environment variable which the dynamic library lookup path
164127/// resides in for this platform.
165128pub fn dylib_path_var ( ) -> & ' static str {
0 commit comments