diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets index ebcce7ffa6..e48e078d65 100644 --- a/.paket/Paket.Restore.targets +++ b/.paket/Paket.Restore.targets @@ -45,7 +45,7 @@ false - + $(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references @@ -57,11 +57,11 @@ - + - + let result = ExecProcess (fun info -> info.FileName <- currentDirectory "packages" "build" "ILRepack" "tools" "ILRepack.exe" - info.Arguments <- sprintf "/verbose /lib:%s /ver:%s /out:%s %s" buildDir release.AssemblyVersion (buildMergedDir @@ "paket.exe") toPack + info.Arguments <- sprintf "/lib:%s /ver:%s /out:%s %s" buildDir release.AssemblyVersion (buildMergedDir @@ "paket.exe") toPack ) (TimeSpan.FromMinutes 5.) if result <> 0 then failwithf "Error during ILRepack execution." @@ -599,8 +599,8 @@ Target "All" DoNothing ==> "MergePaketTool" =?> ("MergePowerShell", not isMono) ==> "SignAssemblies" - ==> "NuGet" - =?> ("MergeDotnetCoreIntoNuget", not <| hasBuildParam "DISABLE_NETCORE") + =?> ("NuGet", not <| hasBuildParam "SkipNuGet") + =?> ("MergeDotnetCoreIntoNuget", not <| hasBuildParam "DISABLE_NETCORE" && not <| hasBuildParam "SkipNuGet") ==> "BuildPackage" "CleanDocs" diff --git a/integrationtests/Paket.IntegrationTests/FrameworkRestrictionsSpecs.fs b/integrationtests/Paket.IntegrationTests/FrameworkRestrictionsSpecs.fs index 2b37c33b75..d0b34b169d 100644 --- a/integrationtests/Paket.IntegrationTests/FrameworkRestrictionsSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/FrameworkRestrictionsSpecs.fs @@ -24,6 +24,7 @@ let ``#1182 framework restrictions overwrite each other``() = lockFile.Contains("framework: winv4.5") |> shouldEqual false [] +[] // PATH TOO LONG on Windows... let ``#1190 paket add nuget should handle transitive dependencies``() = paket "add nuget xunit version 2.1.0" "i001190-transitive-dependencies-with-restr" |> ignore diff --git a/integrationtests/Paket.IntegrationTests/OutdatedSpecs.fs b/integrationtests/Paket.IntegrationTests/OutdatedSpecs.fs index 04f621512f..13e77e4716 100644 --- a/integrationtests/Paket.IntegrationTests/OutdatedSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/OutdatedSpecs.fs @@ -15,12 +15,14 @@ let ``#183 outdated without params``() = msg |> shouldContainText "FSharp.Formatting 2.4 ->" [] +[] // PATH TOO LONG on Windows... let ``#183 outdated --ignore-constraint``() = let msg = paket "outdated --ignore-constraints" "i000183-outdated-with-special-parameters" msg.Contains("Newtonsoft.Json 6.0.7 -> 6.0.8") |> shouldEqual false [] +[] // PATH TOO LONG on Windows... let ``#183 outdated --include-prereleases``() = let msg = paket "outdated --include-prereleases" "i000183-outdated-with-special-parameters" msg |> shouldContainText "Newtonsoft.Json 6.0.7 ->" diff --git a/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs b/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs index bf8da449ed..1b6b1877ba 100644 --- a/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs +++ b/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs @@ -4,16 +4,16 @@ [assembly: AssemblyTitleAttribute("Paket.Bootstrapper")] [assembly: AssemblyProductAttribute("Paket")] [assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")] -[assembly: AssemblyVersionAttribute("4.4.0")] -[assembly: AssemblyFileVersionAttribute("4.4.0")] -[assembly: AssemblyInformationalVersionAttribute("4.4.0")] +[assembly: AssemblyVersionAttribute("4.4.1")] +[assembly: AssemblyFileVersionAttribute("4.4.1")] +[assembly: AssemblyInformationalVersionAttribute("4.4.1")] namespace System { internal static class AssemblyVersionInformation { internal const System.String AssemblyTitle = "Paket.Bootstrapper"; internal const System.String AssemblyProduct = "Paket"; internal const System.String AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories."; - internal const System.String AssemblyVersion = "4.4.0"; - internal const System.String AssemblyFileVersion = "4.4.0"; - internal const System.String AssemblyInformationalVersion = "4.4.0"; + internal const System.String AssemblyVersion = "4.4.1"; + internal const System.String AssemblyFileVersion = "4.4.1"; + internal const System.String AssemblyInformationalVersion = "4.4.1"; } } diff --git a/src/Paket.Core.preview3/Paket.Core.fsproj b/src/Paket.Core.preview3/Paket.Core.fsproj index 2eedbcb96a..3d51959edf 100644 --- a/src/Paket.Core.preview3/Paket.Core.fsproj +++ b/src/Paket.Core.preview3/Paket.Core.fsproj @@ -39,9 +39,13 @@ - + + + + + @@ -49,9 +53,6 @@ - - - diff --git a/src/Paket.Core/AssemblyInfo.fs b/src/Paket.Core/AssemblyInfo.fs index 4c7d6f0dca..46ed993d9d 100644 --- a/src/Paket.Core/AssemblyInfo.fs +++ b/src/Paket.Core/AssemblyInfo.fs @@ -6,9 +6,9 @@ open System.Reflection [] [] [] -[] -[] -[] +[] +[] +[] do () module internal AssemblyVersionInformation = @@ -16,6 +16,6 @@ module internal AssemblyVersionInformation = let [] AssemblyProduct = "Paket" let [] AssemblyCompany = "Paket team" let [] AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories." - let [] AssemblyVersion = "4.4.0" - let [] AssemblyFileVersion = "4.4.0" - let [] AssemblyInformationalVersion = "4.4.0" + let [] AssemblyVersion = "4.4.1" + let [] AssemblyFileVersion = "4.4.1" + let [] AssemblyInformationalVersion = "4.4.1" diff --git a/src/Paket.Core/BindingRedirects.fs b/src/Paket.Core/BindingRedirects.fs index c3b1e7f20b..5bb3eb219e 100644 --- a/src/Paket.Core/BindingRedirects.fs +++ b/src/Paket.Core/BindingRedirects.fs @@ -130,7 +130,7 @@ let private addConfigFileToProject project = project.Save(false)) /// Applies a set of binding redirects to a single configuration file. -let private applyBindingRedirects isFirstGroup cleanBindingRedirects (allKnownLibs:Reference seq) bindingRedirects (configFilePath:string) = +let private applyBindingRedirects isFirstGroup cleanBindingRedirects (allKnownLibNames:string seq) bindingRedirects (configFilePath:string) = let config = try XDocument.Load(configFilePath, LoadOptions.PreserveWhitespace) @@ -147,9 +147,9 @@ let private applyBindingRedirects isFirstGroup cleanBindingRedirects (allKnownLi let libIsContained e = let haystack = e.ToString().ToLower() - allKnownLibs + allKnownLibNames |> Seq.exists (fun b -> - let needle = (sprintf "name=\"%s\"" b.ReferenceName).ToLower() + let needle = (sprintf "name=\"%s\"" b).ToLower() haystack.Contains needle) let nsManager = XmlNamespaceManager(NameTable()); @@ -169,7 +169,7 @@ let private applyBindingRedirects isFirstGroup cleanBindingRedirects (allKnownLi config.Save(f, SaveOptions.DisableFormatting) /// Applies a set of binding redirects to all .config files in a specific folder. -let applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles cleanBindingRedirects rootPath allKnownLibs bindingRedirects = +let applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles cleanBindingRedirects rootPath allKnownLibNames bindingRedirects = let applyBindingRedirects projectFile = let bindingRedirects = bindingRedirects projectFile |> Seq.toList let path = Path.GetDirectoryName projectFile.FileName @@ -182,7 +182,7 @@ let applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles cleanBindin addConfigFileToProject projectFile Some config | _ -> None - |> Option.iter (applyBindingRedirects isFirstGroup cleanBindingRedirects allKnownLibs bindingRedirects) + |> Option.iter (applyBindingRedirects isFirstGroup cleanBindingRedirects allKnownLibNames bindingRedirects) rootPath |> getProjectFilesWithPaketReferences Directory.GetFiles diff --git a/src/Paket.Core/Files/DependenciesFile.fs b/src/Paket.Core/Files/DependenciesFile.fs index 187eedb16a..249071e990 100644 --- a/src/Paket.Core/Files/DependenciesFile.fs +++ b/src/Paket.Core/Files/DependenciesFile.fs @@ -173,7 +173,7 @@ type DependenciesFile(fileName,groups:Map, textRepr member __.FileName = fileName member __.Lines = textRepresentation - member this.Resolve(force, getSha1, getVersionF, getPackageDetailsF, groupsToResolve:Map, updateMode) = + member this.Resolve(force, getSha1, getVersionF, getPackageDetailsF, getPackageRuntimeGraph, groupsToResolve:Map, updateMode) = let resolveGroup groupName _ = let group = this.GetGroup groupName @@ -206,6 +206,7 @@ type DependenciesFile(fileName,groups:Map, textRepr if String.IsNullOrWhiteSpace fileName |> not then RemoteDownload.DownloadSourceFiles(Path.GetDirectoryName fileName, groupName, force, remoteFiles) + // Step 1 Package resolution let resolution = PackageResolver.Resolve( getVersionF, @@ -217,7 +218,68 @@ type DependenciesFile(fileName,groups:Map, textRepr remoteDependencies @ group.Packages |> Set.ofList, updateMode) - { ResolvedPackages = resolution + // Step 2 Runtime package resolution, see https://github.com/fsprojects/Paket/pull/2255 + let runtimeResolution = + match resolution with + | Resolution.Ok resolved -> + // runtime resolution step + let runtimeGraph = // setting this variable to empty is the fastest way to disable runtime deps resolution + resolved + |> Map.toSeq |> Seq.map snd + |> Seq.choose (getPackageRuntimeGraph groupName) + |> RuntimeGraph.mergeSeq + //RuntimeGraph.Empty + // 3. Resolve runtime deps and add it to the resolution + let rids = RuntimeGraph.getKnownRids runtimeGraph + let runtimeDeps = + resolved + |> Map.toSeq |> Seq.map snd + |> Seq.collect (fun p -> + rids + |> Seq.collect(fun rid -> RuntimeGraph.findRuntimeDependencies rid p.Name runtimeGraph)) + |> Seq.map (fun (name, versionReq) -> + { Name = name + VersionRequirement = versionReq + ResolverStrategyForDirectDependencies = Some ResolverStrategy.Max + ResolverStrategyForTransitives = Some ResolverStrategy.Max + Parent = PackageRequirementSource.DependenciesFile fileName + Graph = [] + Sources = group.Sources + Settings = group.Options.Settings }) + |> Seq.toList + + // TODO: We might want a way here to tell the resolver: + // "We don't really want Package A, but if you need it take Version X (from our resolution above)" + // Maybe we can actually do this by modifying the "getVersionF" callback? + let runtimeResolution = + PackageResolver.Resolve( + getVersionF, + getPackageDetailsF, + groupName, + group.Options.ResolverStrategyForDirectDependencies, + group.Options.ResolverStrategyForTransitives, + group.Options.Settings.FrameworkRestrictions, + runtimeDeps |> Set.ofList, + updateMode) + + // Combine with existing resolution and mark runtime packages. + // TODO: Warn if a package is part of both resolutions? + // TODO: Warn if a runtime package contains a runtime.json? -> We don't download them here :/ + match runtimeResolution with + | Resolution.Ok runtimeResolved -> + let mapped = + runtimeResolved + |> Map.map (fun _ v -> { v with IsRuntimeDependency = true }) + Map.merge (fun p1 p2 -> + if p1.Version = p2.Version then + p1 + else + failwithf "same package '%A' in runtime '%A' and regular '%A' resolution with different versions" p1.Name p1.Version p2.Version) resolved mapped + |> Resolution.Ok + | _ -> resolution + | Resolution.Conflict _ -> resolution + + { ResolvedPackages = runtimeResolution ResolvedSourceFiles = remoteFiles } groupsToResolve diff --git a/src/Paket.Core/Files/LockFile.fs b/src/Paket.Core/Files/LockFile.fs index b80181b811..fba5245867 100644 --- a/src/Paket.Core/Files/LockFile.fs +++ b/src/Paket.Core/Files/LockFile.fs @@ -107,7 +107,12 @@ module LockFileSerializer = { package.Settings with FrameworkRestrictions = FrameworkRestrictionList [] } else package.Settings - let s = settings.ToString().ToLower() + let s = + // add "isRuntimeDependency" + match package.IsRuntimeDependency, settings.ToString().ToLower() with + | true, "" -> "isRuntimeDependency: true" + | true, s -> s + ", isRuntimeDependency: true" + | _, s -> s if s = "" then yield sprintf " %O %s" package.Name versionStr @@ -359,7 +364,14 @@ module LockFileParser = ("framework: " + parts.[1]) else parts.[1] - parts.[0],InstallSettings.Parse(optionsString) + let isRuntimeDependency, optionsString = + if optionsString.EndsWith ", isRuntimeDependency: true" then + true, optionsString.Substring(0, optionsString.Length - ", isRuntimeDependency: true".Length) + elif optionsString.EndsWith "isRuntimeDependency: true" then + assert (optionsString = "isRuntimeDependency: true") + true, "" + else false, optionsString + parts.[0],isRuntimeDependency,InstallSettings.Parse(optionsString) ([{ GroupName = Constants.MainDependencyGroup; RepositoryType = None; RemoteUrl = None; Packages = []; SourceFiles = []; Options = InstallOptions.Default; LastWasPackage = false }], lockFileLines) ||> Seq.fold(fun state line -> @@ -394,7 +406,7 @@ module LockFileParser = | NugetPackage details -> match currentGroup.RemoteUrl with | Some remote -> - let package,settings = parsePackage details + let package,isRuntimeDependency,settings = parsePackage details let parts' = package.Split ' ' let version = if parts'.Length < 2 then @@ -409,10 +421,13 @@ module LockFileParser = Dependencies = Set.empty Unlisted = false Settings = settings - Version = SemVer.Parse version } :: currentGroup.Packages }::otherGroups + Version = SemVer.Parse version + // TODO: write stuff into the lockfile and read it here + IsRuntimeDependency = isRuntimeDependency } :: currentGroup.Packages }::otherGroups | None -> failwith "no source has been specified." | NugetDependency (name, v, frameworkSettings) -> - let version,settings = parsePackage v + let version,isRuntimeDependency,settings = parsePackage v + assert (not isRuntimeDependency) if currentGroup.LastWasPackage then match currentGroup.Packages with | currentPackage :: otherPackages -> diff --git a/src/Paket.Core/Files/ProjectFile.fs b/src/Paket.Core/Files/ProjectFile.fs index 8ce1587483..b90c044ddb 100644 --- a/src/Paket.Core/Files/ProjectFile.fs +++ b/src/Paket.Core/Files/ProjectFile.fs @@ -599,10 +599,9 @@ module ProjectFile = deleteIfEmpty "Choose" project |> ignore let getCustomModelNodes(model:InstallModel) (project:ProjectFile) = - let libs = - model.GetLibReferencesLazy.Force() - |> Set.map (fun lib -> lib.ReferenceName) - + let libs : string Set = + (model.GetAllLegacyReferenceAndFrameworkReferenceNames()) + getCustomReferenceAndFrameworkNodes project |> List.filter (fun node -> let libName = node.Attributes.["Include"].InnerText.Split(',').[0] @@ -671,71 +670,60 @@ module ProjectFile = |> Set.ofList let model = model.FilterReferences references - let createItemGroup (targets:TargetProfile list) references = + let createItemGroup (targets:TargetProfile list) (frameworkReferences:FrameworkReference list) (libraries:Library list) = let itemGroup = createNode "ItemGroup" project - let refOrder (r:Reference) = - match r with - | Reference.FrameworkAssemblyReference _ -> 0 - | Reference.Library _ -> 1 - | _ -> 2 - - for lib in references |> List.sortBy(fun (r:Reference) -> refOrder r, r.ReferenceName) do - match lib with - | Reference.Library lib -> - let fi = FileInfo (normalizePath lib) - let aliases = - aliases - |> Map.tryPick (fun dll alias -> if fi.Name.Equals(dll, StringComparison.OrdinalIgnoreCase) then Some(alias) else None) - - let relativePath = createRelativePath project.FileName fi.FullName - let privateSettings = - match copyLocal with - | Some true -> "True" - | Some false -> "False" - | None -> if relativePath.Contains @"\ref\" then "False" else "True" - - if relativePath.Contains @"\native\" then createNode "NativeReference" project else createNode "Reference" project - |> addAttribute "Include" (fi.Name.Replace(fi.Extension,"")) - |> addChild (createNodeSet "HintPath" relativePath project) - |> addChild (createNodeSet "Private" privateSettings project) - |> addChild (createNodeSet "Paket" "True" project) - |> fun n -> - match aliases with - | None -> n - | Some alias -> addChild (createNodeSet "Aliases" alias project) n - |> itemGroup.AppendChild - |> ignore - | Reference.FrameworkAssemblyReference frameworkAssembly -> - createNode "Reference" project - |> addAttribute "Include" frameworkAssembly - |> addChild (createNodeSet "Paket" "True" project) - |> itemGroup.AppendChild - |> ignore - | Reference.TargetsFile _ -> () + for ref in frameworkReferences |> List.sortBy (fun f -> f.Name) do + createNode "Reference" project + |> addAttribute "Include" ref.Name + |> addChild (createNodeSet "Paket" "True" project) + |> itemGroup.AppendChild + |> ignore + for lib in libraries |> List.sortBy (fun f -> f.Name) do + let fi = FileInfo (normalizePath lib.Path) + let aliases = + aliases + |> Map.tryPick (fun dll alias -> if fi.Name.Equals(dll, StringComparison.OrdinalIgnoreCase) then Some(alias) else None) + + let relativePath = createRelativePath project.FileName fi.FullName + let privateSettings = + match copyLocal with + | Some true -> "True" + | Some false -> "False" + | None -> if relativePath.Contains @"\ref\" then "False" else "True" + + if relativePath.Contains @"\native\" then createNode "NativeReference" project else createNode "Reference" project + |> addAttribute "Include" (fi.Name.Replace(fi.Extension,"")) + |> addChild (createNodeSet "HintPath" relativePath project) + |> addChild (createNodeSet "Private" privateSettings project) + |> addChild (createNodeSet "Paket" "True" project) + |> fun n -> + match aliases with + | None -> n + | Some alias -> addChild (createNodeSet "Aliases" alias project) n + |> itemGroup.AppendChild + |> ignore + itemGroup - let createPropertyGroup references = + let createPropertyGroup (references:MsBuildFile list) = let propertyGroup = createNode "PropertyGroup" project let propertyNames = references - |> Seq.choose (fun lib -> - match lib with - | Reference.Library _ -> None - | Reference.FrameworkAssemblyReference _ -> None - | Reference.TargetsFile targetsFile -> - let fi = new FileInfo(normalizePath targetsFile) - let propertyName = "__paket__" + fi.Name.ToString().Replace(" ","_").Replace(".","_") - - let path = createRelativePath project.FileName (fi.FullName.Replace(fi.Extension,"")) - let s = path.Substring(path.LastIndexOf("build\\") + 6) - let node = createNode propertyName project - node.InnerText <- s - node - |> propertyGroup.AppendChild - |> ignore - Some(propertyName,createRelativePath project.FileName fi.FullName,path.Substring(0,path.LastIndexOf("build\\") + 6))) + |> Seq.map (fun lib -> + let targetsFile = lib.Path + let fi = new FileInfo(normalizePath targetsFile) + let propertyName = "__paket__" + fi.Name.ToString().Replace(" ","_").Replace(".","_") + + let path = createRelativePath project.FileName (fi.FullName.Replace(fi.Extension,"")) + let s = path.Substring(path.LastIndexOf("build\\") + 6) + let node = createNode propertyName project + node.InnerText <- s + node + |> propertyGroup.AppendChild + |> ignore + propertyName,createRelativePath project.FileName fi.FullName,path.Substring(0,path.LastIndexOf("build\\") + 6)) |> Set.ofSeq propertyNames,propertyGroup @@ -753,11 +741,10 @@ module ProjectFile = // handle legacy conditions let conditions = - (model.GetReferenceFolders() @ netCoreRestricted.CompileRefFolders) + (model.GetReferenceFolders() @ (List.map (FrameworkFolder.map (fun refs -> { ReferenceOrLibraryFolder.empty with Libraries = refs })) netCoreRestricted.CompileRefFolders)) |> List.sortBy (fun libFolder -> libFolder.Path) |> List.collect (fun libFolder -> match libFolder with - //| x when (match x.Targets with | [SinglePlatform(Runtimes(_))] -> true | _ -> false) -> [] // TODO: Add reference to custom task instead | _ -> match PlatformMatching.getCondition referenceCondition allTargets libFolder.Targets with | "" -> [] @@ -767,34 +754,27 @@ module ProjectFile = | "$(TargetFrameworkIdentifier) == 'true'" -> "true" | _ -> condition - - let references = libFolder.Files.References |> Seq.sortBy (fun (r:Reference) -> r.Path) |> Seq.toList + let frameworkReferences = libFolder.FolderContents.FrameworkReferences |> Seq.sortBy (fun (r) -> r.Name) |> Seq.toList + let libraries = libFolder.FolderContents.Libraries |> Seq.sortBy (fun (r) -> r.Path) |> Seq.toList let assemblyTargets = ref libFolder.Targets let duplicates = HashSet<_>() - for lib in references do - match lib with - | Reference.FrameworkAssemblyReference frameworkAssembly -> - for t in libFolder.Targets do - if not <| usedFrameworkLibs.Add(t,frameworkAssembly) then - assemblyTargets := List.filter ((<>) t) !assemblyTargets - duplicates.Add lib |> ignore - | _ -> () + for frameworkAssembly in frameworkReferences do + for t in libFolder.Targets do + if not <| usedFrameworkLibs.Add(t,frameworkAssembly.Name) then + assemblyTargets := List.filter ((<>) t) !assemblyTargets + duplicates.Add frameworkAssembly.Name |> ignore if !assemblyTargets = libFolder.Targets then - [condition,createItemGroup libFolder.Targets references,false] + [condition,createItemGroup libFolder.Targets frameworkReferences libraries,false] else - let frameworkAssemblies,rest = - references - |> List.partition (fun lib -> - match lib with - | Reference.FrameworkAssemblyReference frameworkAssembly -> duplicates.Contains lib - | _ -> false) + let specialFrameworkAssemblies, rest = + frameworkReferences |> List.partition (fun fr -> duplicates.Contains fr.Name) match PlatformMatching.getCondition referenceCondition allTargets !assemblyTargets with - | "" -> [condition,createItemGroup libFolder.Targets rest,false] + | "" -> [condition,createItemGroup libFolder.Targets rest libraries,false] | lowerCondition -> - [lowerCondition,createItemGroup !assemblyTargets frameworkAssemblies,true - condition,createItemGroup libFolder.Targets rest,false] + [lowerCondition,createItemGroup !assemblyTargets specialFrameworkAssemblies [],true + condition,createItemGroup libFolder.Targets rest libraries,false] ) // global targets are targets, that are either directly in the /build folder. @@ -807,7 +787,7 @@ module ProjectFile = let frameworkSpecificTargetsFileConditions = frameworkSpecificTargets - |> List.map (fun lib -> PlatformMatching.getCondition referenceCondition allTargets lib.Targets,createPropertyGroup lib.Files.References) + |> List.map (fun lib -> PlatformMatching.getCondition referenceCondition allTargets lib.Targets,createPropertyGroup (lib.FolderContents |> List.ofSeq)) let chooseNodes = match conditions with @@ -916,7 +896,7 @@ module ProjectFile = let globalPropsNodes = globalTargets - |> Seq.collect (fun t -> t.Files.References) + |> Seq.collect (fun t -> t.FolderContents) |> Seq.map (fun t -> t.Path) |> Seq.distinct |> Seq.filter (fun t -> String.endsWithIgnoreCase ".props" t) @@ -930,7 +910,7 @@ module ProjectFile = let globalTargetsNodes = globalTargets - |> Seq.collect (fun t -> t.Files.References) + |> Seq.collect (fun t -> t.FolderContents) |> Seq.map (fun t -> t.Path) |> Seq.distinct |> Seq.filter (fun t -> String.endsWithIgnoreCase ".targets" t) @@ -1076,8 +1056,8 @@ module ProjectFile = if isTargetMatchingRestrictions(restrictionList,SinglePlatform targetFramework) then if projectModel.GetLibReferences targetFramework |> Seq.isEmpty then let libReferences = - projectModel.GetLibReferencesLazy |> force - |> Seq.filter (fun l -> match l with | Reference.Library _ -> true | _ -> false) + projectModel.GetAllLegacyReferences() // LibReferencesLazy |> force + //|> Seq.filter (fun l -> match l with | Reference.Library _ -> true | _ -> false) if not (Seq.isEmpty libReferences) then traceWarnfn "Package %O contains libraries, but not for the selected TargetFramework %O in project %s." diff --git a/src/Paket.Core/FindOutdated.fs b/src/Paket.Core/FindOutdated.fs index f00c39cf35..83e93a9641 100644 --- a/src/Paket.Core/FindOutdated.fs +++ b/src/Paket.Core/FindOutdated.fs @@ -51,7 +51,7 @@ let FindOutdated strict includingPrereleases groupNameFilter environment = trial | None -> dependenciesFile.Groups | Some gname -> dependenciesFile.Groups |> Map.filter(fun k g -> k.ToString() = gname) - let newResolution = dependenciesFile.Resolve(force, getSha1, getVersionsF, NuGetV2.GetPackageDetails alternativeProjectRoot root true, checkedDepsGroups, PackageResolver.UpdateMode.UpdateAll) + let newResolution = dependenciesFile.Resolve(force, getSha1, getVersionsF, NuGetV2.GetPackageDetails alternativeProjectRoot root true, RuntimeGraph.getRuntimeGraphFromNugetCache root, checkedDepsGroups, PackageResolver.UpdateMode.UpdateAll) let checkedLockGroups = match groupNameFilter with diff --git a/src/Paket.Core/FrameworkHandling.fs b/src/Paket.Core/FrameworkHandling.fs index 6bac93a313..f6f87ec2a6 100644 --- a/src/Paket.Core/FrameworkHandling.fs +++ b/src/Paket.Core/FrameworkHandling.fs @@ -208,7 +208,6 @@ type FrameworkIdentifier = | MonoTouch | MonoMac | Native of BuildMode * Platform - //| Runtimes of string | XamariniOS | XamarinMac | Windows of string @@ -228,7 +227,6 @@ type FrameworkIdentifier = | MonoTouch -> "monotouch" | MonoMac -> "monomac" | Native(_) -> "native" - //| Runtimes(_) -> "runtimes" | XamariniOS -> "xamarinios" | UAP v -> "uap" + v.ShortString() | XamarinMac -> "xamarinmac" @@ -245,7 +243,6 @@ type FrameworkIdentifier = | MonoTouch -> [ ] | MonoMac -> [ ] | Native(_) -> [ ] - //| Runtimes(_) -> [ ] | XamariniOS -> [ ] | XamarinMac -> [ ] | UAP UAPVersion.V10 -> [ ] @@ -307,7 +304,6 @@ type FrameworkIdentifier = | DNXCore _, DNXCore _ -> true | MonoAndroid _, MonoAndroid _ -> true | MonoMac _, MonoMac _ -> true - //| Runtimes _, Runtimes _ -> true | MonoTouch _, MonoTouch _ -> true | Windows _, Windows _ -> true | WindowsPhoneApp _, WindowsPhoneApp _ -> true @@ -368,7 +364,6 @@ module FrameworkDetection = // Each time the parsing is changed, NuGetPackageCache.CurrentCacheVersion should be bumped. let result = match path with - //| x when x.StartsWith "runtimes/" -> Some(Runtimes(x.Substring(9))) | "net10" | "net1" | "10" -> Some (DotNetFramework FrameworkVersion.V1) | "net11" | "11" -> Some (DotNetFramework FrameworkVersion.V1_1) | "net20" | "net2" | "net" | "net20-full" | "net20-client" | "20" -> Some (DotNetFramework FrameworkVersion.V2) @@ -671,6 +666,10 @@ module KnownTargetProfiles = let AllDotNetStandardProfiles = DotNetStandardProfiles @ DotNetCoreProfiles + // only used in "should understand aot in runtimes" test + // We don't support that anymore, if we add this here paket will create corresponding + // XML elements to compile for DNXCore... + //[SinglePlatform (DNXCore FrameworkVersion.V5_0)] let AllNativeProfiles = [ Native(NoBuildMode,NoPlatform) @@ -684,20 +683,8 @@ module KnownTargetProfiles = Native(Release,X64) Native(Release,Arm)] - //let AllRuntimes = - // [ Runtimes("win7-x64") - // Runtimes("win7-x86") - // Runtimes("win7-arm") - // Runtimes("debian-x64") - // Runtimes("aot") - // Runtimes("win") - // Runtimes("linux") - // Runtimes("unix") - // Runtimes("osx") ] - let AllProfiles = (AllNativeProfiles |> List.map SinglePlatform) @ - //(AllRuntimes |> List.map SinglePlatform) @ AllDotNetStandardProfiles @ AllDotNetProfiles diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 60d8bf570b..f6bcacefe4 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -6,97 +6,71 @@ open Paket.Domain open Paket.Requirements open Logging open PlatformMatching - -// An unparsed file in the nuget package -> still need to inspect the path for further information. After parsing an entry will be part of a "LibFolder" for example. -type UnparsedPackageFile = - { FullPath : string +open ProviderImplementation.AssemblyReader.Utils.SHA1 + +type UnparsedPackageFile = Paket.NuGet.UnparsedPackageFile +type Tfm = PlatformMatching.ParsedPlatformPath +type FrameworkDependentFile = + { Path : Tfm + File : UnparsedPackageFile + Runtime : Rid option } +type Library = + { Name : string + Path : string PathWithinPackage : string } +module Library = + let ofFile (f:FrameworkDependentFile) = + let fi = FileInfo(normalizePath f.File.FullPath) + let name = fi.Name.Replace(fi.Extension, "") + { Name = name; Path = f.File.FullPath; PathWithinPackage = f.File.PathWithinPackage } + +type RuntimeLibrary = + { Library : Library + Rid : Rid option } +module RuntimeLibrary = + let ofFile (f:FrameworkDependentFile) = + { Library = Library.ofFile f; Rid = f.Runtime } + +type MsBuildFile = + { Name : string + Path : string } +module MsBuildFile = + let ofFile (f:FrameworkDependentFile) = + let fi = FileInfo(normalizePath f.File.FullPath) + let name = fi.Name.Replace(fi.Extension, "") + { Name = name; Path = f.File.FullPath } + +type FrameworkReference = + { Name : string } +module FrameworkReference = + let ofName n = { FrameworkReference.Name = n } + +type ReferenceOrLibraryFolder = + { FrameworkReferences : FrameworkReference Set + Libraries : Library Set } + +module ReferenceOrLibraryFolder = + let empty = { FrameworkReferences = Set.empty; Libraries = Set.empty } + let addLibrary item old = + { old with ReferenceOrLibraryFolder.Libraries = Set.add item old.Libraries } + let addFrameworkReference item old = + { old with ReferenceOrLibraryFolder.FrameworkReferences = Set.add item old.FrameworkReferences } -[] -type Reference = - | Library of string - | TargetsFile of string - | FrameworkAssemblyReference of string - - member this.LibName = - match this with - | Reference.Library lib -> - let fi = FileInfo(normalizePath lib) - Some(fi.Name.Replace(fi.Extension, "")) - | _ -> None - - member this.FrameworkReferenceName = - match this with - | Reference.FrameworkAssemblyReference name -> Some name - | _ -> None - - member this.ReferenceName = - match this with - | Reference.FrameworkAssemblyReference name -> name - | Reference.TargetsFile targetsFile -> - let fi = FileInfo(normalizePath targetsFile) - fi.Name.Replace(fi.Extension, "") - | Reference.Library lib -> - let fi = FileInfo(normalizePath lib) - fi.Name.Replace(fi.Extension, "") - - member this.Path = - match this with - | Reference.Library path -> path - | Reference.TargetsFile path -> path - | Reference.FrameworkAssemblyReference path -> path - -type InstallFiles = - { References : Reference Set - ContentFiles : string Set } - -[] -module InstallFiles = - let empty = - { References = Set.empty - ContentFiles = Set.empty } - - let addReference lib (installFiles:InstallFiles) = - { installFiles with References = Set.add (Reference.Library lib) installFiles.References } - - let singleton lib = empty |> addReference lib - - let addTargetsFile targetsFile (installFiles:InstallFiles) = - { installFiles with References = Set.add (Reference.TargetsFile targetsFile) installFiles.References } - - let addFrameworkAssemblyReference assemblyName (installFiles:InstallFiles) = - { installFiles with References = Set.add (Reference.FrameworkAssemblyReference assemblyName) installFiles.References } - - let getFrameworkAssemblies (installFiles:InstallFiles) = - installFiles.References - |> Set.map (fun r -> r.FrameworkReferenceName) - |> Seq.choose id - - let mergeWith (that:InstallFiles) (installFiles:InstallFiles) = - { installFiles with - References = Set.union that.References installFiles.References - ContentFiles = Set.union that.ContentFiles installFiles.ContentFiles } - -type InstallFiles with - member this.AddReference lib = InstallFiles.addReference lib this - member this.AddTargetsFile targetsFile = InstallFiles.addTargetsFile targetsFile this - member this.AddFrameworkAssemblyReference assemblyName = InstallFiles.addFrameworkAssemblyReference assemblyName this - member this.GetFrameworkAssemblies() = InstallFiles.getFrameworkAssemblies this - member this.MergeWith that = InstallFiles.mergeWith that this - -type RuntimeIdentifier = - { Rid: string } - static member Any = { Rid = "any" } /// Represents a subfolder of a nuget package that provides files (content, references, etc) for one or more Target Profiles. This is a logical representation of the 'net45' folder in a NuGet package, for example. -type LibFolder = +type FrameworkFolder<'T> = { Path : ParsedPlatformPath Targets : TargetProfile list - Files : InstallFiles } + FolderContents : 'T } member this.GetSinglePlatforms() = this.Targets |> List.choose (function SinglePlatform t -> Some t | _ -> None) +module FrameworkFolder = + let map f (l:FrameworkFolder<_>) = + { Path = l.Path + Targets = l.Targets + FolderContents = f l.FolderContents } type AnalyzerLanguage = | Any | CSharp | FSharp | VisualBasic @@ -127,13 +101,16 @@ type AnalyzerLib = type InstallModel = { PackageName : PackageName PackageVersion : SemVerInfo - CompileLibFolders : LibFolder list - CompileRefFolders : LibFolder list - RuntimeLibFolders : LibFolder list - TargetsFileFolders : LibFolder list + CompileLibFolders : FrameworkFolder list + CompileRefFolders : FrameworkFolder list + RuntimeAssemblyFolders : FrameworkFolder list + RuntimeLibFolders : FrameworkFolder list + TargetsFileFolders : FrameworkFolder list Analyzers: AnalyzerLib list LicenseUrl: string option } +// TODO: This should move to its own module (maybe even a external library?) +// The tests below really should be unit tests... module FolderScanner = // Stolen and modifed to our needs from http://www.fssnip.net/4I/title/sscanf-parsing-with-format-strings open System.Text.RegularExpressions @@ -337,12 +314,13 @@ module InstallModel = CompileLibFolders = [] CompileRefFolders = [] RuntimeLibFolders = [] + RuntimeAssemblyFolders = [] TargetsFileFolders = [] Analyzers = [] LicenseUrl = None } type Tfm = PlatformMatching.ParsedPlatformPath - type Rid = RuntimeIdentifier + type Rid = Paket.Rid let scanners = [ { FolderScanner.AdvancedScanner.Name = "noSeperator"; FolderScanner.AdvancedScanner.Parser = FolderScanner.check "seperator not allowed" (fun s -> not (s.Contains "/" || s.Contains "\\")) >> FolderScanner.ParseResult.box } @@ -353,24 +331,19 @@ module InstallModel = let trySscanf pf s = FolderScanner.trySscanfExt scanners { FolderScanner.ScanOptions.Default with IgnoreCase = true } pf s - type FrameworkDependentFile = - { Path : Tfm - File : UnparsedPackageFile - Runtime : RuntimeIdentifier} - let getCompileRefAssembly (p:UnparsedPackageFile) = (trySscanf "ref/%A{tfm}/%A{noSeperator}" p.PathWithinPackage : (Tfm * string) option) - |> Option.map (fun (l,_) -> { Path = l; File = p; Runtime = RuntimeIdentifier.Any }) + |> Option.map (fun (l,_) -> { Path = l; File = p; Runtime = None }) let getRuntimeAssembly (p:UnparsedPackageFile) = (trySscanf "lib/%A{tfm}/%A{noSeperator}" p.PathWithinPackage : (Tfm * string) option) - |> Option.map (fun (l,_) -> { Path = l; File = p; Runtime = RuntimeIdentifier.Any }) + |> Option.map (fun (l,_) -> { Path = l; File = p; Runtime = None }) |> Option.orElseWith (fun _ -> (trySscanf "runtimes/%A{rid}/lib/%A{tfm}/%A{noSeperator}" p.PathWithinPackage : (Rid * Tfm * string) option) - |> Option.map (fun (rid, l, _) -> { Path = l; File = p; Runtime = rid })) + |> Option.map (fun (rid, l, _) -> { Path = l; File = p; Runtime = Some rid })) |> Option.orElseWith (fun _ -> (trySscanf "lib/%A{noSeperator}" p.PathWithinPackage : string option) - |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = RuntimeIdentifier.Any })) + |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = None })) let getCompileLibAssembly (p:UnparsedPackageFile) = // %s because 'native' uses subfolders... @@ -390,46 +363,53 @@ module InstallModel = if path.Contains "/release/" then Release else if path.Contains "/debug/" then Debug else NoBuildMode - { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform) ]}; File = p; Runtime = RuntimeIdentifier.Any } + { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform) ]}; File = p; Runtime = None } else - { Path = l; File = p; Runtime = RuntimeIdentifier.Any }) + { Path = l; File = p; Runtime = None }) |> Option.orElseWith (fun _ -> (trySscanf "lib/%A{noSeperator}" p.PathWithinPackage : string option) - |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = RuntimeIdentifier.Any })) + |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = None })) let getRuntimeLibrary (p:UnparsedPackageFile) = (trySscanf "runtimes/%A{rid}/nativeassets/%A{tfm}/%A{noSeperator}" p.PathWithinPackage : (Rid * Tfm * string) option) - |> Option.map (fun (rid, l,_) -> { Path = l; File = p; Runtime = rid }) + |> Option.map (fun (rid, l,_) -> { Path = l; File = p; Runtime = Some rid }) |> Option.orElseWith (fun _ -> (trySscanf "runtimes/%A{rid}/native/%A{noSeperator}" p.PathWithinPackage : (Rid * string) option) - |> Option.map (fun (rid, _) -> { Path = Tfm.Empty; File = p; Runtime = rid })) + |> Option.map (fun (rid, _) -> { Path = Tfm.Empty; File = p; Runtime = Some rid })) let getMsbuildFile (p:UnparsedPackageFile) = (trySscanf "build/%A{tfm}/%A{noSeperator}" p.PathWithinPackage : (Tfm * string) option) - |> Option.map (fun (l,_) -> { Path = l; File = p; Runtime = RuntimeIdentifier.Any }) + |> Option.map (fun (l,_) -> { Path = l; File = p; Runtime = None }) |> Option.orElseWith (fun _ -> (trySscanf "build/%A{noSeperator}" p.PathWithinPackage : string option) - |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = RuntimeIdentifier.Any })) - - let mapFolders mapfn (installModel:InstallModel) = - { installModel with - CompileLibFolders = List.map mapfn installModel.CompileLibFolders - CompileRefFolders = List.map mapfn installModel.CompileRefFolders - RuntimeLibFolders = List.map mapfn installModel.RuntimeLibFolders - TargetsFileFolders = List.map mapfn installModel.TargetsFileFolders } - - let mapFiles mapfn (installModel:InstallModel) = - installModel - |> mapFolders (fun folder -> { folder with Files = mapfn folder.Files }) + |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = None })) let private getFileFolders (target:TargetProfile) folderType choosefn = match Seq.tryFind (fun lib -> Seq.exists ((=) target) lib.Targets) folderType with - | Some folder -> folder.Files.References |> Seq.choose choosefn + | Some folder -> choosefn folder.FolderContents | None -> Seq.empty + let private getFileFoldersByPath (path:Tfm) (folderType:seq>) choosefn = + match Seq.tryFind (fun (lib:FrameworkFolder<_>) -> path = lib.Path) folderType with + | Some folder -> choosefn folder.FolderContents + | None -> Seq.empty + + let private getAllFiles folderType choosefn = + folderType + |> Seq.map (fun folder -> choosefn folder.FolderContents) + |> Seq.concat /// This is for library references, which at the same time can be used for references (old world - pre dotnetcore) let getLegacyReferences (target : TargetProfile) (installModel:InstallModel) = - getFileFolders target (installModel.CompileLibFolders) (function Reference.Library lib -> Some lib | _ -> None) + getFileFolders target (installModel.CompileLibFolders) (fun f -> f.Libraries |> Set.toSeq) + |> Seq.cache + let getLegacyFrameworkReferences (target : TargetProfile) (installModel:InstallModel) = + getFileFolders target (installModel.CompileLibFolders) (fun f -> f.FrameworkReferences |> Set.toSeq) + |> Seq.cache + let getAllLegacyFrameworkReferences (installModel:InstallModel) = + getAllFiles installModel.CompileLibFolders (fun f -> f.FrameworkReferences |> Set.toSeq) + |> Seq.cache + let getAllLegacyReferences (installModel:InstallModel) = + getAllFiles installModel.CompileLibFolders (fun f -> f.Libraries |> Set.toSeq) |> Seq.cache [] @@ -438,121 +418,102 @@ module InstallModel = /// This is for reference assemblies (new dotnetcore world) let getCompileReferences (target: TargetProfile) (installModel : InstallModel) = let results = - getFileFolders target (installModel.CompileRefFolders) (function Reference.Library lib -> Some lib | _ -> None) + getFileFolders target (installModel.CompileRefFolders) (fun f -> f |> Set.toSeq ) |> Seq.cache if results |> Seq.isEmpty then // Fallback for old packages getLegacyReferences target installModel else results - let getRuntimeLibraries (target : TargetProfile) (installModel:InstallModel) = - getFileFolders target (installModel.RuntimeLibFolders) (function Reference.Library lib -> Some lib | _ -> None) - |> Seq.cache - let getTargetsFiles (target : TargetProfile) (installModel:InstallModel) = - getFileFolders target installModel.TargetsFileFolders - (function Reference.TargetsFile targetsFile -> Some targetsFile | _ -> None) + getFileFolders target installModel.TargetsFileFolders (fun f -> f |> Set.toSeq) /// This is for library references, which at the same time can be used for references (old world - pre dotnetcore) let getLegacyPlatformReferences frameworkIdentifier installModel = getLegacyReferences (SinglePlatform frameworkIdentifier) installModel - /// This is for framework references, those do not exist anymore (old world - pre dotnetcore) - let getLegacyFrameworkAssembliesLazy (installModel:InstallModel) = - lazy ([ for lib in installModel.CompileLibFolders do - yield! lib.Files.GetFrameworkAssemblies()] - |> Set.ofList) - - /// This is for library references, which at the same time can be used for references (old world - pre dotnetcore) - let getLegacyReferencesLazy installModel = - lazy ([ for lib in installModel.CompileLibFolders do - yield! lib.Files.References] - |> Set.ofList) - - /// This is for reference assemblies (new dotnetcore world) - let getReferencesLazy (installModel:InstallModel) = - lazy ([ for lib in installModel.CompileRefFolders do - yield! lib.Files.References] - |> Set.ofList) - /// This is for runtime assemblies (new dotnetcore world) - let getRuntimeAssembliesLazy (installModel:InstallModel) = - lazy ([ for lib in installModel.RuntimeLibFolders do - yield! lib.Files.References] - |> Set.ofList) - - let getTargetsFilesLazy (installModel:InstallModel) = - lazy ([ for lib in installModel.TargetsFileFolders do - yield! lib.Files.References] - |> Set.ofList) - + let isEmpty (lib: FrameworkFolder> list) = + lib + |> Seq.map (fun l -> l.FolderContents) + |> Seq.forall Set.isEmpty let removeIfCompletelyEmpty (this:InstallModel) = - if Set.isEmpty (getLegacyFrameworkAssembliesLazy this |> force) - && Set.isEmpty (getLegacyReferencesLazy this |> force) - && Set.isEmpty (getReferencesLazy this |> force) - && Set.isEmpty (getRuntimeAssembliesLazy this |> force) - && Set.isEmpty (getTargetsFilesLazy this |> force) - && List.isEmpty this.Analyzers then + let foldersEmpty = + isEmpty this.CompileRefFolders && isEmpty this.TargetsFileFolders && isEmpty this.RuntimeAssemblyFolders && + this.CompileLibFolders + |> Seq.map (fun c -> c.FolderContents.Libraries |> Set.toSeq, c.FolderContents.FrameworkReferences |> Set.toSeq) + |> Seq.forall (fun (libs, refs) -> Seq.isEmpty libs && Seq.isEmpty refs) + + if foldersEmpty && List.isEmpty this.Analyzers then emptyModel this.PackageName this.PackageVersion else this - let calcLibFoldersG (parsePackage : UnparsedPackageFile -> FrameworkDependentFile option) (libs:UnparsedPackageFile list) = + let calcLibFoldersG empty (parsePackage : UnparsedPackageFile -> FrameworkDependentFile option) (libs:UnparsedPackageFile list) = libs |> List.choose parsePackage |> List.map (fun p -> p.Path) |> List.distinct //By (fun f -> f.Platforms) |> List.sort |> PlatformMatching.getSupportedTargetProfiles - |> Seq.map (fun entry -> { Path = entry.Key; Targets = entry.Value; Files = InstallFiles.empty }) + |> Seq.map (fun entry -> { Path = entry.Key; Targets = entry.Value; FolderContents = empty }) |> Seq.toList - let calcLegacyReferenceLibFolders = calcLibFoldersG getCompileLibAssembly - let calcReferenceFolders = calcLibFoldersG getCompileRefAssembly - let calcRuntimeFolders = calcLibFoldersG getRuntimeAssembly - //let calcRefFolders = calcLibFoldersG extractRefFolder + let calcLegacyReferenceLibFolders = calcLibFoldersG ReferenceOrLibraryFolder.empty getCompileLibAssembly + let calcReferenceFolders = calcLibFoldersG Set.empty getCompileRefAssembly + let calcRuntimeAssemblyFolders = calcLibFoldersG Set.empty getRuntimeAssembly + let calcRuntimeLibraryFolders l = calcLibFoldersG Set.empty getRuntimeLibrary l - let addFileToFolder (path:LibFolder) (file:UnparsedPackageFile) (folders:LibFolder list) (addfn: string -> InstallFiles -> InstallFiles) = + let addFileToFolder<'T, 'Item> (path:FrameworkFolder<'T>) (file:'Item) (folders:FrameworkFolder<'T> list) (addfn: 'Item -> 'T -> 'T) = folders |> List.map (fun p -> if p.Path <> path.Path then p else - { p with Files = addfn file.FullPath p.Files }) + { p with FolderContents = addfn file p.FolderContents }) + + let private addPackageLegacyLibFile references (path:FrameworkFolder) (file:FrameworkDependentFile) (this:InstallModel) : InstallModel = + let install = + match references with + | NuspecReferences.All -> true + | NuspecReferences.Explicit list -> List.exists file.File.FullPath.EndsWith list + if not install then this else + { this with + CompileLibFolders = addFileToFolder path (Library.ofFile file) this.CompileLibFolders ReferenceOrLibraryFolder.addLibrary } - let private addPackageLegacyLibFile references (path:LibFolder) (file:UnparsedPackageFile) (this:InstallModel) : InstallModel = + let private addPackageRefFile references (path:FrameworkFolder) (file:FrameworkDependentFile) (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true - | NuspecReferences.Explicit list -> List.exists file.FullPath.EndsWith list + | NuspecReferences.Explicit list -> List.exists file.File.FullPath.EndsWith list if not install then this else { this with - CompileLibFolders = addFileToFolder path file this.CompileLibFolders InstallFiles.addReference } + CompileRefFolders = addFileToFolder path (Library.ofFile file) this.CompileRefFolders Set.add } - let private addPackageRefFile references (path:LibFolder) (file:UnparsedPackageFile) (this:InstallModel) : InstallModel = + let private addPackageRuntimeAssemblyFile references (path:FrameworkFolder) (file:FrameworkDependentFile) (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true - | NuspecReferences.Explicit list -> List.exists file.FullPath.EndsWith list + | NuspecReferences.Explicit list -> List.exists file.File.FullPath.EndsWith list if not install then this else { this with - CompileRefFolders = addFileToFolder path file this.CompileRefFolders InstallFiles.addReference } + RuntimeAssemblyFolders = addFileToFolder path (RuntimeLibrary.ofFile file) this.RuntimeAssemblyFolders Set.add } - let private addPackageRuntimeFile references (path:LibFolder) (file:UnparsedPackageFile) (this:InstallModel) : InstallModel = + let private addPackageRuntimeLibraryFile references (path:FrameworkFolder) (file:FrameworkDependentFile) (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true - | NuspecReferences.Explicit list -> List.exists file.FullPath.EndsWith list + | NuspecReferences.Explicit list -> List.exists file.File.FullPath.EndsWith list if not install then this else { this with - RuntimeLibFolders = addFileToFolder path file this.RuntimeLibFolders InstallFiles.addReference } + RuntimeLibFolders = addFileToFolder path (RuntimeLibrary.ofFile file) this.RuntimeLibFolders Set.add } let private addItem libs extract addFunc getFolder initialState = List.fold (fun (model:InstallModel) file -> match extract file with - | Some (folderName:FrameworkDependentFile) -> - match List.tryFind (fun (folder:LibFolder) -> folder.Path = folderName.Path) (getFolder model) with - | Some path -> addFunc path file model + | Some (parsedFile:FrameworkDependentFile) -> + match List.tryFind (fun (folder:FrameworkFolder<_>) -> folder.Path = parsedFile.Path) (getFolder model) with + | Some path -> addFunc path parsedFile model | _ -> model | None -> model) initialState libs @@ -560,17 +521,20 @@ module InstallModel = let libs = libs |> Seq.toList let legacyLibFolders = calcLegacyReferenceLibFolders libs let refFolders = calcReferenceFolders libs - let runtimeFolders = calcRuntimeFolders libs + let runtimeAssemblyFolders = calcRuntimeAssemblyFolders libs + let runtimeLibraryFolders = calcRuntimeLibraryFolders libs { installModel with CompileLibFolders = legacyLibFolders CompileRefFolders = refFolders - RuntimeLibFolders = runtimeFolders } + RuntimeAssemblyFolders = runtimeAssemblyFolders + RuntimeLibFolders = runtimeLibraryFolders } |> addItem libs getCompileLibAssembly (addPackageLegacyLibFile references) (fun i -> i.CompileLibFolders) |> addItem libs getCompileRefAssembly (addPackageRefFile references) (fun i -> i.CompileRefFolders) - |> addItem libs getRuntimeAssembly (addPackageRuntimeFile references) (fun i -> i.RuntimeLibFolders) + |> addItem libs getRuntimeAssembly (addPackageRuntimeAssemblyFile references) (fun i -> i.RuntimeAssemblyFolders) + |> addItem libs getRuntimeLibrary (addPackageRuntimeLibraryFile references) (fun i -> i.RuntimeLibFolders) - let addAnalyzerFiles (analyzerFiles:UnparsedPackageFile seq) (installModel:InstallModel) : InstallModel = + let addAnalyzerFiles (analyzerFiles:NuGet.UnparsedPackageFile seq) (installModel:InstallModel) : InstallModel = let analyzerLibs = analyzerFiles |> Seq.map (fun file -> FileInfo file.FullPath |> AnalyzerLib.FromFile) @@ -579,13 +543,99 @@ module InstallModel = { installModel with Analyzers = installModel.Analyzers @ analyzerLibs} - let rec addTargetsFile (path:LibFolder) (file:UnparsedPackageFile) (installModel:InstallModel) :InstallModel = + let rec addTargetsFile (path:FrameworkFolder<_>) (file:FrameworkDependentFile) (installModel:InstallModel) :InstallModel = { installModel with - TargetsFileFolders = addFileToFolder path file installModel.TargetsFileFolders InstallFiles.addTargetsFile + TargetsFileFolders = addFileToFolder path (MsBuildFile.ofFile file) installModel.TargetsFileFolders Set.add } + let getAllRuntimeAssemblies (installModel:InstallModel) = + getAllFiles installModel.RuntimeAssemblyFolders (fun f -> f |> Set.toSeq) + |> Seq.cache + + let getRuntimeAssemblies (graph:RuntimeGraph) (rid:Rid) (target : TargetProfile) (installModel:InstallModel) = + // We need to recalculate the framework association after filtering with the RID + let allAssemblies = installModel.RuntimeAssemblyFolders |> Seq.collect (fun f -> f.FolderContents |> Seq.map (fun c -> f.Path, c)) + let allRids = allAssemblies |> Seq.choose (fun (_,s) -> s.Rid) |> Set.ofSeq + let bestMatchingRid = + RuntimeGraph.getInheritanceList rid graph + |> Seq.tryFind (fun rid -> allRids.Contains rid) + let filtered = allAssemblies |> Seq.filter (fun (_, a) -> a.Rid = None || a.Rid = bestMatchingRid) |> Seq.cache + let unParsedList = filtered |> Seq.map (fun (p, f) -> + { UnparsedPackageFile.FullPath = f.Library.Path; UnparsedPackageFile.PathWithinPackage = f.Library.PathWithinPackage } ) |> Seq.toList + let recalculated = calcRuntimeAssemblyFolders unParsedList + let filledFolder = + unParsedList + |> Seq.fold (fun folder (file) -> + let fdf = (getRuntimeAssembly file).Value + match List.tryFind (fun (folder:FrameworkFolder<_>) -> folder.Path = fdf.Path) (folder) with + | Some path -> addFileToFolder path (RuntimeLibrary.ofFile fdf) folder Set.add + | _ -> folder) recalculated + + let tfmData = + getFileFolders target filledFolder (Set.toSeq) + |> Seq.filter (fun lib -> lib.Rid = None || lib.Rid = bestMatchingRid) + |> Seq.cache + + tfmData + + let getAllRuntimeLibraries (installModel:InstallModel) = + getAllFiles installModel.RuntimeLibFolders (fun f -> f |> Set.toSeq) + |> Seq.cache + + let getRuntimeLibraries (graph:RuntimeGraph) (rid:Rid) (target : TargetProfile) (installModel:InstallModel) = + let allLibraries = getAllRuntimeLibraries installModel + if allLibraries |> Seq.exists (fun r -> r.Rid.IsNone) then + failwithf "Expected that all runtime libraries are associated with an RID." + let allRids = allLibraries |> Seq.choose (fun s -> s.Rid) |> Set.ofSeq + let bestMatchingRid = + RuntimeGraph.getInheritanceList rid graph + |> Seq.tryFind (fun rid -> allRids.Contains rid) + let tfmData = + getFileFolders target (installModel.RuntimeLibFolders) (Set.toSeq) + |> Seq.filter (fun lib -> lib.Rid = bestMatchingRid) + |> Seq.cache + let ridData = + getFileFoldersByPath Tfm.Empty installModel.RuntimeLibFolders Set.toSeq + |> Seq.filter (fun lib -> lib.Rid = bestMatchingRid) + |> Seq.cache + if allRids.Count > 0 && bestMatchingRid = None then + // No idea what this means, if this fails for you make this a warning or remove it completely. + // I added this to see if it appears in the real world... + failwithf "We found RID dependeny assemblies in the package but nothing matched against '%A'" rid + Seq.append tfmData ridData + + + let mapFolderContents<'T> (mapfn: 'T -> 'T) folders = + folders + |> List.map (fun p -> + { p with FolderContents = mapfn p.FolderContents }) + + let mapCompileLibFolders mapfn (installModel:InstallModel) = + { installModel with + CompileLibFolders = List.map mapfn installModel.CompileLibFolders } + let mapCompileRefFolders mapfn (installModel:InstallModel) = + { installModel with + CompileRefFolders = List.map mapfn installModel.CompileRefFolders } + let mapRuntimeAssemblyFolders mapfn (installModel:InstallModel) = + { installModel with + RuntimeAssemblyFolders = List.map mapfn installModel.RuntimeAssemblyFolders } + let mapTargetsFileFolders mapfn (installModel:InstallModel) = + { installModel with + TargetsFileFolders = List.map mapfn installModel.TargetsFileFolders } + + let mapCompileLibFrameworkReferences mapfn (installModel:InstallModel) = + mapCompileLibFolders (FrameworkFolder.map (fun l -> { l with FrameworkReferences = mapfn l.FrameworkReferences })) installModel + let mapCompileLibReferences mapfn (installModel:InstallModel) = + mapCompileLibFolders (FrameworkFolder.map (fun l -> { l with Libraries = mapfn l.Libraries })) installModel + let mapCompileRefFiles mapfn (installModel:InstallModel) = + mapCompileRefFolders (FrameworkFolder.map (mapfn)) installModel + let mapRuntimeAssemblyFiles mapfn (installModel:InstallModel) = + mapRuntimeAssemblyFolders (FrameworkFolder.map (mapfn)) installModel + let mapTargetsFiles mapfn (installModel:InstallModel) = + mapTargetsFileFolders (FrameworkFolder.map (mapfn)) installModel + let addFrameworkAssemblyReference (installModel:InstallModel) (reference:FrameworkAssemblyReference) : InstallModel = - let referenceApplies (folder : LibFolder) = + let referenceApplies (folder : FrameworkFolder<_>) = match reference.FrameworkRestrictions |> getRestrictionList with | [] -> true | restrictions -> @@ -616,48 +666,37 @@ module InstallModel = else installModel - model |> mapFolders(fun folder -> + model |> mapCompileLibFolders(fun folder -> if referenceApplies folder then - { folder with Files = folder.Files.AddFrameworkAssemblyReference reference.AssemblyName } + FrameworkFolder.map (fun c -> { c with FrameworkReferences = Set.add (FrameworkReference.ofName reference.AssemblyName) c.FrameworkReferences }) folder else folder) let addFrameworkAssemblyReferences references (installModel:InstallModel) : InstallModel = references |> Seq.fold addFrameworkAssemblyReference (installModel:InstallModel) - let filterExcludes excludes (installModel:InstallModel) = - let excluded e reference = - match reference with - | Reference.Library x -> x.Contains e - | Reference.TargetsFile x -> x.Contains e - | Reference.FrameworkAssemblyReference x -> x.Contains e + + + let filterExcludes (excludes:string list) (installModel:InstallModel) = + let excluded e (pathOrName:string) = + pathOrName.Contains e excludes |> List.fold (fun (model:InstallModel) fileName -> - mapFiles (fun files -> { files with References = Set.filter (excluded fileName >> not) files.References }) model) - installModel + model + |> mapCompileLibReferences (Set.filter (fun n -> n.PathWithinPackage |> excluded fileName |> not)) + |> mapCompileLibFrameworkReferences (Set.filter (fun r -> r.Name |> excluded fileName |> not)) + ) installModel let filterBlackList (installModel:InstallModel) = - - let includeReferences = function - | Reference.Library lib -> not (String.endsWithIgnoreCase ".dll" lib || String.endsWithIgnoreCase ".exe" lib || String.endsWithIgnoreCase ".so" lib || String.endsWithIgnoreCase ".dylib" lib ) - | Reference.TargetsFile targetsFile -> - (not (String.endsWithIgnoreCase ".props" targetsFile|| String.endsWithIgnoreCase ".targets" targetsFile)) - | _ -> false - - let excludeSatelliteAssemblies = function - | Reference.Library lib -> lib.EndsWith ".resources.dll" - | _ -> false - - let blackList = - [ includeReferences - excludeSatelliteAssemblies] - - blackList - |> List.map (fun f -> f >> not) // inverse - |> List.fold (fun (model:InstallModel) f -> - mapFiles (fun files -> { files with References = Set.filter f files.References }) model) - installModel + installModel + |> mapCompileLibReferences (Set.filter (fun l -> + let lib = l.Path + (String.endsWithIgnoreCase ".dll" lib || String.endsWithIgnoreCase ".exe" lib || String.endsWithIgnoreCase ".so" lib || String.endsWithIgnoreCase ".dylib" lib ))) + |> mapCompileLibReferences (Set.filter (fun lib -> not (lib.Path.EndsWith ".resources.dll"))) + |> mapTargetsFiles (Set.filter (fun t -> + let targetsFile = t.Path + (String.endsWithIgnoreCase ".props" targetsFile|| String.endsWithIgnoreCase ".targets" targetsFile))) let applyFrameworkRestrictions (restrictions:FrameworkRestriction list) (installModel:InstallModel) = match restrictions with @@ -677,8 +716,8 @@ module InstallModel = |> List.map applyRestriction |> List.filter (fun folder -> folder.Targets <> []) - RuntimeLibFolders = - installModel.RuntimeLibFolders + RuntimeAssemblyFolders = + installModel.RuntimeAssemblyFolders |> List.map applyRestriction |> List.filter (fun folder -> folder.Targets <> []) @@ -689,16 +728,15 @@ module InstallModel = let rec addTargetsFiles (targetsFiles:UnparsedPackageFile list) (this:InstallModel) : InstallModel = let targetsFileFolders = - calcLibFoldersG getMsbuildFile targetsFiles + calcLibFoldersG Set.empty getMsbuildFile targetsFiles { this with TargetsFileFolders = targetsFileFolders } |> addItem targetsFiles getMsbuildFile (addTargetsFile) (fun i -> i.TargetsFileFolders) - let filterReferences references (this:InstallModel) = - let inline mapfn (files:InstallFiles) = - { files with - References = files.References |> Set.filter (fun reference -> Set.contains reference.ReferenceName references |> not) - } - mapFiles mapfn this + + let filterReferences (references:string Set) (this:InstallModel) = + this + |> mapCompileLibReferences (Set.filter (fun reference -> Set.contains reference.Name references |> not)) + |> mapCompileLibFrameworkReferences (Set.filter (fun reference -> Set.contains reference.Name references |> not)) let addLicense url (model: InstallModel) = if String.IsNullOrWhiteSpace url then model @@ -722,31 +760,24 @@ type InstallModel with [] member this.GetReferenceFolders() = InstallModel.getCompileLibFolders this - member this.MapFolders mapfn = InstallModel.mapFolders mapfn this - - member this.MapFiles mapfn = InstallModel.mapFiles mapfn this - [] member this.GetLibReferences target = InstallModel.getLegacyReferences target this member this.GetLegacyReferences target = InstallModel.getLegacyReferences target this member this.GetCompileReferences target = InstallModel.getCompileReferences target this - member this.GetRuntimeLibraries target = InstallModel.getRuntimeLibraries target this + member this.GetRuntimeAssemblies graph rid target = InstallModel.getRuntimeAssemblies graph rid target this + member this.GetRuntimeLibraries graph rid target = InstallModel.getRuntimeLibraries graph rid target this [] member this.GetLibReferences frameworkIdentifier = InstallModel.getLegacyPlatformReferences frameworkIdentifier this member this.GetTargetsFiles target = InstallModel.getTargetsFiles target this - [] - member this.GetFrameworkAssembliesLazy = InstallModel.getLegacyFrameworkAssembliesLazy this - member this.GetLegacyFrameworkAssembliesLazy = InstallModel.getLegacyFrameworkAssembliesLazy this - - [] - member this.GetLibReferencesLazy = InstallModel.getLegacyReferencesLazy this - member this.GetLegacyReferencesLazy = InstallModel.getLegacyReferencesLazy this - member this.GetCompileReferencesLazy = InstallModel.getReferencesLazy this - - member this.GetTargetsFilesLazy = InstallModel.getTargetsFilesLazy this + member this.GetAllLegacyFrameworkReferences () = InstallModel.getAllLegacyFrameworkReferences this + member this.GetAllLegacyReferences () = InstallModel.getAllLegacyReferences this + member this.GetAllLegacyReferenceAndFrameworkReferenceNames () = + this.GetAllLegacyFrameworkReferences() |> Seq.map (fun r -> r.Name) + |> Seq.append (this.GetAllLegacyReferences() |> Seq.map (fun r -> r.Name)) + |> Set.ofSeq [] member this.CalcLibFolders libs = InstallModel.calcLegacyReferenceLibFolders libs diff --git a/src/Paket.Core/InstallProcess.fs b/src/Paket.Core/InstallProcess.fs index 348ca5475f..be52d5b752 100644 --- a/src/Paket.Core/InstallProcess.fs +++ b/src/Paket.Core/InstallProcess.fs @@ -199,7 +199,7 @@ let brokenDeps = HashSet<_>() /// Applies binding redirects for all strong-named references to all app. and web.config files. let private applyBindingRedirects isFirstGroup createNewBindingFiles redirects cleanBindingRedirects - root groupName findDependencies allKnownLibs + root groupName findDependencies allKnownLibNames (projectCache: Dictionary) extractedPackages = @@ -263,12 +263,12 @@ let private applyBindingRedirects isFirstGroup createNewBindingFiles redirects c |> Seq.collect (fun (_,profile) -> model.GetLibReferences profile |> Seq.map (fun x -> x, redirects, profile))) - |> Seq.groupBy (fun (p,_,profile) -> profile,FileInfo(p).Name) + |> Seq.groupBy (fun (p,_,profile) -> profile,FileInfo(p.Path).Name) |> Seq.choose(fun (_,librariesForPackage) -> librariesForPackage |> Seq.choose(fun (library,redirects,profile) -> try - let assembly = Mono.Cecil.AssemblyDefinition.ReadAssembly(library) + let assembly = Mono.Cecil.AssemblyDefinition.ReadAssembly(library.Path) Some (assembly, BindingRedirects.getPublicKeyToken assembly, assembly.MainModule.AssemblyReferences, redirects, profile) with _ -> None) |> Seq.sortBy(fun (assembly,_,_,_,_) -> assembly.Name.Version) @@ -303,7 +303,7 @@ let private applyBindingRedirects isFirstGroup createNewBindingFiles redirects c Culture = None }) |> Seq.sort - applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles cleanBindingRedirects root allKnownLibs bindingRedirects + applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles cleanBindingRedirects root allKnownLibNames bindingRedirects let installForDotnetSDK root (project:ProjectFile) = let paketTargetsPath = RestoreProcess.extractBuildTask(root) @@ -494,9 +494,9 @@ let InstallIntoProjects(options : InstallerOptions, forceTouch, dependenciesFile | true -> Some true | false -> None - let allKnownLibs = + let allKnownLibNames = model - |> Seq.map (fun kv -> (snd kv.Value).GetLibReferencesLazy.Force()) + |> Seq.map (fun kv -> (snd kv.Value).GetAllLegacyReferenceAndFrameworkReferenceNames()) |> Set.unionMany for g in lockFile.Groups do @@ -518,7 +518,7 @@ let InstallIntoProjects(options : InstallerOptions, forceTouch, dependenciesFile (FileInfo project.FileName).Directory.FullName g.Key lockFile.GetAllDependenciesOf - allKnownLibs + allKnownLibNames projectCache first := false diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index c14632b8c5..e47d0104c4 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -940,6 +940,14 @@ let DownloadPackage(alternativeProjectRoot, root, (source : PackageSource), cach elif not force && getFromCache caches then () else + match source with + | LocalNuGet(path,_) -> + let path = Utils.normalizeLocalPath path + let di = Utils.getDirectoryInfoForLocalNuGetFeed path alternativeProjectRoot root + let nupkg = findLocalPackage di.FullName packageName version + + File.Copy(nupkg.FullName,targetFileName) + | _ -> // discover the link on the fly let downloadUrl = ref "" try diff --git a/src/Paket.Core/Nuget.fs b/src/Paket.Core/Nuget.fs index af006906c8..1760b54e7e 100644 --- a/src/Paket.Core/Nuget.fs +++ b/src/Paket.Core/Nuget.fs @@ -12,6 +12,11 @@ open Chessie.ErrorHandling open Newtonsoft.Json open System +// An unparsed file in the nuget package -> still need to inspect the path for further information. After parsing an entry will be part of a "LibFolder" for example. +type UnparsedPackageFile = + { FullPath : string + PathWithinPackage : string } + module NuGetConfig = open System.Text diff --git a/src/Paket.Core/PackageResolver.fs b/src/Paket.Core/PackageResolver.fs index 084ee2e4da..decf5a4caa 100644 --- a/src/Paket.Core/PackageResolver.fs +++ b/src/Paket.Core/PackageResolver.fs @@ -70,12 +70,13 @@ type PackageDetails = { /// Represents data about resolved packages [] type ResolvedPackage = { - Name : PackageName - Version : SemVerInfo - Dependencies : DependencySet - Unlisted : bool - Settings : InstallSettings - Source : PackageSource + Name : PackageName + Version : SemVerInfo + Dependencies : DependencySet + Unlisted : bool + IsRuntimeDependency : bool + Settings : InstallSettings + Source : PackageSource } with override this.ToString () = sprintf "%O %O" this.Name this.Version @@ -377,12 +378,13 @@ let private explorePackageConfig getPackageDetailsF (pkgConfig:PackageConfig) = | _ -> dependency.Settings |> fun x -> x.AdjustWithSpecialCases packageDetails.Name Some - { Name = packageDetails.Name - Version = version - Dependencies = filteredDependencies - Unlisted = packageDetails.Unlisted - Settings = { settings with FrameworkRestrictions = newRestrictions } - Source = packageDetails.Source + { Name = packageDetails.Name + Version = version + Dependencies = filteredDependencies + Unlisted = packageDetails.Unlisted + Settings = { settings with FrameworkRestrictions = newRestrictions } + Source = packageDetails.Source + IsRuntimeDependency = false } with | exn -> diff --git a/src/Paket.Core/Paket.Core.fsproj b/src/Paket.Core/Paket.Core.fsproj index 900dca9d0b..01dbf88423 100644 --- a/src/Paket.Core/Paket.Core.fsproj +++ b/src/Paket.Core/Paket.Core.fsproj @@ -9,7 +9,7 @@ Paket Paket.Core v4.5 - 4.4.0.0 + 4.4.1.0 Paket ..\..\ @@ -63,6 +63,11 @@ $(MSBuildProgramFiles32)\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets + + + $(MSBuildProgramFiles32)\Microsoft SDKs\F#\4.1\Framework\v4.0\Microsoft.FSharp.Targets + + $(MSBuildProgramFiles32)\Microsoft SDKs\F#\4.1\Framework\v4.0\Microsoft.FSharp.Targets @@ -112,9 +117,13 @@ - + + + + + @@ -122,9 +131,6 @@ - - - diff --git a/src/Paket.Core/PlatformMatching.fs b/src/Paket.Core/PlatformMatching.fs index f63682b6f2..2c80e701fa 100644 --- a/src/Paket.Core/PlatformMatching.fs +++ b/src/Paket.Core/PlatformMatching.fs @@ -189,7 +189,6 @@ let getTargetCondition (target:TargetProfile) = | XamarinMac -> "$(TargetFrameworkIdentifier) == 'Xamarin.Mac'", "" | Native(NoBuildMode,NoPlatform) -> "true", "" | Native(NoBuildMode,bits) -> (sprintf "'$(Platform)'=='%s'" bits.AsString), "" - //| Runtimes(platform) -> failwithf "Runtime dependencies are unsupported in project files." | Native(profile,bits) -> (sprintf "'$(Configuration)|$(Platform)'=='%s|%s'" profile.AsString bits.AsString), "" | PortableProfile(name, _) -> sprintf "$(TargetFrameworkProfile) == '%O'" name,"" @@ -232,7 +231,6 @@ let getCondition (referenceCondition:string option) (allTargets: TargetProfile l targets |> List.filter (function | SinglePlatform(Native(NoBuildMode,NoPlatform)) -> false - //| SinglePlatform(Runtimes(_)) -> false | SinglePlatform(DotNetFramework(FrameworkVersion.V4_Client)) -> targets |> List.contains (SinglePlatform(DotNetFramework(FrameworkVersion.V4))) |> not | _ -> true) diff --git a/src/Paket.Core/Queries.fs b/src/Paket.Core/Queries.fs index b9a18a66a2..c67407592e 100644 --- a/src/Paket.Core/Queries.fs +++ b/src/Paket.Core/Queries.fs @@ -75,6 +75,32 @@ let getInstalledPackageModel (lockFile: LockFile) (QualifiedPackageName(groupNam let files = NuGetV2.GetLibFiles(folder.FullName) InstallModel.CreateFromLibs(packageName, resolvedPackage.Version, [], files, [], [], nuspec) +let getRuntimeGraph (lockFile: LockFile) (groupName:GroupName) = + lockFile.Groups + |> Map.tryFind groupName + |> Option.toList + |> Seq.collect (fun group -> group.Resolution |> Map.toSeq) + |> Seq.map snd + |> Seq.choose (fun p -> + let groupFolder = if groupName = Constants.MainDependencyGroup then "" else "/" + groupName.ToString() + let runtimeJson = sprintf "%s/packages%s/%O/runtime.json" lockFile.RootPath groupFolder p.Name + if File.Exists runtimeJson then Some runtimeJson + else None) + |> Seq.map File.ReadAllText + |> Seq.map RuntimeGraphParser.readRuntimeGraph + |> RuntimeGraph.mergeSeq + +let getRuntimePackages (rid) (lockFile:LockFile) (groupName:GroupName) = + let g = getRuntimeGraph lockFile groupName + + lockFile.Groups + |> Map.tryFind groupName + |> Option.toList + |> Seq.collect (fun group -> group.Resolution |> Map.toSeq) + |> Seq.map snd + |> Seq.collect (fun p -> RuntimeGraph.findRuntimeDependencies rid p.Name g) + |> Seq.toList + let resolveFrameworkForScriptGeneration (dependencies: DependenciesFile) = lazy ( dependencies.Groups |> Seq.map (fun f -> f.Value.Options.Settings.FrameworkRestrictions) diff --git a/src/Paket.Core/RestoreProcess.fs b/src/Paket.Core/RestoreProcess.fs index 64996806c2..9b286ead67 100644 --- a/src/Paket.Core/RestoreProcess.fs +++ b/src/Paket.Core/RestoreProcess.fs @@ -65,6 +65,7 @@ let ExtractPackage(alternativeProjectRoot, root, groupName, sources, caches, for let overridenFile = FileInfo(Path.Combine(targetDir, "paket.overriden")) let force = if (localOverride || overridenFile.Exists) then true else force let! result = async { + // TODO: Cleanup - Download gets a source and should be able to handle LocalNuGet as well, so this is duplicated match package.Source with | NuGetV2 _ | NuGetV3 _ -> let source = @@ -109,7 +110,7 @@ let internal restore (alternativeProjectRoot, root, groupName, sources, caches, async { RemoteDownload.DownloadSourceFiles(Path.GetDirectoryName lockFile.FileName, groupName, force, lockFile.Groups.[groupName].RemoteFiles) let! _ = lockFile.Groups.[groupName].Resolution - |> Map.filter (fun name _ -> packages.Contains name) + |> Map.filter (fun name r -> packages.Contains name) |> Seq.map (fun kv -> ExtractPackage(alternativeProjectRoot, root, groupName, sources, caches, force, kv.Value, Set.contains kv.Key overriden)) |> Async.Parallel return () diff --git a/src/Paket.Core/RuntimeGraph.fs b/src/Paket.Core/RuntimeGraph.fs new file mode 100644 index 0000000000..084f83f100 --- /dev/null +++ b/src/Paket.Core/RuntimeGraph.fs @@ -0,0 +1,211 @@ +namespace Paket + +open Domain + +// See https://github.com/NuGet/NuGet.Client/blob/85731166154d0818d79a19a6d2417de6aa851f39/src/NuGet.Core/NuGet.Packaging/RuntimeModel/RuntimeGraph.cs +// See http://www.natemcmaster.com/blog/2016/05/19/nuget3-rid-graph/ + +// Example files can be found in the packages "Microsoft.NETCore.Platforms 1.1.0" and "Microsoft.NETCore.Targets 1.1.0" + +/// The runtime identifiert for a specific runtime. Should be treated as a black box in combination with the operations defined on the RuntimeGraph +type Rid = + private { Rid : string } + static member Of s = { Rid = s } + static member Parse s = Rid.Of s + override x.ToString () = x.Rid + static member Any = { Rid = "any" } + +type CompatibilityProfileName = string + +/// A compatibility profile identifies which RIDs are compatible with what FrameworkIdentifier (TargetFrameworkMoniker/tfm in NuGet world) +type CompatibilityProfile = + { Name : CompatibilityProfileName + Supported : Map } + +/// The description for a particular RID, indicates inherited (compatible) RIDs and runtime dependencies for this RID. +type RuntimeDescription = + { Rid : Rid + InheritedRids : Rid list + RuntimeDependencies : Map } + +/// The runtime graph consolidating compatibility informations across the different RIDs +type RuntimeGraph = + { Supports : Map + Runtimes : Map } + static member Empty = { Supports = Map.empty; Runtimes = Map.empty } + +open Newtonsoft.Json +open Newtonsoft.Json.Linq + +/// A module for parsing runtime.json files contained in various packages. +module RuntimeGraphParser = + open System.Collections.Generic + + (* +{ "uwp.10.0.app": { + "uap10.0": [ + "win10-x86", + "win10-x86-aot", + "win10-x64", + "win10-x64-aot", + "win10-arm", + "win10-arm-aot" + ] + } +}*) + let readCompatiblityProfilesJ (json:JObject) = + [ for t in json :> IEnumerable> do + yield + { Name = t.Key + Supported = + [ for s in t.Value :?> JObject :> IEnumerable> do + match FrameworkDetection.Extract s.Key with + | Some fid -> + yield fid, [ for rid in (s.Value :?> JArray) -> { Rid = string rid } ] + | None -> failwithf "could not detect framework-identifier '%s'" s.Key ] + |> Map.ofSeq } ] + (*{ + "win": { + "#import": [ "any" ] + "Microsoft.Win32.Primitives": { + "runtime.win.Microsoft.Win32.Primitives": "4.3.0" + },*) + let readRuntimeDescriptionJ (json:JObject) = + [ for t in json :> IEnumerable> do + let rid = { Rid = t.Key } + match t.Value with + | :? JObject as spec -> + let imports = + match spec.["#import"] with + | :? JArray as j -> [ for t in j -> { Rid = string t } ] + | null -> [] + | o -> failwithf "unknown stuff in '#import' value: %O" o + let dependencies = + spec :> IEnumerable> + |> Seq.filter (fun kv -> kv.Key <> "#import") + |> Seq.map (fun kv -> + let packageName = PackageName kv.Key + let depsSpec = + match kv.Value with + | :? JObject as deps -> + deps :> IEnumerable> + |> Seq.map (fun kv -> PackageName kv.Key, VersionRequirement.Parse (string kv.Value)) + |> Seq.toList + | _ -> failwithf "unknown stuff in runtime-dependency: %O" kv.Value + packageName, depsSpec) + |> Map.ofSeq + yield + { Rid = rid + InheritedRids = imports + RuntimeDependencies = dependencies } + | _ -> failwithf "unknwn stuff in runtime-description: %O" t.Value ] + + let readRuntimeGraphJ (json:JObject) = + { Supports = + match json.["supports"] with + | :? JObject as supports -> + readCompatiblityProfilesJ supports + |> Seq.map (fun c -> c.Name, c) + |> Map.ofSeq + | null -> Map.empty + | _ -> failwith "invalid data in supports field." + Runtimes = + match json.["runtimes"] with + | :? JObject as runtimes -> + readRuntimeDescriptionJ runtimes + |> Seq.map (fun r -> r.Rid, r) + |> Map.ofSeq + | null -> Map.empty + | _ -> failwith "invalid data in runtimes" } + + let readRuntimeGraph (s:string) = + readRuntimeGraphJ (JObject.Parse(s)) + +module Map = + let merge (f:'b -> 'b -> 'b) (m1:Map<'a,'b>) (m2:Map<'a,'b>) = + m1 + |> Map.toSeq + |> Seq.append (m2 |> Map.toSeq) + |> Seq.groupBy (fst) + |> Seq.map (fun (k, g) -> + match g |> Seq.map snd |> Seq.toList with + | [ a; b ] -> k, f a b + | [ a ] -> k, a + | _ -> failwithf "This should never happen") + |> Map.ofSeq + +// Defines common operations on the runtime graph +module RuntimeGraph = + open PackageResolver + + let mergeCompatibility (s1:CompatibilityProfile) (s2:CompatibilityProfile) = + assert (s1.Name = s2.Name) + { Name = s1.Name + Supported = + Map.merge (@) s1.Supported s2.Supported + |> Map.map (fun _ l -> List.distinct l) } + let mergeDescription (d1:RuntimeDescription) (d2:RuntimeDescription) = + assert (d1.Rid = d2.Rid) + { Rid = d1.Rid + InheritedRids = d1.InheritedRids @ d2.InheritedRids |> List.distinct + RuntimeDependencies = + Map.merge (@) d1.RuntimeDependencies d2.RuntimeDependencies + |> Map.map (fun _ l -> List.distinct l) } + /// merge two runtime graphs + let merge (r1:RuntimeGraph) (r2:RuntimeGraph) = + { Supports = Map.merge mergeCompatibility r1.Supports r2.Supports + Runtimes = Map.merge mergeDescription r1.Runtimes r2.Runtimes } + /// merge a sequence of runtime graphs + let mergeSeq s = + s |> Seq.fold merge RuntimeGraph.Empty + /// get the list of compatible RIDs for the given RID. Most compatible are near the head. The list contains the given RID in the HEAD + let getInheritanceList (rid:Rid) (g:RuntimeGraph) = + let rec getListRec currentList toInspect = + match toInspect with + | rid :: rest -> + if List.contains rid currentList then + getListRec currentList rest + else + let desc = g.Runtimes.[rid] + let filtered = desc.InheritedRids |> List.filter (fun inh -> not (List.contains inh currentList)) + let newList = currentList @ filtered + let toInspect = rest @ filtered + getListRec newList toInspect + | _ -> currentList + + getListRec [rid] [rid] + /// get a list of RIDs in no particular order which are part of this runtime graph + let getKnownRids (g:RuntimeGraph) = + g.Runtimes |> Map.toSeq |> Seq.map fst + /// calculates whether the given assetRid is compatible with the given projectRid. + /// consider a project targeting projectRid, this returns true if an asset with assetRid is comaptible. + let areCompatible projectRid assetRid g = + g + |> getInheritanceList projectRid + |> List.contains assetRid + /// return runtime depenendencies for the given package and runtime + let findRuntimeDependencies rid packageName g = + getInheritanceList rid g + |> Seq.choose (fun r -> + match g.Runtimes |> Map.tryFind r with + | Some desc -> + let result = desc.RuntimeDependencies |> Map.tryFind packageName + result + | None -> None) + |> Seq.tryHead + |> Option.defaultValue [] + + open System.IO + /// Downloads the given package into the nuget cache and read its runtime.json. + let getRuntimeGraphFromNugetCache root groupName (package:ResolvedPackage) = + // 1. downloading packages into cache + let targetFileName, _ = + NuGetV2.DownloadPackage (None, root, package.Source, [], groupName, package.Name, package.Version, false, false, false) + |> Async.RunSynchronously + + let extractedDir = NuGetV2.ExtractPackageToUserFolder (targetFileName, package.Name, package.Version, null) |> Async.RunSynchronously + // 2. Get runtime graph + let runtime = Path.Combine(extractedDir, "runtime.json") + if File.Exists runtime then Some (runtime) else None + |> Option.map File.ReadAllText + |> Option.map RuntimeGraphParser.readRuntimeGraph \ No newline at end of file diff --git a/src/Paket.Core/ScriptGeneration.fs b/src/Paket.Core/ScriptGeneration.fs index 696a1215c2..085f59f6ee 100644 --- a/src/Paket.Core/ScriptGeneration.fs +++ b/src/Paket.Core/ScriptGeneration.fs @@ -58,6 +58,7 @@ module PackageAndAssemblyResolution = let dllFiles = installModel |> InstallModel.getLegacyReferences (SinglePlatform framework) + |> Seq.map (fun l -> l.Path) |> Seq.map (fun path -> AssemblyDefinition.ReadAssembly path, FileInfo(path)) |> dict @@ -77,9 +78,8 @@ module PackageAndAssemblyResolution = then List.empty else installModel - |> InstallModel.getLegacyFrameworkAssembliesLazy - |> force - |> Set.toList + |> InstallModel.getAllLegacyFrameworkReferences + |> Seq.toList module ScriptGeneration = open PackageAndAssemblyResolution @@ -258,9 +258,9 @@ module ScriptGeneration = mainGroupSeen := true let model = Queries.getInstalledPackageModel lockFile (QualifiedPackageName.FromStrings(Some group, nuget)) - let libs = model.GetLibReferences(framework) |> Seq.map (fun f -> FileInfo f) - let syslibs = model.GetFrameworkAssembliesLazy.Value - yield group, (libs, syslibs |> Set.toSeq) + let libs = model.GetLibReferences(framework) |> Seq.map (fun f -> FileInfo f.Path) + let syslibs = model.GetAllLegacyFrameworkReferences() + yield group, (libs, syslibs) if not !mainGroupSeen && groups = [] then yield mainGroupKey, (Seq.empty, Seq.empty) // Always generate Main group @@ -271,7 +271,7 @@ module ScriptGeneration = for group, libs in all do let assemblies, frameworkLibs = Seq.foldBack (fun (l,r) (pl, pr) -> Seq.concat [pl ; l], Seq.concat [pr ; r]) libs (Seq.empty, Seq.empty) - |> fun (l,r) -> Seq.distinct l, Seq.distinct r |> filterFrameworkAssemblies + |> fun (l,r) -> Seq.distinct l, Seq.distinct r |> Seq.map (fun ref -> ref.Name) |> filterFrameworkAssemblies let assemblies = let assemblyFilePerAssemblyDef = @@ -323,7 +323,7 @@ module ScriptGeneration = PackageName = installModel.PackageName PackagesOrGroupFolder = packagesOrGroupFolder IncludeScriptsRootFolder = includeScriptsRootFolder - FrameworkReferences = getFrameworkReferencesWithinPackage framework installModel + FrameworkReferences = getFrameworkReferencesWithinPackage framework installModel |> List.map (fun ref -> ref.Name) OrderedDllReferences = dllFiles DependentScripts = dependencies } diff --git a/src/Paket.Core/UpdateProcess.fs b/src/Paket.Core/UpdateProcess.fs index 9d9ed09171..69fc8f6827 100644 --- a/src/Paket.Core/UpdateProcess.fs +++ b/src/Paket.Core/UpdateProcess.fs @@ -10,7 +10,7 @@ open Chessie.ErrorHandling open Paket.Logging open InstallProcess -let selectiveUpdate force getSha1 getSortedVersionsF getPackageDetailsF (lockFile:LockFile) (dependenciesFile:DependenciesFile) updateMode semVerUpdateMode = +let selectiveUpdate force getSha1 getSortedVersionsF getPackageDetailsF getRuntimeGraphFromPackage (lockFile:LockFile) (dependenciesFile:DependenciesFile) updateMode semVerUpdateMode = let allVersions = Dictionary() let getSortedAndCachedVersionsF sources resolverStrategy groupName packageName : seq = let key = packageName,sources @@ -134,7 +134,7 @@ let selectiveUpdate force getSha1 getSortedVersionsF getPackageDetailsF (lockFil getVersionsF,getPackageDetailsF,groups - let resolution = dependenciesFile.Resolve(force, getSha1, getVersionsF, getPackageDetailsF, groupsToUpdate, updateMode) + let resolution = dependenciesFile.Resolve(force, getSha1, getVersionsF, getPackageDetailsF, getRuntimeGraphFromPackage, groupsToUpdate, updateMode) let groups = dependenciesFile.Groups @@ -203,6 +203,7 @@ let SelectiveUpdate(dependenciesFile : DependenciesFile, alternativeProjectRoot, getSha1 getVersionsF (NuGetV2.GetPackageDetails alternativeProjectRoot root force) + (RuntimeGraph.getRuntimeGraphFromNugetCache root) oldLockFile dependenciesFile updateMode diff --git a/src/Paket.PowerShell/AssemblyInfo.fs b/src/Paket.PowerShell/AssemblyInfo.fs index 7c7fee557f..ef135986db 100644 --- a/src/Paket.PowerShell/AssemblyInfo.fs +++ b/src/Paket.PowerShell/AssemblyInfo.fs @@ -6,9 +6,9 @@ open System.Reflection [] [] [] -[] -[] -[] +[] +[] +[] do () module internal AssemblyVersionInformation = @@ -16,6 +16,6 @@ module internal AssemblyVersionInformation = let [] AssemblyProduct = "Paket" let [] AssemblyCompany = "Paket team" let [] AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories." - let [] AssemblyVersion = "4.4.0" - let [] AssemblyFileVersion = "4.4.0" - let [] AssemblyInformationalVersion = "4.4.0" + let [] AssemblyVersion = "4.4.1" + let [] AssemblyFileVersion = "4.4.1" + let [] AssemblyInformationalVersion = "4.4.1" diff --git a/src/Paket/AssemblyInfo.fs b/src/Paket/AssemblyInfo.fs index 7a061c0194..9eeee192dc 100644 --- a/src/Paket/AssemblyInfo.fs +++ b/src/Paket/AssemblyInfo.fs @@ -6,9 +6,9 @@ open System.Reflection [] [] [] -[] -[] -[] +[] +[] +[] do () module internal AssemblyVersionInformation = @@ -16,6 +16,6 @@ module internal AssemblyVersionInformation = let [] AssemblyProduct = "Paket" let [] AssemblyCompany = "Paket team" let [] AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories." - let [] AssemblyVersion = "4.4.0" - let [] AssemblyFileVersion = "4.4.0" - let [] AssemblyInformationalVersion = "4.4.0" + let [] AssemblyVersion = "4.4.1" + let [] AssemblyFileVersion = "4.4.1" + let [] AssemblyInformationalVersion = "4.4.1" diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index 572df4068b..1fadd25137 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -38,7 +38,7 @@ install C:\dev\src\Paket\integrationtests\scenarios\loading-scripts\dependencies-file-flag\temp install - C:\PROJ\Paket\integrationtests\scenarios\i001467-cpp-native\temp + C:\PROJ\Paket\integrationtests\scenarios\i001145-excludes\temp pdbonly diff --git a/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs b/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs index a6cdb13154..3763b98de3 100644 --- a/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs +++ b/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs @@ -13,7 +13,7 @@ let fromLegacyList (prefix:string) l = l |> List.map (fun (i:string) -> if i.StartsWith prefix then - { FullPath = i; PathWithinPackage = i.Substring(prefix.Length).Replace("\\", "/") } + { Paket.NuGet.UnparsedPackageFile.FullPath = i; Paket.NuGet.UnparsedPackageFile.PathWithinPackage = i.Substring(prefix.Length).Replace("\\", "/") } else failwithf "Expected '%s' to start with '%s'" i prefix) [] @@ -32,20 +32,24 @@ let ``should create empty model with net40, net45 ...``() = let ``should understand net40 and net45``() = let model = emptymodel.AddReferences ([ @"..\Rx-Main\lib\net40\Rx.dll"; @"..\Rx-Main\lib\net45\Rx.dll" ] |> fromLegacyList @"..\Rx-Main\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\Rx-Main\lib\net40\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Rx-Main\lib\net45\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain (@"..\Rx-Main\lib\net40\Rx.dll") + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path)|> shouldContain @"..\Rx-Main\lib\net45\Rx.dll" [] let ``should understand lib in lib.dll``() = let model = emptymodel.AddReferences ([ @"..\FunScript.TypeScript\lib\net40\FunScript.TypeScript.Binding.lib.dll" ] |> fromLegacyList @"..\FunScript.TypeScript\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\FunScript.TypeScript\lib\net40\FunScript.TypeScript.Binding.lib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\FunScript.TypeScript\lib\net40\FunScript.TypeScript.Binding.lib.dll" -//[] -//let ``should understand libuv in runtimes``() = -// let model = emptymodel.AddReferences ([ @"..\Microsoft.AspNetCore.Server.Kestrel\runtimes\win7-x64\native\libuv.dll" ] |> fromLegacyList @"..\Microsoft.AspNetCore.Server.Kestrel\") -// -// model.GetLibReferences(SinglePlatform (Runtimes("win7-x64"))) |> shouldContain @"..\Microsoft.AspNetCore.Server.Kestrel\runtimes\win7-x64\native\libuv.dll" +[] +let ``should understand libuv in runtimes``() = + let model = emptymodel.AddReferences ([ @"..\Microsoft.AspNetCore.Server.Kestrel\runtimes\win7-x64\native\libuv.dll" ] |> fromLegacyList @"..\Microsoft.AspNetCore.Server.Kestrel\") + + model.GetRuntimeLibraries RuntimeGraph.Empty (Rid.Of "win7-x64") (SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun (r:RuntimeLibrary) -> r.Library.Path) |> shouldContain @"..\Microsoft.AspNetCore.Server.Kestrel\runtimes\win7-x64\native\libuv.dll" [] let ``should understand reference folder``() = @@ -56,32 +60,44 @@ let ``should understand reference folder``() = @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" ] |> fromLegacyList @"..\System.Security.Cryptography.Algorithms\") - let refs = model.GetLegacyReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + let refs = + model.GetLegacyReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + let refs = + model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + let refs = + model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetCompileReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + let refs = + model.GetCompileReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + let refs = + model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + let refs = + model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" @@ -92,80 +108,114 @@ let ``should understand reference folder``() = @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" ] |> fromLegacyList @"..\System.Security.Cryptography.Algorithms\") - let refs = model.GetLegacyReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + let refs = + model.GetLegacyReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + let refs = + model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetCompileReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + let refs = + model.GetCompileReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + let refs = + model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + |> Seq.map (fun f -> f.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetRuntimeLibraries(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + let refs = + model.GetRuntimeAssemblies RuntimeGraph.Empty (Rid.Of "win") (SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + |> Seq.map (fun f -> f.Library.Path) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - let refs = model.GetRuntimeLibraries(SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + let refs = + model.GetRuntimeAssemblies RuntimeGraph.Empty (Rid.Of "win") (SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + |> Seq.map (fun f -> f.Library.Path) refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" - // TODO: This is kind of broken for now -> the correct results depends on the runtime we want to get the runtime libraries for - // therefore GetRuntimeLibraries needs an additional parameter... refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" -//[] -//let ``should understand aot in runtimes``() = -// let model = emptymodel.AddReferences ([ @"..\packages\System.Diagnostics.Contracts\runtimes\aot\lib\netcore50\System.Diagnostics.Contracts.dll" ] |> fromLegacyList @"..\packages\System.Diagnostics.Contracts\") -// -// model.GetLibReferences(SinglePlatform (Runtimes("aot"))) |> shouldContain @"..\packages\System.Diagnostics.Contracts\runtimes\aot\lib\netcore50\System.Diagnostics.Contracts.dll" + let refs = + model.GetRuntimeAssemblies RuntimeGraph.Empty (Rid.Of "unix") (SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + |> Seq.map (fun f -> f.Library.Path) + refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" + refs |> shouldContain @"..\System.Security.Cryptography.Algorithms\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" + refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" + +[] +let ``should understand aot in runtimes``() = + let model = emptymodel.AddReferences ([ @"..\packages\System.Diagnostics.Contracts\runtimes\aot\lib\netstandard13\System.Diagnostics.Contracts.dll" ] |> fromLegacyList @"..\packages\System.Diagnostics.Contracts\") + + let refs = + model.GetRuntimeAssemblies RuntimeGraph.Empty (Rid.Of "aot") (SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + |> Seq.map (fun f -> f.Library.Path) + refs |> shouldContain @"..\packages\System.Diagnostics.Contracts\runtimes\aot\lib\netstandard13\System.Diagnostics.Contracts.dll" [] let ``should understand mylib in mylib.dll``() = let model = emptymodel.AddReferences ([ @"c:/users/username/workspace/myproject/packages/mylib.mylib/lib/net45/mylib.mylib.dll" ] |> fromLegacyList @"c:/users/username/workspace/myproject/packages/mylib.mylib/") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"c:/users/username/workspace/myproject/packages/mylib.mylib/lib/net45/mylib.mylib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"c:/users/username/workspace/myproject/packages/mylib.mylib/lib/net45/mylib.mylib.dll" [] let ``should add net35 if we have net20 and net40``() = let model = emptymodel.AddReferences([ @"..\Rx-Main\lib\net20\Rx.dll"; @"..\Rx-Main\lib\net40\Rx.dll" ] |> fromLegacyList @"..\Rx-Main\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Rx-Main\lib\net40\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldNotContain @"..\Rx-Main\lib\net20\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Rx-Main\lib\net40\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_1)) |> shouldContain @"..\Rx-Main\lib\net40\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net40\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Rx-Main\lib\net20\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net40\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_1)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net40\Rx.dll" [] let ``should put _._ files into right buckets``() = let model = emptymodel.AddReferences ([ @"..\Rx-Main\lib\net40\_._"; @"..\Rx-Main\lib\net20\_._" ] |> fromLegacyList @"..\Rx-Main\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Rx-Main\lib\net20\_._" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\Rx-Main\lib\net40\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net20\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net40\_._" [] let ``should inherit _._ files to higher frameworks``() = let model = emptymodel.AddReferences([ @"..\Rx-Main\lib\net40\_._"; @"..\Rx-Main\lib\net20\_._" ] |> fromLegacyList @"..\Rx-Main\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Rx-Main\lib\net20\_._" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Rx-Main\lib\net20\_._" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Rx-Main\lib\net40\_._" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Rx-Main\lib\net40\_._" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_1)) |> shouldContain @"..\Rx-Main\lib\net40\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net20\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net20\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net40\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net40\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_1)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net40\_._" [] @@ -173,10 +223,14 @@ let ``should skip buckets which contain placeholder while adjusting upper versio let model = emptymodel.AddReferences([ @"..\Rx-Main\lib\net20\Rx.dll"; @"..\Rx-Main\lib\net40\_._" ] |> fromLegacyList @"..\Rx-Main\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldNotContain @"..\Rx-Main\lib\net20\Rx.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldNotContain @"..\Rx-Main\lib\net20\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Rx-Main\lib\net20\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Rx-Main\lib\net20\Rx.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Rx-Main\lib\net20\Rx.dll" [] let ``should filter _._ when processing blacklist``() = @@ -184,17 +238,22 @@ let ``should filter _._ when processing blacklist``() = emptymodel.AddReferences([ @"..\Rx-Main\lib\net40\_._"; @"..\Rx-Main\lib\net20\_._" ] |> fromLegacyList @"..\Rx-Main\") .FilterBlackList() - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldNotContain @"..\Rx-Main\lib\net20\_._" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldNotContain @"..\Rx-Main\lib\net40\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Rx-Main\lib\net20\_._" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Rx-Main\lib\net40\_._" [] let ``should install single client profile lib for everything``() = let model = emptymodel.AddReferences([ @"..\Castle.Core\lib\net40-client\Castle.Core.dll" ] |> fromLegacyList @"..\Castle.Core\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\Castle.Core\lib\net40-client\Castle.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Castle.Core\lib\net40-client\Castle.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Castle.Core\lib\net40-client\Castle.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Castle.Core\lib\net40-client\Castle.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Castle.Core\lib\net40-client\Castle.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Castle.Core\lib\net40-client\Castle.Core.dll" [] @@ -204,9 +263,12 @@ let ``should install net40 for client profile``() = [ @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" @"..\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll"] |> fromLegacyList @"..\Newtonsoft.Json\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll" [] let ``should install not use net40-full for client profile``() = @@ -215,9 +277,12 @@ let ``should install not use net40-full for client profile``() = [ @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" @"..\Newtonsoft.Json\lib\net40-full\Newtonsoft.Json.dll"] |> fromLegacyList @"..\Newtonsoft.Json\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Newtonsoft.Json\lib\net40-full\Newtonsoft.Json.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldNotContain @"..\Newtonsoft.Json\lib\net40-full\Newtonsoft.Json.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Newtonsoft.Json\lib\net40-full\Newtonsoft.Json.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Newtonsoft.Json\lib\net40-full\Newtonsoft.Json.dll" [] let ``should handle lib install of Microsoft.Net.Http for .NET 4.5``() = @@ -231,33 +296,44 @@ let ``should handle lib install of Microsoft.Net.Http for .NET 4.5``() = @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.Primitives.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.Primitives.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" [] let ``should add portable lib``() = let model = emptymodel.AddReferences([ @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" ] |> fromLegacyList @"..\Jint\") - model.GetLibReferences(KnownTargetProfiles.FindPortableProfile "Profile147") |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" + model.GetLibReferences(KnownTargetProfiles.FindPortableProfile "Profile147") + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" [] let ``should handle lib install of Jint for NET >= 40 and SL >= 50``() = let model = emptymodel.AddReferences([ @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" ] |> fromLegacyList @"..\Jint\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" - model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" + model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldNotContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" - model.GetLibReferences(KnownTargetProfiles.FindPortableProfile "Profile147") |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" + model.GetLibReferences(KnownTargetProfiles.FindPortableProfile "Profile147") + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" [] let ``should handle lib install of Microsoft.BCL for NET >= 40``() = @@ -270,11 +346,15 @@ let ``should handle lib install of Microsoft.BCL for NET >= 40``() = @"..\Microsoft.Bcl\lib\net45\_._" ] |> fromLegacyList @"..\Microsoft.Bcl\") .FilterBlackList() - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldNotContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldBeEmpty model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_1)) |> shouldBeEmpty @@ -307,31 +387,44 @@ let ``should not use portable-net40 if we have net40``() = @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" ] |> fromLegacyList @"..\Microsoft.Bcl\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" let profile41 = KnownTargetProfiles.FindPortableProfile "Profile41" - model.GetLibReferences(profile41) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" - model.GetLibReferences(profile41) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" - model.GetLibReferences(profile41) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" + model.GetLibReferences(profile41) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" + model.GetLibReferences(profile41) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" + model.GetLibReferences(profile41) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" [] let ``should handle lib install of DotNetZip 1.9.3``() = let model = emptymodel.AddReferences([ @"..\DotNetZip\lib\net20\Ionic.Zip.dll" ] |> fromLegacyList @"..\DotNetZip\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\DotNetZip\lib\net20\Ionic.Zip.dll" [] let ``should handle lib install of NUnit 2.6 for windows 8``() = let model = emptymodel.AddReferences([ @"..\NUnit\lib\nunit.framework.dll" ] |> fromLegacyList @"..\NUnit\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\NUnit\lib\nunit.framework.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\NUnit\lib\nunit.framework.dll" - model.GetLibReferences(SinglePlatform (Windows "v4.5")) |> shouldContain @"..\NUnit\lib\nunit.framework.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\NUnit\lib\nunit.framework.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\NUnit\lib\nunit.framework.dll" + model.GetLibReferences(SinglePlatform (Windows "v4.5")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\NUnit\lib\nunit.framework.dll" [] @@ -365,38 +458,59 @@ let ``should handle lib install of Microsoft.Net.Http 2.2.28``() = @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" - - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.Primitives.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll" - - model.GetLibReferences(SinglePlatform MonoAndroid) |> shouldContain @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" - model.GetLibReferences(SinglePlatform MonoAndroid) |> shouldContain @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" - - model.GetLibReferences(SinglePlatform MonoTouch) |> shouldContain @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" - model.GetLibReferences(SinglePlatform MonoTouch) |> shouldContain @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.dll" - - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" - - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.Primitives.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll" + + model.GetLibReferences(SinglePlatform MonoAndroid) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" + model.GetLibReferences(SinglePlatform MonoAndroid) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" + + model.GetLibReferences(SinglePlatform MonoTouch) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" + model.GetLibReferences(SinglePlatform MonoTouch) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.dll" + + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" let profile88 = KnownTargetProfiles.FindPortableProfile "Profile88" - model.GetLibReferences(profile88) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" - model.GetLibReferences(profile88) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" - model.GetLibReferences(profile88) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" + model.GetLibReferences(profile88) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" + model.GetLibReferences(profile88) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" + model.GetLibReferences(profile88) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" let profile7 = KnownTargetProfiles.FindPortableProfile "Profile7" - model.GetLibReferences(profile7) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" - model.GetLibReferences(profile7) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll" + model.GetLibReferences(profile7) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" + model.GetLibReferences(profile7) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll" - model.GetLibReferences(SinglePlatform (Windows "v4.5")) |> shouldContain @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" - model.GetLibReferences(SinglePlatform (Windows "v4.5")) |> shouldContain @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll" + model.GetLibReferences(SinglePlatform (Windows "v4.5")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" + model.GetLibReferences(SinglePlatform (Windows "v4.5")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll" - model.GetLibReferences(SinglePlatform (WindowsPhoneApp "v8.1")) |> shouldContain @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" - model.GetLibReferences(SinglePlatform (WindowsPhoneApp "v8.1")) |> shouldContain @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" + model.GetLibReferences(SinglePlatform (WindowsPhoneApp "v8.1")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" + model.GetLibReferences(SinglePlatform (WindowsPhoneApp "v8.1")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" [] @@ -437,9 +551,12 @@ let ``should handle lib install of MicrosoftBcl``() = @"..\Microsoft.Bcl\lib\portable-net451+win81+wpa81\_._"] |> fromLegacyList @"..\Microsoft.Bcl\")).FilterBlackList() - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldBeEmpty model.GetLibReferences(SinglePlatform MonoAndroid) |> shouldBeEmpty @@ -451,21 +568,33 @@ let ``should handle lib install of MicrosoftBcl``() = model.GetLibReferences(KnownTargetProfiles.FindPortableProfile "Profile151") |> shouldBeEmpty let profile41 = KnownTargetProfiles.FindPortableProfile "Profile41" - model.GetLibReferences(profile41) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" - model.GetLibReferences(profile41) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" - model.GetLibReferences(profile41) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" - - model.GetLibReferences(SinglePlatform (Silverlight "v4.0")) |> shouldContain @"..\Microsoft.Bcl\lib\sl4\System.IO.dll" - model.GetLibReferences(SinglePlatform (Silverlight "v4.0")) |> shouldContain @"..\Microsoft.Bcl\lib\sl4\System.Runtime.dll" - model.GetLibReferences(SinglePlatform (Silverlight "v4.0")) |> shouldContain @"..\Microsoft.Bcl\lib\sl4\System.Threading.Tasks.dll" + model.GetLibReferences(profile41) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" + model.GetLibReferences(profile41) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" + model.GetLibReferences(profile41) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" + + model.GetLibReferences(SinglePlatform (Silverlight "v4.0")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl4\System.IO.dll" + model.GetLibReferences(SinglePlatform (Silverlight "v4.0")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl4\System.Runtime.dll" + model.GetLibReferences(SinglePlatform (Silverlight "v4.0")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl4\System.Threading.Tasks.dll" - model.GetLibReferences(SinglePlatform (WindowsPhoneSilverlight "v7.1")) |> shouldContain @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.IO.dll" - model.GetLibReferences(SinglePlatform (WindowsPhoneSilverlight "v7.1")) |> shouldContain @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Runtime.dll" - model.GetLibReferences(SinglePlatform (WindowsPhoneSilverlight "v7.1")) |> shouldContain @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Threading.Tasks.dll" + model.GetLibReferences(SinglePlatform (WindowsPhoneSilverlight "v7.1")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.IO.dll" + model.GetLibReferences(SinglePlatform (WindowsPhoneSilverlight "v7.1")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Runtime.dll" + model.GetLibReferences(SinglePlatform (WindowsPhoneSilverlight "v7.1")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Threading.Tasks.dll" - model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) |> shouldContain @"..\Microsoft.Bcl\lib\sl5\System.IO.dll" - model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) |> shouldContain @"..\Microsoft.Bcl\lib\sl5\System.Runtime.dll" - model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) |> shouldContain @"..\Microsoft.Bcl\lib\sl5\System.Threading.Tasks.dll" + model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl5\System.IO.dll" + model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl5\System.Runtime.dll" + model.GetLibReferences(SinglePlatform (Silverlight "v5.0")) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl\lib\sl5\System.Threading.Tasks.dll" [] @@ -476,17 +605,25 @@ let ``should handle lib install of Fantomas 1.5``() = @"..\Fantomas\lib\FSharp.Core.dll" @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\") - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" [] let ``should handle lib install of Fantomas 1.5.0 with explicit references``() = @@ -497,17 +634,25 @@ let ``should handle lib install of Fantomas 1.5.0 with explicit references``() = @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\", NuspecReferences.Explicit ["FantomasLib.dll"]) - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Fantomas\lib\FSharp.Core.dll" [] @@ -521,10 +666,14 @@ let ``should only handle dll and exe files``() = NuspecReferences.All) .FilterBlackList() - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\Fantomas\lib\Fantomas.exe" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldNotContain @"..\Fantomas\lib\FantomasLib.xml" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FantomasLib.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\FSharp.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Fantomas\lib\Fantomas.exe" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldNotContain @"..\Fantomas\lib\FantomasLib.xml" [] let ``should use portable net40 in net45 when don't have other files``() = @@ -533,11 +682,16 @@ let ``should use portable net40 in net45 when don't have other files``() = [ @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" ] |> fromLegacyList @"..\Google.Apis.Core\", NuspecReferences.All) - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_1)) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_2)) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_3)) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_1)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_5_3)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" [] let ``should not install tools``() = @@ -548,7 +702,7 @@ let ``should not install tools``() = @"..\FAKE\tools\Fake.SQL.dll" ] |> fromLegacyList @"..\FAKE\") model.CompileLibFolders - |> Seq.forall (fun folder -> folder.Files.References.IsEmpty) + |> Seq.forall (fun folder -> folder.FolderContents.Libraries.IsEmpty && folder.FolderContents.FrameworkReferences.IsEmpty) |> shouldEqual true [] @@ -559,7 +713,8 @@ let ``should handle props files``() = @"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ] |> fromLegacyList @"..\xunit.runner.visualstudio\") .FilterBlackList() - model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props" + model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props" [] let ``should handle Targets files``() = @@ -568,15 +723,16 @@ let ``should handle Targets files``() = [ @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" ] |> fromLegacyList @"..\StyleCop.MSBuild\") .FilterBlackList() - model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" + model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" [] let ``should filter .NET 4.0 dlls for System.Net.Http 2.2.8``() = let expected = - [ @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.Extensions.dll" + [ @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" + @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.Primitives.dll" - @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll" - @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" ] + @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll" ] |> Seq.ofList let model = @@ -604,6 +760,7 @@ let ``should filter .NET 4.0 dlls for System.Net.Http 2.2.8``() = @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\", [], [], Nuspec.All) model.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4))) + |> Seq.map (fun f -> f.Path) |> shouldEqual expected [] @@ -638,9 +795,11 @@ let ``should filter .NET 4.5 dlls for System.Net.Http 2.2.8``() = @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\", [], [], Nuspec.All) model.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4_5))) + |> Seq.map (fun f -> f.Path) |> shouldEqual expected model.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4_5_2))) + |> Seq.map (fun f -> f.Path) |> shouldEqual expected [] @@ -660,6 +819,7 @@ let ``should filter properly when portables are available``() = model.ApplyFrameworkRestrictions ( [ FrameworkRestriction.Exactly (FrameworkIdentifier.DotNetFramework FrameworkVersion.V4_5) ] ) filteredModel.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4_5))) + |> Seq.map (fun f -> f.Path) |> Seq.toList |> shouldEqual [ @"..\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll" ] @@ -679,10 +839,12 @@ let ``should keep net20 if nothing better is available``() = model.ApplyFrameworkRestrictions ( [ FrameworkRestriction.Exactly (FrameworkIdentifier.DotNetFramework FrameworkVersion.V4_6_1) ] ) filteredModel.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4_6_1))) + |> Seq.map (fun f -> f.Path) |> Seq.toList |> shouldEqual [ @"..\EPPlus\lib\net20\EPPlus.dll" ] filteredModel.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4))) + |> Seq.map (fun f -> f.Path) |> Seq.toList |> shouldEqual [ ] @@ -699,6 +861,7 @@ let ``prefer net20 over empty folder``() = model.ApplyFrameworkRestrictions ( [ FrameworkRestriction.Exactly (FrameworkIdentifier.DotNetFramework FrameworkVersion.V4_6_1) ] ) filteredModel.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4_6_1))) + |> Seq.map (fun f -> f.Path) |> Seq.toList |> shouldEqual [ @"..\EPPlus\lib\net20\EPPlus.dll" ] @@ -711,4 +874,5 @@ let ``should understand xamarinios``() = let model = emptymodel.ApplyFrameworkRestrictions ([FrameworkRestriction.Exactly (XamariniOS)]) let model = model.AddReferences ([ @"..\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll" ] |> fromLegacyList @"..\FSharp.Core\") - model.GetLibReferences(SinglePlatform (XamariniOS)) |> shouldContain @"..\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll" \ No newline at end of file + model.GetLibReferences(SinglePlatform (XamariniOS)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll" \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs index 8c132dae08..029b6a78ec 100644 --- a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs @@ -44,7 +44,8 @@ let ``should generate Xml for LibGit2Sharp 2.0.0``() = [], Nuspec.All) - model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\LibGit2Sharp\lib\net40\LibGit2Sharp.dll" + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\LibGit2Sharp\lib\net40\LibGit2Sharp.dll" let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml diff --git a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs index 38fa793757..8307878950 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs @@ -17,7 +17,8 @@ let ``should not install targets node for Microsoft.Bcl.Build``() = [], Nuspec.All) - model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets" + model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets" let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,false,KnownTargetProfiles.AllProfiles,None) diff --git a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs index 51c386cbc0..1bb145d462 100644 --- a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs +++ b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs @@ -22,7 +22,8 @@ let ``should generate Xml for StyleCop.MSBuild``() = [], Nuspec.All) - model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" + model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) + |> Seq.map (fun f -> f.Path) |> shouldContain @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) diff --git a/tests/Paket.Tests/Lockfile/GenerateAuthModeSpecs.fs b/tests/Paket.Tests/Lockfile/GenerateAuthModeSpecs.fs index 4c28494f73..796abb24ec 100644 --- a/tests/Paket.Tests/Lockfile/GenerateAuthModeSpecs.fs +++ b/tests/Paket.Tests/Lockfile/GenerateAuthModeSpecs.fs @@ -12,9 +12,10 @@ source "http://www.nuget.org/api/v2" username: "user" password: "pass" nuget "Castle.Windsor-log4net" "~> 3.2" """ -let graph = [ - "Castle.Windsor-log4net","3.2",[] -] +let graph = + OfSimpleGraph [ + "Castle.Windsor-log4net","3.2",[] + ] let expected = """NUGET remote: http://www.nuget.org/api/v2 diff --git a/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs b/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs index 03e879fb9f..eb6e9735e5 100644 --- a/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs +++ b/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs @@ -16,9 +16,10 @@ source "http://www.nuget.org/api/v2" nuget "Castle.Windsor-log4net" "~> 3.2" """ -let graph1 = [ - "Castle.Windsor-log4net","3.2",[] -] +let graph1 = + OfSimpleGraph [ + "Castle.Windsor-log4net","3.2",[] + ] let expected1 = """REFERENCES: STRICT COPY-LOCAL: FALSE @@ -43,9 +44,10 @@ source "http://www.nuget.org/api/v2" nuget "Microsoft.SqlServer.Types" """ -let graph2 = [ - "Microsoft.SqlServer.Types","1.0",[] -] +let graph2 = + OfSimpleGraph [ + "Microsoft.SqlServer.Types","1.0",[] + ] let expected2 = """IMPORT-TARGETS: FALSE CONTENT: NONE @@ -67,9 +69,10 @@ source "http://www.nuget.org/api/v2" nuget "Microsoft.SqlServer.Types" """ -let graph3 = [ - "Microsoft.SqlServer.Types","1.0",[] -] +let graph3 = + OfSimpleGraph [ + "Microsoft.SqlServer.Types","1.0",[] + ] let expected3 = """REDIRECTS: ON NUGET @@ -178,7 +181,6 @@ nuget NLog.Contrib "NLog.Contrib","1.0.0",["NLog",DependenciesFileParser.parseVersionRequirement ">= 1.0.1"] ] - let expected = """FRAMEWORK: >= NET40 NUGET remote: https://www.nuget.org/api/v2 diff --git a/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs b/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs index dd04c005cb..d4e2289075 100644 --- a/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs +++ b/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs @@ -197,9 +197,10 @@ source https://www.myget.org/F/ravendb3/ nuget RavenDB.Client == 3.0.3498-Unstable """ -let graph2 = [ - "RavenDB.Client","3.0.3498-Unstable",[] -] +let graph2 = + OfSimpleGraph [ + "RavenDB.Client","3.0.3498-Unstable",[] + ] let expected2 = """NUGET remote: https://www.myget.org/F/ravendb3 diff --git a/tests/Paket.Tests/Paket.Tests.fsproj b/tests/Paket.Tests/Paket.Tests.fsproj index 3c3d80f227..2a95a33441 100644 --- a/tests/Paket.Tests/Paket.Tests.fsproj +++ b/tests/Paket.Tests/Paket.Tests.fsproj @@ -364,6 +364,7 @@ + @@ -482,6 +483,91 @@ + + + + + ..\..\packages\Microsoft.CSharp\ref\netstandard1.0\Microsoft.CSharp.dll + False + True + + + + + + + ..\..\packages\Microsoft.CSharp\lib\netstandard1.3\Microsoft.CSharp.dll + True + True + + + + + + + + + ..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll + True + True + + + + + + + ..\..\packages\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll + True + True + + + + + + + ..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll + True + True + + + + + + + ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll + True + True + + + + + + + ..\..\packages\Newtonsoft.Json\lib\netstandard1.0\Newtonsoft.Json.dll + True + True + + + + + + + ..\..\packages\Newtonsoft.Json\lib\netstandard1.3\Newtonsoft.Json.dll + True + True + + + + + + + ..\..\packages\Newtonsoft.Json\lib\portable-net45+win8+wpa81+wp8\Newtonsoft.Json.dll + True + True + + + + @@ -509,6 +595,79 @@ + + + + + ..\..\packages\System.Collections.NonGeneric\lib\netstandard1.3\System.Collections.NonGeneric.dll + True + True + + + + + + + + + ..\..\packages\System.Collections.Specialized\lib\netstandard1.3\System.Collections.Specialized.dll + True + True + + + + + + + + + ..\..\packages\System.ComponentModel\ref\netstandard1.0\System.ComponentModel.dll + False + True + + + + + + + ..\..\packages\System.ComponentModel\lib\netstandard1.3\System.ComponentModel.dll + True + True + + + + + + + + + ..\..\packages\System.ComponentModel.Primitives\lib\netstandard1.0\System.ComponentModel.Primitives.dll + True + True + + + + + + + + + ..\..\packages\System.ComponentModel.TypeConverter\lib\netstandard1.0\System.ComponentModel.TypeConverter.dll + True + True + + + + + + + ..\..\packages\System.ComponentModel.TypeConverter\lib\netstandard1.5\System.ComponentModel.TypeConverter.dll + True + True + + + + @@ -540,6 +699,26 @@ + + + + + ..\..\packages\System.Dynamic.Runtime\ref\netstandard1.0\System.Dynamic.Runtime.dll + False + True + + + + + + + ..\..\packages\System.Dynamic.Runtime\lib\netstandard1.3\System.Dynamic.Runtime.dll + True + True + + + + @@ -560,6 +739,17 @@ + + + + + ..\..\packages\System.Globalization.Extensions\ref\netstandard1.3\System.Globalization.Extensions.dll + False + True + + + + @@ -598,6 +788,46 @@ + + + + + ..\..\packages\System.IO.FileSystem\lib\net46\System.IO.FileSystem.dll + True + True + + + + + + + ..\..\packages\System.IO.FileSystem\ref\netstandard1.3\System.IO.FileSystem.dll + False + True + + + + + + + + + ..\..\packages\System.IO.FileSystem.Primitives\lib\net46\System.IO.FileSystem.Primitives.dll + True + True + + + + + + + ..\..\packages\System.IO.FileSystem.Primitives\lib\netstandard1.3\System.IO.FileSystem.Primitives.dll + True + True + + + + @@ -886,6 +1116,55 @@ + + + + + ..\..\packages\System.Runtime.Handles\ref\netstandard1.3\System.Runtime.Handles.dll + False + True + + + + + + + + + ..\..\packages\System.Runtime.InteropServices\lib\net462\System.Runtime.InteropServices.dll + True + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\lib\net463\System.Runtime.InteropServices.dll + True + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.3\System.Runtime.InteropServices.dll + False + True + + + + + + + ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.5\System.Runtime.InteropServices.dll + False + True + + + + @@ -897,6 +1176,46 @@ + + + + + ..\..\packages\System.Runtime.Serialization.Formatters\ref\netstandard1.3\System.Runtime.Serialization.Formatters.dll + False + True + + + + + + + ..\..\packages\System.Runtime.Serialization.Formatters\lib\netstandard1.4\System.Runtime.Serialization.Formatters.dll + True + True + + + + + + + + + ..\..\packages\System.Runtime.Serialization.Primitives\ref\netstandard1.0\System.Runtime.Serialization.Primitives.dll + False + True + + + + + + + ..\..\packages\System.Runtime.Serialization.Primitives\lib\netstandard1.3\System.Runtime.Serialization.Primitives.dll + True + True + + + + @@ -917,6 +1236,26 @@ + + + + + ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.0\System.Text.Encoding.Extensions.dll + False + True + + + + + + + ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.3\System.Text.Encoding.Extensions.dll + False + True + + + + @@ -995,6 +1334,17 @@ + + + + + ..\..\packages\System.Threading.Tasks.Extensions\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll + True + True + + + + @@ -1048,6 +1398,75 @@ + + + + + ..\..\packages\System.Xml.ReaderWriter\lib\net46\System.Xml.ReaderWriter.dll + True + True + + + + + + + ..\..\packages\System.Xml.ReaderWriter\ref\netstandard1.0\System.Xml.ReaderWriter.dll + False + True + + + + + + + ..\..\packages\System.Xml.ReaderWriter\lib\netstandard1.3\System.Xml.ReaderWriter.dll + True + True + + + + + + + + + ..\..\packages\System.Xml.XDocument\ref\netstandard1.0\System.Xml.XDocument.dll + False + True + + + + + + + ..\..\packages\System.Xml.XDocument\lib\netstandard1.3\System.Xml.XDocument.dll + True + True + + + + + + + + + ..\..\packages\System.Xml.XmlDocument\lib\net46\System.Xml.XmlDocument.dll + True + True + + + + + + + ..\..\packages\System.Xml.XmlDocument\lib\netstandard1.3\System.Xml.XmlDocument.dll + True + True + + + + @@ -1314,26 +1733,6 @@ - - - - - ..\..\packages\test\System.Globalization.Extensions\lib\net46\System.Globalization.Extensions.dll - True - True - - - - - - - ..\..\packages\test\System.Globalization.Extensions\ref\netstandard1.3\System.Globalization.Extensions.dll - False - True - - - - @@ -1368,46 +1767,6 @@ - - - - - ..\..\packages\test\System.IO.FileSystem\lib\net46\System.IO.FileSystem.dll - True - True - - - - - - - ..\..\packages\test\System.IO.FileSystem\ref\netstandard1.3\System.IO.FileSystem.dll - False - True - - - - - - - - - ..\..\packages\test\System.IO.FileSystem.Primitives\lib\net46\System.IO.FileSystem.Primitives.dll - True - True - - - - - - - ..\..\packages\test\System.IO.FileSystem.Primitives\lib\netstandard1.3\System.IO.FileSystem.Primitives.dll - True - True - - - - @@ -1450,55 +1809,6 @@ - - - - - ..\..\packages\test\System.Runtime.Handles\ref\netstandard1.3\System.Runtime.Handles.dll - False - True - - - - - - - - - ..\..\packages\test\System.Runtime.InteropServices\lib\net462\System.Runtime.InteropServices.dll - True - True - - - - - - - ..\..\packages\test\System.Runtime.InteropServices\lib\net463\System.Runtime.InteropServices.dll - True - True - - - - - - - ..\..\packages\test\System.Runtime.InteropServices\ref\netstandard1.3\System.Runtime.InteropServices.dll - False - True - - - - - - - ..\..\packages\test\System.Runtime.InteropServices\ref\netstandard1.5\System.Runtime.InteropServices.dll - False - True - - - - @@ -1679,46 +1989,4 @@ - - - - - ..\..\packages\test\System.Threading.Tasks.Extensions\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll - True - True - - - - - - - - - ..\..\packages\test\System.Xml.ReaderWriter\lib\net46\System.Xml.ReaderWriter.dll - True - True - - - - - - - ..\..\packages\test\System.Xml.ReaderWriter\lib\netstandard1.3\System.Xml.ReaderWriter.dll - True - True - - - - - - - - - ..\..\packages\test\System.Xml.XDocument\lib\netstandard1.3\System.Xml.XDocument.dll - True - True - - - - \ No newline at end of file diff --git a/tests/Paket.Tests/Resolver/DependencyGroupsAndRestrictions.fs b/tests/Paket.Tests/Resolver/DependencyGroupsAndRestrictions.fs index 6446e4dbea..d2167fbdc3 100644 --- a/tests/Paket.Tests/Resolver/DependencyGroupsAndRestrictions.fs +++ b/tests/Paket.Tests/Resolver/DependencyGroupsAndRestrictions.fs @@ -9,7 +9,7 @@ open Paket.PackageResolver let resolve graph updateMode (cfg : DependenciesFile) = let groups = [Constants.MainDependencyGroup, None ] |> Map.ofSeq - cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() + cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,(fun _ _ -> None),groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() let graph1 = GraphOfNuspecs [ diff --git a/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs b/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs index 6fad93f6ca..827765e099 100644 --- a/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs +++ b/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs @@ -9,7 +9,7 @@ open Paket.PackageResolver let resolve graph updateMode (cfg : DependenciesFile) = let groups = [Constants.MainDependencyGroup, None ] |> Map.ofSeq - cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() + cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,(fun _ _ -> None),groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() let graph = OfSimpleGraph [ diff --git a/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs b/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs index b3763f8e68..810eaa484e 100644 --- a/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs +++ b/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs @@ -9,7 +9,7 @@ open Paket.PackageResolver let resolve graph updateMode (cfg : DependenciesFile) = let groups = [Constants.MainDependencyGroup, None ] |> Map.ofSeq - cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() + cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,(fun _ _ -> None),groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() let graph = OfSimpleGraph [ diff --git a/tests/Paket.Tests/Resolver/PropertyTests.fs b/tests/Paket.Tests/Resolver/PropertyTests.fs index 12fe12f500..f984625142 100644 --- a/tests/Paket.Tests/Resolver/PropertyTests.fs +++ b/tests/Paket.Tests/Resolver/PropertyTests.fs @@ -67,7 +67,8 @@ let bruteForce ((g,deps):ResolverPuzzle) = Dependencies = Set.empty Unlisted = false Settings = InstallSettings.Default - Source = PackageSources.DefaultNuGetSource } + Source = PackageSources.DefaultNuGetSource + IsRuntimeDependency = false } let deps' = packageDeps @ deps if createsError (g,deps') resolved then None else diff --git a/tests/Paket.Tests/Resolver/StrategySpecs.fs b/tests/Paket.Tests/Resolver/StrategySpecs.fs index 34e9736343..c353582831 100644 --- a/tests/Paket.Tests/Resolver/StrategySpecs.fs +++ b/tests/Paket.Tests/Resolver/StrategySpecs.fs @@ -9,7 +9,7 @@ open Paket.PackageResolver let resolve graph updateMode (cfg : DependenciesFile) = let groups = [Constants.MainDependencyGroup, None ] |> Map.ofSeq - cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() + cfg.Resolve(true,noSha1,VersionsFromGraphAsSeq graph,PackageDetailsFromGraph graph,(fun _ _ -> None),groups,updateMode).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() let graph = OfSimpleGraph [ @@ -67,12 +67,13 @@ source "http://www.nuget.org/api/v2" nuget Microsoft.AspNet.Mvc >= 6.0.0 lowest_matching: true """ -let graph2 = [ - "Microsoft.AspNet.Mvc","6.0.0",[] - "Microsoft.AspNet.Mvc","6.0.1",[] - "Microsoft.AspNet.Mvc","6.0.13",[] - "Microsoft.AspNet.Mvc","5.2.3",[] -] +let graph2 = + OfSimpleGraph [ + "Microsoft.AspNet.Mvc","6.0.0",[] + "Microsoft.AspNet.Mvc","6.0.1",[] + "Microsoft.AspNet.Mvc","6.0.13",[] + "Microsoft.AspNet.Mvc","5.2.3",[] + ] [] let ``should resolve config with min requirement``() = diff --git a/tests/Paket.Tests/RuntimeGraphTests.fs b/tests/Paket.Tests/RuntimeGraphTests.fs new file mode 100644 index 0000000000..f308d3b980 --- /dev/null +++ b/tests/Paket.Tests/RuntimeGraphTests.fs @@ -0,0 +1,221 @@ +module Paket.RuntimeGraphTests + +open Paket +open NUnit.Framework +open FsUnit +open Paket.Domain +open Paket.TestHelpers + +let supportAndDeps = """ +{ + "runtimes": { + "win": { + "Microsoft.Win32.Primitives": { + "runtime.win.Microsoft.Win32.Primitives": "4.3.0" + }, + "System.Runtime.Extensions": { + "runtime.win.System.Runtime.Extensions": "4.3.0" + } + } + }, + "supports": { + "uwp.10.0.app": { + "uap10.0": [ + "win10-x86", + "win10-x86-aot", + "win10-arm", + "win10-arm-aot" + ] + }, + "net45.app": { + "net45": [ + "", + "win-x86", + "win-x64" + ] + } + } +}""" + + +let rids = """ +{ + "runtimes": { + "base": { + }, + "any": { + "#import": [ "base" ] + }, + "win": { + "#import": [ "any" ] + } + } +} +""" + +[] +let ``Check if we can parse runtime support and runtime dependencies``() = + let runtimeGraph = RuntimeGraphParser.readRuntimeGraph supportAndDeps + + runtimeGraph + |> shouldEqual + { Runtimes = + [ { Rid = Rid.Of "win"; InheritedRids = [ ] + RuntimeDependencies = + [ PackageName "Microsoft.Win32.Primitives", [ PackageName "runtime.win.Microsoft.Win32.Primitives", VersionRequirement.VersionRequirement (VersionRange.Minimum (SemVer.Parse "4.3.0"), PreReleaseStatus.No) ] + PackageName "System.Runtime.Extensions", [ PackageName "runtime.win.System.Runtime.Extensions", VersionRequirement.VersionRequirement (VersionRange.Minimum (SemVer.Parse "4.3.0"), PreReleaseStatus.No) ] + ] + |> Map.ofSeq } ] + |> Seq.map (fun r -> r.Rid, r) + |> Map.ofSeq + Supports = + [ { Name = "net45.app" + Supported = + [ FrameworkIdentifier.DotNetFramework FrameworkVersion.V4_5, [ Rid.Of ""; Rid.Of "win-x86"; Rid.Of "win-x64" ]] + |> Map.ofSeq } + { Name = "uwp.10.0.app" + Supported = + [ FrameworkIdentifier.UAP UAPVersion.V10, [ Rid.Of "win10-x86"; Rid.Of "win10-x86-aot"; Rid.Of "win10-arm"; Rid.Of "win10-arm-aot" ]] + |> Map.ofSeq } ] + |> Seq.map (fun c -> c.Name, c) + |> Map.ofSeq + } + +[] +let ``Check if we can parse runtime rids``() = + let runtimeGraph = RuntimeGraphParser.readRuntimeGraph rids + + runtimeGraph + |> shouldEqual + { Runtimes = + [ { Rid = Rid.Of "base"; InheritedRids = [ ]; RuntimeDependencies = Map.empty } + { Rid = Rid.Of "any"; InheritedRids = [ Rid.Of "base" ]; RuntimeDependencies = Map.empty } + { Rid = Rid.Of "win"; InheritedRids = [ Rid.Of "any" ]; RuntimeDependencies = Map.empty } ] + |> Seq.map (fun r -> r.Rid, r) + |> Map.ofSeq + Supports = + [] + |> Map.ofSeq + } + +[] +let ``Check if we can merge two graphs``() = + let r1 = RuntimeGraphParser.readRuntimeGraph rids + let r2 = RuntimeGraphParser.readRuntimeGraph supportAndDeps + let merged = RuntimeGraph.merge r1 r2 + let win = merged.Runtimes.[Rid.Of "win"] + win.InheritedRids + |> shouldEqual [ Rid.Of "any" ] + win.RuntimeDependencies + |> shouldEqual + ([ PackageName "Microsoft.Win32.Primitives", [ PackageName "runtime.win.Microsoft.Win32.Primitives", VersionRequirement.VersionRequirement (VersionRange.Minimum (SemVer.Parse "4.3.0"), PreReleaseStatus.No) ] + PackageName "System.Runtime.Extensions", [ PackageName "runtime.win.System.Runtime.Extensions", VersionRequirement.VersionRequirement (VersionRange.Minimum (SemVer.Parse "4.3.0"), PreReleaseStatus.No) ] + ] |> Map.ofSeq) + +[] +let ``Check that runtime dependencies are saved as such in the lockfile`` () = + let lockFileData = """ """ + let getLockFile lockFileData = LockFile.Parse("",toLines lockFileData) + let lockFile = lockFileData |> getLockFile + + let graph = + [ "MyDependency", "3.2.0", [], RuntimeGraph.Empty + "MyDependency", "3.3.3", [], RuntimeGraph.Empty + "MyDependency", "4.0.0", [], RuntimeGraphParser.readRuntimeGraph """{ + "runtimes": { + "win": { + "MyDependency": { + "MyRuntimeDependency": "4.0.0" + } + } + } +}""" + "MyRuntimeDependency", "4.0.0", [], RuntimeGraph.Empty + "MyRuntimeDependency", "4.0.1", [], RuntimeGraph.Empty ] + |> OfGraphWithRuntimeDeps + + let expectedLockFile = """NUGET + remote: http://www.nuget.org/api/v2 + MyDependency (4.0) + MyRuntimeDependency (4.0.1) - isRuntimeDependency: true""" + + let depsFile = DependenciesFile.FromCode("""source http://www.nuget.org/api/v2 +nuget MyDependency""") + let lockFile, resolution = + UpdateProcess.selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) (GetRuntimeGraphFromGraph graph) lockFile depsFile PackageResolver.UpdateMode.Install SemVerUpdateMode.NoRestriction + + let result = + lockFile.GetGroupedResolution() + |> Seq.map (fun (KeyValue (_,resolved)) -> (string resolved.Name, string resolved.Version, resolved.IsRuntimeDependency)) + + let expected = + [("MyDependency","4.0.0", false); + ("MyRuntimeDependency","4.0.1", true)] + |> Seq.sortBy (fun (t,_,_) ->t) + + result + |> Seq.sortBy (fun (t,_,_) ->t) + |> shouldEqual expected + + lockFile.GetGroup(Constants.MainDependencyGroup).Resolution + |> LockFileSerializer.serializePackages depsFile.Groups.[Constants.MainDependencyGroup].Options + |> shouldEqual (normalizeLineEndings expectedLockFile) + +[] +let ``Check that runtime dependencies we don't use are ignored`` () = + let lockFileData = """ """ + let getLockFile lockFileData = LockFile.Parse("",toLines lockFileData) + let lockFile = lockFileData |> getLockFile + + let graph = + [ "MyDependency", "3.2.0", [], RuntimeGraph.Empty + "MyDependency", "3.3.3", [], RuntimeGraph.Empty + "MyDependency", "4.0.0", [], RuntimeGraphParser.readRuntimeGraph """{ + "runtimes": { + "win": { + "SomePackage": { + "MyRuntimeDependency": "4.0.0" + } + } + } +}""" + "MyRuntimeDependency", "4.0.0", [], RuntimeGraph.Empty + "MyRuntimeDependency", "4.0.1", [], RuntimeGraph.Empty ] + |> OfGraphWithRuntimeDeps + + let depsFile = DependenciesFile.FromCode("""source http://www.nuget.org/api/v2 +nuget MyDependency""") + let lockFile, resolution = + UpdateProcess.selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) (GetRuntimeGraphFromGraph graph) lockFile depsFile PackageResolver.UpdateMode.Install SemVerUpdateMode.NoRestriction + + let result = + lockFile.GetGroupedResolution() + |> Seq.map (fun (KeyValue (_,resolved)) -> (string resolved.Name, string resolved.Version, resolved.IsRuntimeDependency)) + + let expected = + [("MyDependency","4.0.0", false)] + |> Seq.sortBy (fun (t,_,_) ->t) + + result + |> Seq.sortBy (fun (t,_,_) ->t) + |> shouldEqual expected + +[] +let ``Check that runtime dependencies are loaded from the lockfile`` () = + let lockFile = """NUGET + remote: http://www.nuget.org/api/v2 + MyDependency (4.0) + MyRuntimeDependency (4.0.1) - isRuntimeDependency: true""" + + let lockFile = LockFileParser.Parse(toLines lockFile) |> List.head + let packages = List.rev lockFile.Packages + + let expected = + [("MyDependency","4.0", false); + ("MyRuntimeDependency","4.0.1", true)] + |> List.sortBy (fun (t,_,_) ->t) + + packages + |> List.map (fun r -> string r.Name, string r.Version, r.IsRuntimeDependency) + |> List.sortBy (fun (t,_,_) ->t) + |> shouldEqual expected \ No newline at end of file diff --git a/tests/Paket.Tests/ScriptGeneration/LoadingScriptTests.fs b/tests/Paket.Tests/ScriptGeneration/LoadingScriptTests.fs index c2e8ff73d4..29c5cfde83 100644 --- a/tests/Paket.Tests/ScriptGeneration/LoadingScriptTests.fs +++ b/tests/Paket.Tests/ScriptGeneration/LoadingScriptTests.fs @@ -19,13 +19,15 @@ let testData = Paket.Requirements.FrameworkRestrictions.AutoDetectFramework) PackageResolver.ResolvedPackage.Unlisted = false PackageResolver.ResolvedPackage.Settings = Requirements.InstallSettings.Default - PackageResolver.ResolvedPackage.Source = PackageSources.PackageSource.NuGetV2 { Url = ""; Authentication = None } } + PackageResolver.ResolvedPackage.Source = PackageSources.PackageSource.NuGetV2 { Url = ""; Authentication = None } + PackageResolver.IsRuntimeDependency = false } { Name = PackageName("other") Version = SemVer.Parse "1.0.0" Dependencies = Set.empty Unlisted = false Settings = Requirements.InstallSettings.Default - Source = PackageSources.PackageSource.NuGetV2 { Url = ""; Authentication = None } } + Source = PackageSources.PackageSource.NuGetV2 { Url = ""; Authentication = None } + IsRuntimeDependency = false } ] [] diff --git a/tests/Paket.Tests/TestHelpers.fs b/tests/Paket.Tests/TestHelpers.fs index d8de5cd65d..dcea6113bc 100644 --- a/tests/Paket.Tests/TestHelpers.fs +++ b/tests/Paket.Tests/TestHelpers.fs @@ -11,32 +11,39 @@ open Paket.Domain type GraphDependency = string * VersionRequirement * FrameworkRestrictions -type DependencyGraph = list +type DependencyGraph = list let OfSimpleGraph (g:seq) : DependencyGraph = g |> Seq.map (fun (x, y, (rqs)) -> - x, y, rqs |> List.map (fun (a,b) -> (a, b, FrameworkRestrictionList []))) + x, y, rqs |> List.map (fun (a,b) -> (a, b, FrameworkRestrictionList [])), RuntimeGraph.Empty) |> Seq.toList let OfGraphWithRestriction (g:seq) : DependencyGraph = g |> Seq.map (fun (x, y, (rqs)) -> - x, y, rqs |> List.map (fun (a,b,c) -> (a, b, c))) + x, y, rqs |> List.map (fun (a,b,c) -> (a, b, c)), RuntimeGraph.Empty) |> Seq.toList let GraphOfNuspecs (g:seq) : DependencyGraph = g |> Seq.map (fun nuspecText -> let nspec = Nuspec.Load("in-memory", nuspecText) - nspec.OfficialName, nspec.Version, nspec.Dependencies |> List.map (fun (a,b,c) -> a.GetCompareString(), b, c)) + nspec.OfficialName, nspec.Version, nspec.Dependencies |> List.map (fun (a,b,c) -> a.GetCompareString(), b, c), RuntimeGraph.Empty) |> Seq.toList +let OfGraphWithRuntimeDeps (g:seq) : DependencyGraph = + g + |> Seq.map (fun (x, y, rqs, run) -> + x, y, rqs |> List.map (fun (a,b) -> (a, b, FrameworkRestrictionList [])), run) + |> Seq.toList + + let PackageDetailsFromGraph (graph : DependencyGraph) sources groupName (package:PackageName) (version:SemVerInfo) = let name,dependencies = graph - |> Seq.filter (fun (p, v, _) -> (PackageName p) = package && SemVer.Parse v = version) - |> Seq.map (fun (n, _, d) -> PackageName n,d |> List.map (fun (x,y,z) -> PackageName x,y,z)) + |> Seq.filter (fun (p, v, _, _) -> (PackageName p) = package && SemVer.Parse v = version) + |> Seq.map (fun (n, _, d, _) -> PackageName n,d |> List.map (fun (x,y,z) -> PackageName x,y,z)) |> Seq.head { Name = name @@ -49,8 +56,8 @@ let PackageDetailsFromGraph (graph : DependencyGraph) sources groupName (package let VersionsFromGraph (graph : DependencyGraph) sources resolverStrategy groupName packageName = let versions = graph - |> Seq.filter (fun (p, _, _) -> (PackageName p) = packageName) - |> Seq.map (fun (_, v, _) -> SemVer.Parse v) + |> Seq.filter (fun (p, _, _, _) -> (PackageName p) = packageName) + |> Seq.map (fun (_, v, _, _) -> SemVer.Parse v) |> Seq.toList |> List.map (fun v -> v,sources) @@ -58,6 +65,16 @@ let VersionsFromGraph (graph : DependencyGraph) sources resolverStrategy groupNa | ResolverStrategy.Max -> List.sortDescending versions | ResolverStrategy.Min -> List.sort versions +let GetRuntimeGraphFromGraph (graph : DependencyGraph) groupName (package:ResolvedPackage) = + graph + |> Seq.filter (fun (p, v, _, r) -> (PackageName p) = package.Name && SemVer.Parse v = package.Version) + |> Seq.map (fun (_, _, _, r) -> r) + |> RuntimeGraph.mergeSeq + // Properly returning None here makes the tests datastructures unneccessary complex. + // It doesn't really matter because Empty is used anyway if all return "None", which is the same as merging a lot of Emtpy graphs... + |> Some + + let VersionsFromGraphAsSeq (graph : DependencyGraph) sources resolverStrategy groupName packageName = VersionsFromGraph graph sources resolverStrategy groupName packageName |> Seq.ofList @@ -81,9 +98,12 @@ let safeResolve graph (dependencies : (string * VersionRange) list) = let resolve graph dependencies = (safeResolve graph dependencies).GetModelOrFail() -let ResolveWithGraph(dependenciesFile:DependenciesFile,getSha1,getVersionsF, getPackageDetailsF) = +let ResolveWithGraphR(dependenciesFile:DependenciesFile,getSha1,getVersionsF, getPackageDetailsF, getRuntimeGraph) = let groups = [Constants.MainDependencyGroup, None ] |> Map.ofSeq - dependenciesFile.Resolve(true,getSha1,getVersionsF,getPackageDetailsF,groups,UpdateMode.UpdateAll) + dependenciesFile.Resolve(true,getSha1,getVersionsF,getPackageDetailsF,getRuntimeGraph,groups,UpdateMode.UpdateAll) + +let ResolveWithGraph(dependenciesFile:DependenciesFile,getSha1,getVersionsF, getPackageDetailsF) = + ResolveWithGraphR(dependenciesFile,getSha1,getVersionsF, getPackageDetailsF, (fun _ _ -> None)) let getVersion (resolved:ResolvedPackage) = resolved.Version.ToString() diff --git a/tests/Paket.Tests/UpdateProcessSpecs.fs b/tests/Paket.Tests/UpdateProcessSpecs.fs index 898013055e..f4b1ef4305 100644 --- a/tests/Paket.Tests/UpdateProcessSpecs.fs +++ b/tests/Paket.Tests/UpdateProcessSpecs.fs @@ -45,6 +45,9 @@ let graph = let getLockFile lockFileData = LockFile.Parse("",toLines lockFileData) let lockFile = lockFileData |> getLockFile +let selectiveUpdateFromGraph graph force lockFile depsFile updateMode restriction = + selectiveUpdate force noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) (GetRuntimeGraphFromGraph graph) lockFile depsFile updateMode restriction + [] let ``SelectiveUpdate does not update any package when it is neither updating all nor selective updating``() = @@ -53,7 +56,7 @@ let ``SelectiveUpdate does not update any package when it is neither updating al nuget Castle.Core-log4net ~> 3.2 nuget FAKE""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile PackageResolver.UpdateMode.Install SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true lockFile dependenciesFile PackageResolver.UpdateMode.Install SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -78,7 +81,7 @@ let ``SelectiveUpdate updates all packages not constraining version``() = nuget Castle.Core-log4net ~> 3.2 nuget FAKE""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -104,7 +107,7 @@ let ``SelectiveUpdate updates all packages constraining version``() = nuget Castle.Core ~> 3.2 nuget FAKE = 4.0.0""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -129,7 +132,7 @@ let ``SelectiveUpdate removes a dependency when it is updated to a version that nuget Castle.Core-log4net nuget FAKE""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -155,7 +158,7 @@ let ``SelectiveUpdate updates a single package``() = nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "FAKE" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -182,7 +185,7 @@ let ``SelectiveUpdate updates a single constrained package``() = nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -210,7 +213,7 @@ let ``SelectiveUpdate updates a single package with constrained dependency in de nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -237,7 +240,7 @@ let ``SelectiveUpdate installs new packages``() = nuget FAKE nuget Newtonsoft.Json""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile PackageResolver.UpdateMode.Install SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true lockFile dependenciesFile PackageResolver.UpdateMode.Install SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -264,7 +267,7 @@ let ``SelectiveUpdate removes a dependency when it updates a single package and nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -292,7 +295,7 @@ let ``SelectiveUpdate does not update when a dependency constrain is not met``() nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -319,7 +322,7 @@ let ``SelectiveUpdate considers package name case difference``() = nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -348,7 +351,7 @@ let ``SelectiveUpdate conflicts when a dependency is contrained``() = nuget FAKE""") (fun () -> - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction |> ignore) |> shouldFail @@ -363,7 +366,7 @@ let ``SelectiveUpdate generates paket.lock correctly``() = nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile + selectiveUpdateFromGraph graph true lockFile dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -438,7 +441,7 @@ let ``SelectiveUpdate updates package that conflicts with a transitive dependenc let packageFilter = PackageName "log4f" |> PackageFilter.ofName let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph2) (PackageDetailsFromGraph graph2) lockFile2 dependenciesFile + selectiveUpdateFromGraph graph2 true lockFile2 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = @@ -469,7 +472,7 @@ let ``SelectiveUpdate updates package that conflicts with a transitive dependenc let packageFilter = PackageName "Ninject.Extensions.Logging.Log4net" |> PackageFilter.ofName let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph2) (PackageDetailsFromGraph graph2) lockFile2 dependenciesFile + selectiveUpdateFromGraph graph2 true lockFile2 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = @@ -527,7 +530,7 @@ let ``SelectiveUpdate updates package that conflicts with a transitive dependenc let packageFilter = PackageName "Ninject.Extensions.Logging.Log4net" |> PackageFilter.ofName let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph3) (PackageDetailsFromGraph graph3) lockFile3 dependenciesFile + selectiveUpdateFromGraph graph3 true lockFile3 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = @@ -560,7 +563,7 @@ let ``SelectiveUpdate does not conflict with a transitive dependency of another let packageFilter = PackageName "Ninject" |> PackageFilter.ofName let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph3) (PackageDetailsFromGraph graph3) lockFile3 dependenciesFile + selectiveUpdateFromGraph graph3 true lockFile3 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = @@ -592,7 +595,7 @@ let ``SelectiveUpdate updates package that conflicts with a deep transitive depe let packageFilter = PackageName "Ninject.Extensions.Interception" |> PackageFilter.ofName let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph3) (PackageDetailsFromGraph graph3) lockFile3 dependenciesFile + selectiveUpdateFromGraph graph3 true lockFile3 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = @@ -645,7 +648,7 @@ let ``SelectiveUpdate updates package that conflicts with a deep transitive depe let packageFilter = PackageName "Ninject.Extensions.Logging.Log4net.Deep" |> PackageFilter.ofName let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph4) (PackageDetailsFromGraph graph4) lockFile4 dependenciesFile + selectiveUpdateFromGraph graph4 true lockFile4 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = @@ -696,7 +699,7 @@ let ``SelectiveUpdate updates package that conflicts with transitive dependency let packageFilter = PackageName "Ninject.Extensions.Logging" |> PackageFilter.ofName let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph5) (PackageDetailsFromGraph graph5) lockFile5 dependenciesFile + selectiveUpdateFromGraph graph5 true lockFile5 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = @@ -734,7 +737,7 @@ let ``SelectiveUpdate updates all packages from all groups if no group is specif nuget Castle.Core-log4net ~> 4.0""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true lockFile dependenciesFile PackageResolver.UpdateMode.UpdateAll SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -785,7 +788,7 @@ let ``SelectiveUpdate updates only packages from specific group if group is spec nuget Castle.Core-log4net""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) groupedLockFile dependenciesFile (PackageResolver.UpdateMode.UpdateGroup Constants.MainDependencyGroup) SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true groupedLockFile dependenciesFile (PackageResolver.UpdateMode.UpdateGroup Constants.MainDependencyGroup) SemVerUpdateMode.NoRestriction let result = groupMap lockFile |> Seq.toList @@ -817,7 +820,7 @@ let ``SelectiveUpdate updates only packages from specified group``() = nuget Castle.Core-log4net""") - let lockFile,_ = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) groupedLockFile dependenciesFile (PackageResolver.UpdateMode.UpdateGroup(GroupName "Group")) SemVerUpdateMode.NoRestriction + let lockFile,_ = selectiveUpdateFromGraph graph true groupedLockFile dependenciesFile (PackageResolver.UpdateMode.UpdateGroup(GroupName "Group")) SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -873,7 +876,7 @@ let ``SelectiveUpdate updates package from a specific group``() = nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile + selectiveUpdateFromGraph graph true lockFile6 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(GroupName "Group", PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -909,7 +912,7 @@ let ``SelectiveUpdate does not remove a dependency from group when it is a top-l nuget log4net""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile + selectiveUpdateFromGraph graph true lockFile6 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(GroupName "Group", PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -944,7 +947,7 @@ let ``SelectiveUpdate updates package from main group``() = nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile + selectiveUpdateFromGraph graph true lockFile6 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -990,7 +993,7 @@ let ``SelectiveUpdate updates package that has a new dependent package that also nuget Package""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph7) (PackageDetailsFromGraph graph7) lockFile7 dependenciesFile + selectiveUpdateFromGraph graph7 true lockFile7 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "Package" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -1024,7 +1027,7 @@ let ``SelectiveUpdate updates early package that has a new dependent package tha nuget APackage""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph7) (PackageDetailsFromGraph graph7) lockFile8 dependenciesFile + selectiveUpdateFromGraph graph7 true lockFile8 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageName "APackage" |> PackageFilter.ofName)) SemVerUpdateMode.NoRestriction let result = @@ -1056,7 +1059,7 @@ let ``SelectiveUpdate with SemVerUpdateMode.Minor updates package from a specifi nuget FAKE""") let lockFile,_ = - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile + selectiveUpdateFromGraph graph true lockFile6 dependenciesFile (PackageResolver.UpdateMode.UpdateFiltered(GroupName "Group", PackageName "Castle.Core-log4net" |> PackageFilter.ofName)) SemVerUpdateMode.KeepMinor let result = groupMap lockFile @@ -1078,7 +1081,7 @@ let ``SelectiveUpdate with SemVerUpdateMode.Minor updates package from a specifi [] let ``adding new group to lockfile should not crash``() = - let update deps lock = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lock deps UpdateMode.Install SemVerUpdateMode.NoRestriction + let update deps lock = selectiveUpdateFromGraph graph true lock deps UpdateMode.Install SemVerUpdateMode.NoRestriction let initialDepsText = """source http://www.nuget.org/api/v2 diff --git a/tests/Paket.Tests/paket.references b/tests/Paket.Tests/paket.references index ccb5bb978f..b458beeccc 100644 --- a/tests/Paket.Tests/paket.references +++ b/tests/Paket.Tests/paket.references @@ -1,5 +1,6 @@ FSharp.Core Chessie +Newtonsoft.Json group Test NUnit