44
55using System ;
66using System . Collections . Generic ;
7- using System . Linq ;
87using System . Threading ;
98using System . Threading . Tasks ;
10- using Cake . Core . Configuration ;
119using Cake . Core . Diagnostics ;
1210using Cake . Core . IO ;
13- using Cake . NuGet . Install . Extensions ;
1411using NuGet . Frameworks ;
1512using NuGet . Packaging ;
1613using NuGet . Packaging . Core ;
@@ -26,7 +23,6 @@ internal sealed class NugetFolderProject : FolderNuGetProject
2623 private readonly ISet < PackageIdentity > _installedPackages ;
2724 private readonly IFileSystem _fileSystem ;
2825 private readonly INuGetContentResolver _contentResolver ;
29- private readonly ICakeConfiguration _config ;
3026 private readonly ICakeLog _log ;
3127 private readonly PackagePathResolver _pathResolver ;
3228
@@ -41,18 +37,17 @@ internal sealed class NugetFolderProject : FolderNuGetProject
4137 public NugetFolderProject (
4238 IFileSystem fileSystem ,
4339 INuGetContentResolver contentResolver ,
44- ICakeConfiguration config ,
4540 ICakeLog log ,
4641 PackagePathResolver pathResolver ,
4742 string root ,
4843 NuGetFramework targetFramework ) : base ( root , pathResolver )
4944 {
5045 _fileSystem = fileSystem ?? throw new ArgumentNullException ( nameof ( fileSystem ) ) ;
5146 _contentResolver = contentResolver ?? throw new ArgumentNullException ( nameof ( contentResolver ) ) ;
52- _config = config ?? throw new ArgumentNullException ( nameof ( config ) ) ;
5347 _log = log ?? throw new ArgumentNullException ( nameof ( log ) ) ;
5448 _pathResolver = pathResolver ?? throw new ArgumentNullException ( nameof ( pathResolver ) ) ;
5549 _installedPackages = new HashSet < PackageIdentity > ( ) ;
50+
5651 TargetFramework = targetFramework ?? throw new ArgumentNullException ( nameof ( targetFramework ) ) ;
5752 InternalMetadata [ NuGetProjectMetadataKeys . TargetFramework ] = TargetFramework ;
5853 }
@@ -67,6 +62,7 @@ public override Task<bool> InstallPackageAsync(PackageIdentity packageIdentity,
6762 _log . Debug ( "Package {0} has already been installed." , packageIdentity . ToString ( ) ) ;
6863 return Task . FromResult ( true ) ;
6964 }
65+
7066 return base . InstallPackageAsync ( packageIdentity , downloadResourceResult , nuGetProjectContext , token ) ;
7167 }
7268
@@ -78,22 +74,20 @@ public IReadOnlyCollection<IFile> GetFiles(DirectoryPath directoryPath, PackageR
7874 {
7975 if ( _blackListedPackages . Contains ( installedPackage . Id ) )
8076 {
81- _log . Warning ( "Package {0} depends on package {1}. Will not load this dependency..." ,
82- packageReference . Package , installedPackage . ToString ( ) ) ;
77+ const string format = "Package {0} depends on package {1}. This dependency won't be loaded." ;
78+ _log . Debug ( format , packageReference . Package , installedPackage . ToString ( ) ) ;
8379 continue ;
8480 }
8581
8682 var installPath = new DirectoryPath ( _pathResolver . GetInstallPath ( installedPackage ) ) ;
87-
8883 if ( ! _fileSystem . Exist ( installPath ) )
8984 {
9085 _log . Warning ( "Package {0} is not installed." , installedPackage . Id ) ;
9186 continue ;
9287 }
9388
94- // If the installed package is not the target package,
95- // create a new PackageReference which is passed to the content resolver.
96- // This makes logging make more sense.
89+ // If the installed package is not the target package, create a new PackageReference
90+ // which is passed to the content resolver. This makes logging make more sense.
9791 var installedPackageReference = installedPackage . Id . Equals ( packageReference . Package , StringComparison . OrdinalIgnoreCase ) ?
9892 packageReference :
9993 new PackageReference ( $ "nuget:?package={ installedPackage . Id } ") ;
0 commit comments