@@ -4,13 +4,11 @@ use std::collections::BTreeSet;
4
4
use std:: env;
5
5
use std:: ffi:: { OsStr , OsString } ;
6
6
use std:: fmt:: { Debug , Write } ;
7
- use std:: fs:: { self , File } ;
7
+ use std:: fs;
8
8
use std:: hash:: Hash ;
9
- use std:: io:: { BufRead , BufReader } ;
10
9
use std:: ops:: Deref ;
11
10
use std:: path:: { Path , PathBuf } ;
12
11
use std:: process:: Command ;
13
- use std:: sync:: OnceLock ;
14
12
use std:: time:: { Duration , Instant } ;
15
13
16
14
use crate :: core:: build_steps:: tool:: { self , SourceType } ;
@@ -577,7 +575,7 @@ impl<'a> ShouldRun<'a> {
577
575
///
578
576
/// [`path`]: ShouldRun::path
579
577
pub fn paths ( mut self , paths : & [ & str ] ) -> Self {
580
- let submodules_paths = self . builder . get_all_submodules ( ) ;
578
+ let submodules_paths = build_helper :: util :: parse_gitmodules ( & self . builder . src ) ;
581
579
582
580
self . paths . insert ( PathSet :: Set (
583
581
paths
@@ -2238,28 +2236,6 @@ impl<'a> Builder<'a> {
2238
2236
out
2239
2237
}
2240
2238
2241
- /// Return paths of all submodules.
2242
- pub fn get_all_submodules ( & self ) -> & [ String ] {
2243
- static SUBMODULES_PATHS : OnceLock < Vec < String > > = OnceLock :: new ( ) ;
2244
-
2245
- let init_submodules_paths = |src : & PathBuf | {
2246
- let file = File :: open ( src. join ( ".gitmodules" ) ) . unwrap ( ) ;
2247
-
2248
- let mut submodules_paths = vec ! [ ] ;
2249
- for line in BufReader :: new ( file) . lines ( ) . map_while ( Result :: ok) {
2250
- let line = line. trim ( ) ;
2251
- if line. starts_with ( "path" ) {
2252
- let actual_path = line. split ( ' ' ) . last ( ) . expect ( "Couldn't get value of path" ) ;
2253
- submodules_paths. push ( actual_path. to_owned ( ) ) ;
2254
- }
2255
- }
2256
-
2257
- submodules_paths
2258
- } ;
2259
-
2260
- SUBMODULES_PATHS . get_or_init ( || init_submodules_paths ( & self . src ) )
2261
- }
2262
-
2263
2239
/// Ensure that a given step is built *only if it's supposed to be built by default*, returning
2264
2240
/// its output. This will cache the step, so it's safe (and good!) to call this as often as
2265
2241
/// needed to ensure that all dependencies are build.
0 commit comments