@@ -56,13 +56,12 @@ export function initializeModuleMeta() {
5656 }
5757 } )
5858 sp . stderr . on ( 'data' , ( data ) => {
59- if ( isTracingOn ) {
60- trace ( '***swift package describe stderr*** ' , '' + data )
61- }
59+ trace ( '***swift package describe stderr*** ' , '' + data )
60+ const globalSources = allModuleSources . get ( null )
61+ gatherAllSwiftFilesInPath ( workspaceRoot )
62+ . forEach ( globalSources . add . bind ( globalSources ) ) ;
6263 } )
63- // sp.on('exit', function (code, signal) {
64- // trace('***swift package describe***', `code: ${code}, signal: ${signal}`)
65- // })
64+
6665 sp . on ( 'error' , function ( err ) {
6766 trace ( '***swift package describe error*** ' , ( < Error > err ) . message )
6867 if ( ( < Error > err ) . message . indexOf ( "ENOENT" ) > 0 ) {
@@ -75,6 +74,23 @@ export function initializeModuleMeta() {
7574 } ) ;
7675}
7776
77+ function gatherAllSwiftFilesInPath ( root : string ) : string [ ] {
78+ const result = new Array < string > ( ) ;
79+ try {
80+ const dir = fs . readdirSync ( root ) . filter ( sub => ! sub . startsWith ( '.' ) && sub !== 'Carthage' ) ;
81+ for ( const sub of dir ) {
82+ if ( path . extname ( sub ) === '.swift' ) {
83+ result . push ( path . join ( root , sub ) ) ;
84+ } else {
85+ result . push ( ...gatherAllSwiftFilesInPath ( path . join ( root , sub ) ) ) ;
86+ }
87+ }
88+ return result ;
89+ } catch ( error ) {
90+ return result ;
91+ }
92+ }
93+
7894export function getAllSourcePaths ( srcPath : string ) : string [ ] {
7995 const sp = path . dirname ( srcPath )
8096 for ( let [ m , p ] of allModulePaths ) {
0 commit comments