@@ -281,6 +281,19 @@ pub fn not_contains<P: AsRef<Path>>(path: P, expected: &str) -> bool {
281281 !path. as_ref ( ) . file_name ( ) . is_some_and ( |name| name. to_str ( ) . unwrap ( ) . contains ( expected) )
282282}
283283
284+ /// Returns true if the filename at `path` is not in `expected`.
285+ pub fn filename_not_in_denylist < P : AsRef < Path > , V : AsRef < [ String ] > > ( path : P , expected : V ) -> bool {
286+ let expected = expected. as_ref ( ) ;
287+ path. as_ref ( )
288+ . file_name ( )
289+ . is_some_and ( |name| !expected. contains ( & name. to_str ( ) . unwrap ( ) . to_owned ( ) ) )
290+ }
291+
292+ /// Returns true if the filename at `path` ends with `suffix`.
293+ pub fn has_suffix < P : AsRef < Path > > ( path : P , suffix : & str ) -> bool {
294+ path. as_ref ( ) . file_name ( ) . is_some_and ( |name| name. to_str ( ) . unwrap ( ) . ends_with ( suffix) )
295+ }
296+
284297/// Builds a static lib (`.lib` on Windows MSVC and `.a` for the rest) with the given name.
285298#[ track_caller]
286299pub fn build_native_static_lib ( lib_name : & str ) -> PathBuf {
@@ -301,19 +314,6 @@ pub fn build_native_static_lib(lib_name: &str) -> PathBuf {
301314 path ( lib_path)
302315}
303316
304- /// Returns true if the filename at `path` is not in `expected`.
305- pub fn filename_not_in_denylist < P : AsRef < Path > , V : AsRef < [ String ] > > ( path : P , expected : V ) -> bool {
306- let expected = expected. as_ref ( ) ;
307- path. as_ref ( )
308- . file_name ( )
309- . is_some_and ( |name| !expected. contains ( & name. to_str ( ) . unwrap ( ) . to_owned ( ) ) )
310- }
311-
312- /// Returns true if the filename at `path` ends with `suffix`.
313- pub fn has_suffix < P : AsRef < Path > > ( path : P , suffix : & str ) -> bool {
314- path. as_ref ( ) . file_name ( ) . is_some_and ( |name| name. to_str ( ) . unwrap ( ) . ends_with ( suffix) )
315- }
316-
317317/// Gathers all files in the current working directory that have the extension `ext`, and counts
318318/// the number of lines within that contain a match with the regex pattern `re`.
319319pub fn count_regex_matches_in_files_with_extension ( re : & regex:: Regex , ext : & str ) -> usize {
@@ -328,26 +328,6 @@ pub fn count_regex_matches_in_files_with_extension(re: ®ex::Regex, ext: &str)
328328 count
329329}
330330
331- /// Builds a static lib (`.lib` on Windows MSVC and `.a` for the rest) with the given name.
332- #[ track_caller]
333- pub fn build_native_static_lib ( lib_name : & str ) -> PathBuf {
334- let obj_file = if is_msvc ( ) { format ! ( "{lib_name}" ) } else { format ! ( "{lib_name}.o" ) } ;
335- let src = format ! ( "{lib_name}.c" ) ;
336- let lib_path = static_lib_name ( lib_name) ;
337- if is_msvc ( ) {
338- cc ( ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
339- } else {
340- cc ( ) . arg ( "-v" ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
341- } ;
342- let mut obj_file = PathBuf :: from ( format ! ( "{lib_name}.o" ) ) ;
343- if is_msvc ( ) {
344- obj_file. set_extension ( "" ) ;
345- obj_file. set_extension ( "obj" ) ;
346- }
347- llvm_ar ( ) . obj_to_ar ( ) . output_input ( & lib_path, & obj_file) . run ( ) ;
348- path ( lib_path)
349- }
350-
351331/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
352332/// available on the platform!
353333#[ track_caller]
0 commit comments