private DependencyBehavior GetDependencyBehavior(PackageType type, PackageReference package) { if (type == PackageType.Addin) { return(package.ShouldLoadDependencies(_config) ? DependencyBehavior.Lowest : DependencyBehavior.Ignore); } return(DependencyBehavior.Ignore); }
public IReadOnlyCollection <IFile> GetFiles(DirectoryPath directoryPath, PackageReference packageReference, PackageType type) { var loadDependencies = packageReference.ShouldLoadDependencies(_config); var files = new List <IFile>(); var package = _installedPackages.First(p => p.Id.Equals(packageReference.Package, StringComparison.OrdinalIgnoreCase)); var installPath = new DirectoryPath(_pathResolver.GetInstallPath(package)); if (!_fileSystem.Exist(installPath)) { _log.Warning("Package {0} is not installed.", packageReference.Package); return(Array.Empty <IFile>()); } files.AddRange(_contentResolver.GetFiles(installPath, packageReference, type)); if (loadDependencies) { foreach (var dependency in _installedPackages .Where(p => !p.Id.Equals(packageReference.Package, StringComparison.OrdinalIgnoreCase))) { if (_blackListedPackages.Contains(dependency.Id)) { _log.Warning("Package {0} depends on package {1}. Will not load this dependency...", packageReference.Package, dependency.ToString()); continue; } var dependencyInstallPath = new DirectoryPath(_pathResolver.GetInstallPath(dependency)); if (!_fileSystem.Exist(dependencyInstallPath)) { _log.Warning("Package {0} is not installed.", dependency.Id); continue; } files.AddRange(_contentResolver.GetFiles(dependencyInstallPath, packageReference, type)); } } return(files); }