diff --git a/src/Paket.Core/PackageMetaData.fs b/src/Paket.Core/PackageMetaData.fs index ef9b78ca8c..025ec477c4 100644 --- a/src/Paket.Core/PackageMetaData.fs +++ b/src/Paket.Core/PackageMetaData.fs @@ -243,32 +243,26 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp yield! getPackages project] - //System.Diagnostics.Debugger.Launch() |> ignore + // filter out any references that are transient + let distinctRefs = allReferences |> List.distinct + let refs = + distinctRefs + |> List.filter (fun (group, settings: Paket.PackageInstallSettings) -> + let isDependencyOfAnyOtherDependency packageName = + distinctRefs + |> List.exists (fun (group, settings2) -> + settings2.Name <> packageName && + match group with + | Some groupName -> + match lockFile.GetAllDependenciesOfSafe(groupName, settings2.Name) with + | Some packages -> packages.Contains packageName + | _ -> false + | None -> false) - // filter out any references that are transient to the - let distinctRefs = allReferences - |> Seq.distinct - let refs = distinctRefs - |> Seq.filter (fun (group, settings: Paket.PackageInstallSettings) -> - let isDependencyOfAnyOtherDependency(packageName) = - distinctRefs - |> Seq.exists (fun (group, settings2) -> - let result = (settings2.Name <> packageName) && - match group with - | Some groupName -> - let pdeps = lockFile.GetAllDependenciesOfSafe(groupName, settings2.Name) - let result2 = pdeps.IsSome && pdeps.Value.Contains(packageName) - result2 - | None -> false - result) - - match group with - | None -> true - | Some groupName -> - isDependencyOfAnyOtherDependency(settings.Name) |> not - ) - |> Seq.sortByDescending (fun (group, settings) -> settings.Name) - |> Seq.toList + match group with + | None -> true + | Some groupName -> isDependencyOfAnyOtherDependency settings.Name |> not) + |> List.sortByDescending (fun (group, settings) -> settings.Name) match refs with | [] -> withDepsAndIncluded