File tree Expand file tree Collapse file tree 1 file changed +26
-16
lines changed Expand file tree Collapse file tree 1 file changed +26
-16
lines changed Original file line number Diff line number Diff line change @@ -810,23 +810,33 @@ private IEnumerable<string> GetFeeds(Func<IList<string>> getNugetFeeds)
810
810
}
811
811
812
812
// todo: this could be improved.
813
- // We don't have to get the feeds from each of the folders from below, it would be enought to check the folders that recursively contain the others.
814
- var allFeeds = nugetConfigs
815
- . Select ( config =>
816
- {
817
- try
818
- {
819
- return new FileInfo ( config ) . Directory ? . FullName ;
820
- }
821
- catch ( Exception exc )
813
+ HashSet < string > ? allFeeds = null ;
814
+
815
+ if ( nugetConfigs . Count > 0 )
816
+ {
817
+ // We don't have to get the feeds from each of the folders from below, it would be enought to check the folders that recursively contain the others.
818
+ allFeeds = nugetConfigs
819
+ . Select ( config =>
822
820
{
823
- logger . LogWarning ( $ "Failed to get directory of '{ config } ': { exc } ") ;
824
- }
825
- return null ;
826
- } )
827
- . Where ( folder => folder != null )
828
- . SelectMany ( folder => GetFeeds ( ( ) => dotnet . GetNugetFeedsFromFolder ( folder ! ) ) )
829
- . ToHashSet ( ) ;
821
+ try
822
+ {
823
+ return new FileInfo ( config ) . Directory ? . FullName ;
824
+ }
825
+ catch ( Exception exc )
826
+ {
827
+ logger . LogWarning ( $ "Failed to get directory of '{ config } ': { exc } ") ;
828
+ }
829
+ return null ;
830
+ } )
831
+ . Where ( folder => folder != null )
832
+ . SelectMany ( folder => GetFeeds ( ( ) => dotnet . GetNugetFeedsFromFolder ( folder ! ) ) )
833
+ . ToHashSet ( ) ;
834
+ }
835
+ else
836
+ {
837
+ // If we haven't found any `nuget.config` files, then obtain a list of feeds from the root source directory.
838
+ allFeeds = GetFeeds ( ( ) => dotnet . GetNugetFeedsFromFolder ( this . fileProvider . SourceDir . FullName ) ) . ToHashSet ( ) ;
839
+ }
830
840
831
841
logger . LogInfo ( $ "Found { allFeeds . Count } Nuget feeds (with inherited ones) in nuget.config files: { string . Join ( ", " , allFeeds . OrderBy ( f => f ) ) } ") ;
832
842
You can’t perform that action at this time.
0 commit comments