From ba2c5e73233498d330e4b4d10adf684e867e9224 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Wed, 12 Apr 2017 20:03:22 +0200 Subject: [PATCH 01/15] fix whitespace --- src/Paket.Core/InstallModel.fs | 184 ++++++++++++++++----------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 971d041e7f..f761b1fcd3 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -7,14 +7,14 @@ open Paket.Requirements open Logging [] -type Reference = +type Reference = | Library of string | TargetsFile of string | FrameworkAssemblyReference of string member this.LibName = match this with - | Reference.Library lib -> + | Reference.Library lib -> let fi = FileInfo(normalizePath lib) Some(fi.Name.Replace(fi.Extension, "")) | _ -> None @@ -27,10 +27,10 @@ type Reference = member this.ReferenceName = match this with | Reference.FrameworkAssemblyReference name -> name - | Reference.TargetsFile targetsFile -> + | Reference.TargetsFile targetsFile -> let fi = FileInfo(normalizePath targetsFile) fi.Name.Replace(fi.Extension, "") - | Reference.Library lib -> + | Reference.Library lib -> let fi = FileInfo(normalizePath lib) fi.Name.Replace(fi.Extension, "") @@ -40,25 +40,25 @@ type Reference = | Reference.TargetsFile path -> path | Reference.FrameworkAssemblyReference path -> path -type InstallFiles = +type InstallFiles = { References : Reference Set ContentFiles : string Set } [] module InstallFiles = - let empty = + let empty = { References = Set.empty ContentFiles = Set.empty } - let addReference lib (installFiles:InstallFiles) = + 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) = + let addTargetsFile targetsFile (installFiles:InstallFiles) = { installFiles with References = Set.add (Reference.TargetsFile targetsFile) installFiles.References } - let addFrameworkAssemblyReference assemblyName (installFiles:InstallFiles) = + let addFrameworkAssemblyReference assemblyName (installFiles:InstallFiles) = { installFiles with References = Set.add (Reference.FrameworkAssemblyReference assemblyName) installFiles.References } let getFrameworkAssemblies (installFiles:InstallFiles) = @@ -66,15 +66,15 @@ module InstallFiles = |> Set.map (fun r -> r.FrameworkReferenceName) |> Seq.choose id - let mergeWith (that:InstallFiles) (installFiles:InstallFiles) = - { installFiles with + 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.AddFrameworkAssemblyReference assemblyName = InstallFiles.addFrameworkAssemblyReference assemblyName this member this.GetFrameworkAssemblies() = InstallFiles.getFrameworkAssemblies this member this.MergeWith that = InstallFiles.mergeWith that this @@ -85,7 +85,7 @@ type LibFolder = Files : InstallFiles} member this.GetSinglePlatforms() = - this.Targets + this.Targets |> List.choose (function SinglePlatform t -> Some t | _ -> None) @@ -115,7 +115,7 @@ type AnalyzerLib = } /// Represents the contents of a particular package at a particular version. Any install-specific actions like Content files, References, Roslyn Analyzers, MsBuild targets are represented here. -type InstallModel = +type InstallModel = { PackageName : PackageName PackageVersion : SemVerInfo LegacyReferenceFileFolders : LibFolder list @@ -129,28 +129,28 @@ type InstallModel = module InstallModel = open Logging - let emptyModel packageName packageVersion = + let emptyModel packageName packageVersion = { PackageName = packageName PackageVersion = packageVersion LegacyReferenceFileFolders = [] NewReferenceFileFolders = [] - TargetsFileFolders = [] + TargetsFileFolders = [] Analyzers = [] LicenseUrl = None } - let getReferenceFolders (installModel: InstallModel) = + let getReferenceFolders (installModel: InstallModel) = installModel.LegacyReferenceFileFolders @ (installModel.NewReferenceFileFolders |> List.choose (fun r -> match installModel.LegacyReferenceFileFolders |> List.tryFind (fun r2 -> r2.Targets = r.Targets) with | None -> Some r | _ -> None)) - + let extractRefFolder packageName (path:string) = let path = path.Replace("\\", "/").ToLower() Utils.extractPath ("ref", packageName, path) - + let extractLibFolder packageName (path:string) = let path = path.Replace("\\", "/").ToLower() if path.Contains "runtimes" then @@ -160,22 +160,22 @@ module InstallModel = let extractBuildFolder packageName path = Utils.extractPath ("build", packageName, path) - let mapFolders mapfn (installModel:InstallModel) = - { installModel with + let mapFolders mapfn (installModel:InstallModel) = + { installModel with LegacyReferenceFileFolders = List.map mapfn installModel.LegacyReferenceFileFolders NewReferenceFileFolders = List.map mapfn installModel.NewReferenceFileFolders TargetsFileFolders = List.map mapfn installModel.TargetsFileFolders } - - let mapFiles mapfn (installModel:InstallModel) = + + let mapFiles mapfn (installModel:InstallModel) = installModel |> mapFolders (fun folder -> { folder with Files = mapfn folder.Files }) - let private getFileFolders (target:TargetProfile) folderType choosefn = + 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 | None -> Seq.empty - let getLibReferences (target : TargetProfile) installModel = + let getLibReferences (target : TargetProfile) installModel = let results = getFileFolders target (getReferenceFolders installModel) (function Reference.Library lib -> Some lib | _ -> None) |> Seq.cache @@ -183,43 +183,43 @@ module InstallModel = getFileFolders target installModel.LegacyReferenceFileFolders (function Reference.Library lib -> Some lib | _ -> None) else results - let getTargetsFiles (target : TargetProfile) (installModel:InstallModel) = - getFileFolders target installModel.TargetsFileFolders + let getTargetsFiles (target : TargetProfile) (installModel:InstallModel) = + getFileFolders target installModel.TargetsFileFolders (function Reference.TargetsFile targetsFile -> Some targetsFile | _ -> None) - let getPlatformReferences frameworkIdentifier installModel = + let getPlatformReferences frameworkIdentifier installModel = getLibReferences (SinglePlatform frameworkIdentifier) installModel - let getFrameworkAssembliesLazy installModel = + let getFrameworkAssembliesLazy installModel = lazy ([ for lib in getReferenceFolders installModel do yield! lib.Files.GetFrameworkAssemblies()] |> Set.ofList) - let getLibReferencesLazy installModel = + let getLibReferencesLazy installModel = lazy ([ for lib in getReferenceFolders installModel do - yield! lib.Files.References] + yield! lib.Files.References] |> Set.ofList) - let getTargetsFilesLazy (installModel:InstallModel) = + let getTargetsFilesLazy (installModel:InstallModel) = lazy ([ for lib in installModel.TargetsFileFolders do - yield! lib.Files.References] + yield! lib.Files.References] |> Set.ofList) - let removeIfCompletelyEmpty (this:InstallModel) = - if Set.isEmpty (getFrameworkAssembliesLazy this |> force) + let removeIfCompletelyEmpty (this:InstallModel) = + if Set.isEmpty (getFrameworkAssembliesLazy this |> force) && Set.isEmpty (getLibReferencesLazy this |> force) - && Set.isEmpty (getTargetsFilesLazy this |> force) + && Set.isEmpty (getTargetsFilesLazy this |> force) && List.isEmpty this.Analyzers then emptyModel this.PackageName this.PackageVersion else this let calcLibFoldersG extract packageName libs = - libs + libs |> List.choose (extract packageName) - |> List.distinct - |> List.sort - |> PlatformMatching.getSupportedTargetProfiles + |> List.distinct + |> List.sort + |> PlatformMatching.getSupportedTargetProfiles |> Seq.map (fun entry -> { Name = entry.Key; Targets = entry.Value; Files = InstallFiles.empty }) |> Seq.toList @@ -227,34 +227,34 @@ module InstallModel = let calcRefFolders = calcLibFoldersG extractRefFolder let addFileToFolder (path:LibFolder) (file:string) (folders:LibFolder list) (addfn: string -> InstallFiles -> InstallFiles) = - folders - |> List.map (fun p -> + folders + |> List.map (fun p -> if p.Name <> path.Name then p else - { p with Files = addfn file p.Files }) - + { p with Files = addfn file p.Files }) + let private addPackageFile (path:LibFolder) (file:string) references (this:InstallModel) : InstallModel = - let install = + let install = match references with | NuspecReferences.All -> true | NuspecReferences.Explicit list -> List.exists file.EndsWith list if not install then this else - { this with + { this with LegacyReferenceFileFolders = addFileToFolder path file this.LegacyReferenceFileFolders InstallFiles.addReference } - + let private addPackageRefFile (path:LibFolder) (file:string) references (this:InstallModel) : InstallModel = - let install = + let install = match references with | NuspecReferences.All -> true | NuspecReferences.Explicit list -> List.exists file.EndsWith list if not install then this else - { this with + { this with NewReferenceFileFolders = addFileToFolder path file this.NewReferenceFileFolders InstallFiles.addReference } let addLibReferences libs references (installModel:InstallModel) : InstallModel = let libs = libs |> Seq.toList - let libFolders = calcLibFolders installModel.PackageName libs + let libFolders = calcLibFolders installModel.PackageName libs let refFolders = calcRefFolders installModel.PackageName libs let addItem extract addFunc getFolder initialState = @@ -265,7 +265,7 @@ module InstallModel = | Some path -> addFunc path file references model | _ -> model | None -> model) initialState libs - + let newState = addItem extractLibFolder addPackageFile (fun i -> i.LegacyReferenceFileFolders) { installModel with LegacyReferenceFileFolders = libFolders } addItem extractRefFolder addPackageRefFile (fun i -> i.NewReferenceFileFolders) { newState with NewReferenceFileFolders = refFolders } @@ -279,7 +279,7 @@ module InstallModel = let rec addTargetsFile (path:LibFolder) (file:string) (installModel:InstallModel) :InstallModel = - { installModel with + { installModel with TargetsFileFolders = addFileToFolder path file installModel.TargetsFileFolders InstallFiles.addTargetsFile } @@ -292,25 +292,25 @@ module InstallModel = |> List.exists (fun restriction -> match restriction with | FrameworkRestriction.Portable _ -> - folder.Targets + folder.Targets |> List.exists (fun target -> match target with | SinglePlatform _ -> false | _ -> true) | FrameworkRestriction.Exactly target -> - folder.GetSinglePlatforms() + folder.GetSinglePlatforms() |> List.exists ((=) target) | FrameworkRestriction.AtLeast target -> - folder.GetSinglePlatforms() + folder.GetSinglePlatforms() |> List.exists (fun t -> t >= target && t.IsSameCategoryAs(target)) | FrameworkRestriction.Between(min,max) -> - folder.GetSinglePlatforms() + folder.GetSinglePlatforms() |> List.exists (fun t -> t >= min && t < max && t.IsSameCategoryAs(min))) - - let model = + + let model = if List.isEmpty installModel.LegacyReferenceFileFolders then let folders = calcLibFolders installModel.PackageName ["lib/Default.dll"] - { installModel with LegacyReferenceFileFolders = folders } + { installModel with LegacyReferenceFileFolders = folders } else installModel @@ -320,10 +320,10 @@ module InstallModel = else folder) - let addFrameworkAssemblyReferences references (installModel:InstallModel) : InstallModel = - references |> Seq.fold addFrameworkAssemblyReference (installModel:InstallModel) + let addFrameworkAssemblyReferences references (installModel:InstallModel) : InstallModel = + references |> Seq.fold addFrameworkAssemblyReference (installModel:InstallModel) - let filterExcludes excludes (installModel:InstallModel) = + let filterExcludes excludes (installModel:InstallModel) = let excluded e reference = match reference with | Reference.Library x -> x.Contains e @@ -335,11 +335,11 @@ module InstallModel = mapFiles (fun files -> { files with References = Set.filter (excluded fileName >> not) files.References }) model) installModel - let filterBlackList (installModel: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 -> + | Reference.TargetsFile targetsFile -> (not (String.endsWithIgnoreCase ".props" targetsFile|| String.endsWithIgnoreCase ".targets" targetsFile)) | _ -> false @@ -347,7 +347,7 @@ module InstallModel = | Reference.Library lib -> lib.EndsWith ".resources.dll" | _ -> false - let blackList = + let blackList = [ includeReferences excludeSatelliteAssemblies] @@ -364,28 +364,28 @@ module InstallModel = let applRestriction folder = { folder with Targets = applyRestrictionsToTargets restrictions folder.Targets} - { installModel with - LegacyReferenceFileFolders = + { installModel with + LegacyReferenceFileFolders = installModel.LegacyReferenceFileFolders |> List.map applRestriction - |> List.filter (fun folder -> folder.Targets <> []) + |> List.filter (fun folder -> folder.Targets <> []) - NewReferenceFileFolders = + NewReferenceFileFolders = installModel.NewReferenceFileFolders |> List.map applRestriction - |> List.filter (fun folder -> folder.Targets <> []) + |> List.filter (fun folder -> folder.Targets <> []) - TargetsFileFolders = + TargetsFileFolders = installModel.TargetsFileFolders |> List.map applRestriction |> List.filter (fun folder -> folder.Targets <> []) } let rec addTargetsFiles (targetsFiles:string list) (this:InstallModel) : InstallModel = - let targetsFileFolders = - targetsFiles + let targetsFileFolders = + targetsFiles |> List.choose (extractBuildFolder this.PackageName) - |> List.distinct - |> PlatformMatching.getSupportedTargetProfiles + |> List.distinct + |> PlatformMatching.getSupportedTargetProfiles |> Seq.map (fun entry -> { Name = entry.Key; Targets = List.ofSeq entry.Value; Files = InstallFiles.empty }) |> Seq.toList @@ -396,24 +396,24 @@ module InstallModel = | Some path -> addTargetsFile path file model | _ -> model | None -> model) { this with TargetsFileFolders = targetsFileFolders } targetsFiles - + 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) + let inline mapfn (files:InstallFiles) = + { files with + References = files.References |> Set.filter (fun reference -> Set.contains reference.ReferenceName references |> not) } mapFiles mapfn this let addLicense url (model: InstallModel) = - if String.IsNullOrWhiteSpace url then model + if String.IsNullOrWhiteSpace url then model else { model with LicenseUrl = Some url } - let createFromLibs packageName packageVersion frameworkRestrictions libs targetsFiles analyzerFiles (nuspec:Nuspec) = + let createFromLibs packageName packageVersion frameworkRestrictions libs targetsFiles analyzerFiles (nuspec:Nuspec) = emptyModel packageName packageVersion |> addLibReferences libs nuspec.References |> addTargetsFiles targetsFiles - |> addAnalyzerFiles analyzerFiles + |> addAnalyzerFiles analyzerFiles |> addFrameworkAssemblyReferences nuspec.FrameworkAssemblyReferences |> filterBlackList |> applyFrameworkRestrictions frameworkRestrictions @@ -430,17 +430,17 @@ type InstallModel with member this.MapFiles mapfn = InstallModel.mapFiles mapfn this - member this.GetLibReferences target = InstallModel.getLibReferences target this + member this.GetLibReferences target = InstallModel.getLibReferences target this member this.GetLibReferences frameworkIdentifier = InstallModel.getPlatformReferences frameworkIdentifier this member this.GetTargetsFiles target = InstallModel.getTargetsFiles target this - member this.GetFrameworkAssembliesLazy = InstallModel.getFrameworkAssembliesLazy this + member this.GetFrameworkAssembliesLazy = InstallModel.getFrameworkAssembliesLazy this - member this.GetLibReferencesLazy = InstallModel.getLibReferencesLazy this + member this.GetLibReferencesLazy = InstallModel.getLibReferencesLazy this - member this.GetTargetsFilesLazy = InstallModel.getTargetsFilesLazy this + member this.GetTargetsFilesLazy = InstallModel.getTargetsFilesLazy this member this.CalcLibFolders libs = InstallModel.calcLibFolders libs @@ -453,11 +453,11 @@ type InstallModel with member this.AddTargetsFile(path, file) = InstallModel.addTargetsFile path file this member this.AddTargetsFiles targetsFiles = InstallModel.addTargetsFiles targetsFiles this - - member this.AddFrameworkAssemblyReference reference = InstallModel.addFrameworkAssemblyReference this reference + + member this.AddFrameworkAssemblyReference reference = InstallModel.addFrameworkAssemblyReference this reference member this.AddFrameworkAssemblyReferences references = InstallModel.addFrameworkAssemblyReferences references this - + member this.FilterBlackList () = InstallModel.filterBlackList this member this.FilterExcludes excludes = InstallModel.filterExcludes excludes this @@ -467,6 +467,6 @@ type InstallModel with member this.ApplyFrameworkRestrictions restrictions = InstallModel.applyFrameworkRestrictions restrictions this member this.RemoveIfCompletelyEmpty() = InstallModel.removeIfCompletelyEmpty this - - static member CreateFromLibs(packageName, packageVersion, frameworkRestrictions:FrameworkRestriction list, libs, targetsFiles, analyzerFiles, nuspec : Nuspec) = - InstallModel.createFromLibs packageName packageVersion frameworkRestrictions libs targetsFiles analyzerFiles nuspec + + static member CreateFromLibs(packageName, packageVersion, frameworkRestrictions:FrameworkRestriction list, libs, targetsFiles, analyzerFiles, nuspec : Nuspec) = + InstallModel.createFromLibs packageName packageVersion frameworkRestrictions libs targetsFiles analyzerFiles nuspec From 270537a0c07f4bdc326dac72f2c09d491f4b2841 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Thu, 13 Apr 2017 22:47:48 +0200 Subject: [PATCH 02/15] revert some latest changes and start from scratch --- src/Paket.Core/InstallModel.fs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index f761b1fcd3..6c0a97f716 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -127,6 +127,8 @@ type InstallModel = [] module InstallModel = + // A lot of insights can be gained from https://github.com/NuGet/NuGet.Client/blob/85731166154d0818d79a19a6d2417de6aa851f39/src/NuGet.Core/NuGet.Packaging/ContentModel/ManagedCodeConventions.cs#L385-L505 + // if you read this update the hash ;) open Logging let emptyModel packageName packageVersion = @@ -139,13 +141,14 @@ module InstallModel = LicenseUrl = None } let getReferenceFolders (installModel: InstallModel) = - installModel.LegacyReferenceFileFolders @ - (installModel.NewReferenceFileFolders - |> List.choose (fun r -> - match installModel.LegacyReferenceFileFolders |> List.tryFind (fun r2 -> r2.Targets = r.Targets) with - | None -> Some r - | _ -> None)) - + if installModel.NewReferenceFileFolders.IsEmpty then + installModel.LegacyReferenceFileFolders + else installModel.NewReferenceFileFolders + + let getLibraryFolders (installModel: InstallModel) = + if installModel.NewReferenceFileFolders.IsEmpty then + installModel.LegacyReferenceFileFolders + else installModel.NewReferenceFileFolders let extractRefFolder packageName (path:string) = let path = path.Replace("\\", "/").ToLower() From cc44e8f3cd31437d54cc241acd510e76c1abd0e0 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Fri, 14 Apr 2017 13:35:50 +0200 Subject: [PATCH 03/15] dotnetcore support: Step1 - Introduce UnparsedPackageFile to make the parsing logic simpler in future steps. --- src/Paket.Core/InstallModel.fs | 45 +- src/Paket.Core/InstallProcess.fs | 4 +- src/Paket.Core/NuGetV2.fs | 4 +- src/Paket.Core/PublicAPI.fs | 1 - src/Paket.Core/Queries.fs | 1 - src/Paket/Paket.fsproj | 4 +- .../InstallModel/ProcessingSpecs.fs | 384 +++++++++--------- .../InstallModel/Xml/CodeCracker.fs | 11 +- .../InstallModel/Xml/FSharp.Data.SqlClient.fs | 9 +- .../Paket.Tests/InstallModel/Xml/Fantomas.fs | 36 +- .../InstallModel/Xml/FantomasLib.fs | 2 +- tests/Paket.Tests/InstallModel/Xml/Fuchu.fs | 6 +- .../InstallModel/Xml/GitInfoPlanter.fs | 3 +- .../InstallModel/Xml/LibGit2Sharp.fs | 6 +- .../InstallModel/Xml/ManualNodes.fs | 30 +- .../InstallModel/Xml/Microsoft.Bcl.Build.fs | 7 +- .../Xml/Microsoft.CodeAnalysis.Analyzers.fs | 2 +- tests/Paket.Tests/InstallModel/Xml/Plossum.fs | 3 +- .../InstallModel/Xml/RefactoringEssentials.fs | 8 +- tests/Paket.Tests/InstallModel/Xml/RxXaml.fs | 15 +- tests/Paket.Tests/InstallModel/Xml/SQLite.fs | 17 +- .../InstallModel/Xml/StyleCop.MSBuild.fs | 2 +- ...System.Security.Cryptography.Algorithms.fs | 23 +- .../InstallModel/Xml/System.Spatial.fs | 2 +- .../InstallModel/Xml/SystemNetHttp.fs | 50 +-- .../InstallModel/Xml/SystemNetHttpForNet4.fs | 44 +- ...mNetHttpWithExistingFrameworkReferences.fs | 15 +- .../SystemNetHttpWithFrameworkReferences.fs | 14 +- .../InstallModel/Xml/xunit.runner.fs | 8 +- 29 files changed, 395 insertions(+), 361 deletions(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 6c0a97f716..12077595d6 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -6,6 +6,11 @@ open Paket.Domain open Paket.Requirements open Logging +// 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 } + [] type Reference = | Library of string @@ -150,18 +155,18 @@ module InstallModel = installModel.LegacyReferenceFileFolders else installModel.NewReferenceFileFolders - let extractRefFolder packageName (path:string) = - let path = path.Replace("\\", "/").ToLower() + let extractRefFolder packageName (path:UnparsedPackageFile) = + let path = path.FullPath.Replace("\\", "/").ToLower() Utils.extractPath ("ref", packageName, path) - let extractLibFolder packageName (path:string) = - let path = path.Replace("\\", "/").ToLower() + let extractLibFolder packageName (path:UnparsedPackageFile) = + let path = path.FullPath.Replace("\\", "/").ToLower() if path.Contains "runtimes" then Utils.extractPath ("runtimes", packageName, path) else Utils.extractPath ("lib", packageName, path) - let extractBuildFolder packageName path = Utils.extractPath ("build", packageName, path) + let extractBuildFolder packageName (path:UnparsedPackageFile) = Utils.extractPath ("build", packageName, path.FullPath) let mapFolders mapfn (installModel:InstallModel) = { installModel with @@ -217,7 +222,7 @@ module InstallModel = else this - let calcLibFoldersG extract packageName libs = + let calcLibFoldersG extract packageName (libs:UnparsedPackageFile list) = libs |> List.choose (extract packageName) |> List.distinct @@ -229,33 +234,33 @@ module InstallModel = let calcLibFolders = calcLibFoldersG extractLibFolder let calcRefFolders = calcLibFoldersG extractRefFolder - let addFileToFolder (path:LibFolder) (file:string) (folders:LibFolder list) (addfn: string -> InstallFiles -> InstallFiles) = + let addFileToFolder (path:LibFolder) (file:UnparsedPackageFile) (folders:LibFolder list) (addfn: string -> InstallFiles -> InstallFiles) = folders |> List.map (fun p -> if p.Name <> path.Name then p else - { p with Files = addfn file p.Files }) + { p with Files = addfn file.FullPath p.Files }) - let private addPackageFile (path:LibFolder) (file:string) references (this:InstallModel) : InstallModel = + let private addPackageFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true - | NuspecReferences.Explicit list -> List.exists file.EndsWith list + | NuspecReferences.Explicit list -> List.exists file.FullPath.EndsWith list if not install then this else { this with LegacyReferenceFileFolders = addFileToFolder path file this.LegacyReferenceFileFolders InstallFiles.addReference } - let private addPackageRefFile (path:LibFolder) (file:string) references (this:InstallModel) : InstallModel = + let private addPackageRefFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true - | NuspecReferences.Explicit list -> List.exists file.EndsWith list + | NuspecReferences.Explicit list -> List.exists file.FullPath.EndsWith list if not install then this else { this with NewReferenceFileFolders = addFileToFolder path file this.NewReferenceFileFolders InstallFiles.addReference } - let addLibReferences libs references (installModel:InstallModel) : InstallModel = + let addLibReferences (libs:UnparsedPackageFile seq) references (installModel:InstallModel) : InstallModel = let libs = libs |> Seq.toList let libFolders = calcLibFolders installModel.PackageName libs let refFolders = calcRefFolders installModel.PackageName libs @@ -272,16 +277,16 @@ module InstallModel = let newState = addItem extractLibFolder addPackageFile (fun i -> i.LegacyReferenceFileFolders) { installModel with LegacyReferenceFileFolders = libFolders } addItem extractRefFolder addPackageRefFile (fun i -> i.NewReferenceFileFolders) { newState with NewReferenceFileFolders = refFolders } - let addAnalyzerFiles (analyzerFiles:string seq) (installModel:InstallModel) : InstallModel = + let addAnalyzerFiles (analyzerFiles:UnparsedPackageFile seq) (installModel:InstallModel) : InstallModel = let analyzerLibs = analyzerFiles - |> Seq.map (fun file -> FileInfo file |> AnalyzerLib.FromFile) + |> Seq.map (fun file -> FileInfo file.FullPath |> AnalyzerLib.FromFile) |> List.ofSeq { installModel with Analyzers = installModel.Analyzers @ analyzerLibs} - let rec addTargetsFile (path:LibFolder) (file:string) (installModel:InstallModel) :InstallModel = + let rec addTargetsFile (path:LibFolder) (file:UnparsedPackageFile) (installModel:InstallModel) :InstallModel = { installModel with TargetsFileFolders = addFileToFolder path file installModel.TargetsFileFolders InstallFiles.addTargetsFile } @@ -312,7 +317,7 @@ module InstallModel = let model = if List.isEmpty installModel.LegacyReferenceFileFolders then - let folders = calcLibFolders installModel.PackageName ["lib/Default.dll"] + let folders = calcLibFolders installModel.PackageName [{ FullPath ="lib/Default.dll"; PathWithinPackage = "lib/Default.dll" }] { installModel with LegacyReferenceFileFolders = folders } else installModel @@ -383,7 +388,7 @@ module InstallModel = |> List.map applRestriction |> List.filter (fun folder -> folder.Targets <> []) } - let rec addTargetsFiles (targetsFiles:string list) (this:InstallModel) : InstallModel = + let rec addTargetsFiles (targetsFiles:UnparsedPackageFile list) (this:InstallModel) : InstallModel = let targetsFileFolders = targetsFiles |> List.choose (extractBuildFolder this.PackageName) @@ -412,7 +417,7 @@ module InstallModel = if String.IsNullOrWhiteSpace url then model else { model with LicenseUrl = Some url } - let createFromLibs packageName packageVersion frameworkRestrictions libs targetsFiles analyzerFiles (nuspec:Nuspec) = + let createFromLibs packageName packageVersion frameworkRestrictions (libs:UnparsedPackageFile seq) targetsFiles analyzerFiles (nuspec:Nuspec) = emptyModel packageName packageVersion |> addLibReferences libs nuspec.References |> addTargetsFiles targetsFiles @@ -471,5 +476,5 @@ type InstallModel with member this.RemoveIfCompletelyEmpty() = InstallModel.removeIfCompletelyEmpty this - static member CreateFromLibs(packageName, packageVersion, frameworkRestrictions:FrameworkRestriction list, libs, targetsFiles, analyzerFiles, nuspec : Nuspec) = + static member CreateFromLibs(packageName, packageVersion, frameworkRestrictions:FrameworkRestriction list, libs : UnparsedPackageFile seq, targetsFiles, analyzerFiles, nuspec : Nuspec) = InstallModel.createFromLibs packageName packageVersion frameworkRestrictions libs targetsFiles analyzerFiles nuspec diff --git a/src/Paket.Core/InstallProcess.fs b/src/Paket.Core/InstallProcess.fs index a1beb9d7a1..33379f37b4 100644 --- a/src/Paket.Core/InstallProcess.fs +++ b/src/Paket.Core/InstallProcess.fs @@ -161,9 +161,7 @@ let CreateInstallModel(alternativeProjectRoot, root, groupName, sources, caches, async { let! (package, files, targetsFiles, analyzerFiles) = RestoreProcess.ExtractPackage(alternativeProjectRoot, root, groupName, sources, caches, force, package, false) let nuspec = Nuspec.Load(root,groupName,package.Version,defaultArg package.Settings.IncludeVersionInPath false,package.Name) - let files = files |> Array.map (fun fi -> fi.FullName) - let targetsFiles = targetsFiles |> Array.map (fun fi -> fi.FullName) |> Array.toList - let analyzerFiles = analyzerFiles |> Array.map (fun fi -> fi.FullName) + let targetsFiles = targetsFiles |> Array.toList let model = InstallModel.CreateFromLibs(package.Name, package.Version, package.Settings.FrameworkRestrictions |> getRestrictionList, files, targetsFiles, analyzerFiles, nuspec) return (groupName,package.Name), (package,model) } diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index b80ef3dfe8..6521891425 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -613,6 +613,8 @@ let private getFilesMatching targetFolder searchPattern subFolderName filesDescr dir.GetDirectories() |> Array.filter (fun fi -> String.equalsIgnoreCase fi.FullName path) |> Array.collect (fun dir -> dir.GetFiles(searchPattern, SearchOption.AllDirectories)) + |> Array.map (fun file -> + { UnparsedPackageFile.FullPath = file.FullName; UnparsedPackageFile.PathWithinPackage = file.FullName.Substring(dir.FullName.Length) }) else [||] @@ -620,7 +622,7 @@ let private getFilesMatching targetFolder searchPattern subFolderName filesDescr if Array.isEmpty files then verbosefn "No %s found in %s matching %s" filesDescriptionForVerbose targetFolder searchPattern else - let s = String.Join(Environment.NewLine + " - ",files |> Array.map (fun l -> l.FullName)) + let s = String.Join(Environment.NewLine + " - ",files |> Array.map (fun l -> l.FullPath)) verbosefn "%s found in %s matching %s:%s - %s" filesDescriptionForVerbose targetFolder searchPattern Environment.NewLine s files diff --git a/src/Paket.Core/PublicAPI.fs b/src/Paket.Core/PublicAPI.fs index d9266035ed..c93fef1497 100644 --- a/src/Paket.Core/PublicAPI.fs +++ b/src/Paket.Core/PublicAPI.fs @@ -435,7 +435,6 @@ type Dependencies(dependenciesFileName: string) = let nuspec = FileInfo(sprintf "%s/packages%s/%O/%O.nuspec" this.RootPath groupFolder packageName packageName) let nuspec = Nuspec.Load nuspec.FullName let files = NuGetV2.GetLibFiles(folder.FullName) - let files = files |> Array.map (fun fi -> fi.FullName) InstallModel.CreateFromLibs(packageName, resolvedPackage.Version, [], files, [], [], nuspec) /// Returns all libraries for the given package and framework. diff --git a/src/Paket.Core/Queries.fs b/src/Paket.Core/Queries.fs index b16eb842cf..b9a18a66a2 100644 --- a/src/Paket.Core/Queries.fs +++ b/src/Paket.Core/Queries.fs @@ -73,7 +73,6 @@ let getInstalledPackageModel (lockFile: LockFile) (QualifiedPackageName(groupNam let nuspec = FileInfo(sprintf "%s/packages%s/%O/%O.nuspec" lockFile.RootPath groupFolder packageName packageName) let nuspec = Nuspec.Load nuspec.FullName let files = NuGetV2.GetLibFiles(folder.FullName) - let files = files |> Array.map (fun fi -> fi.FullName) InstallModel.CreateFromLibs(packageName, resolvedPackage.Version, [], files, [], [], nuspec) let resolveFrameworkForScriptGeneration (dependencies: DependenciesFile) = lazy ( diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index ff9857a61a..87dbf7a789 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -37,8 +37,8 @@ D:\temp\coreclrtest install C:\dev\src\Paket\integrationtests\scenarios\loading-scripts\dependencies-file-flag\temp - convert-from-nuget - c:\users\lr\documents\visual studio 2017\Projects\PaketTest + update + C:\PROJ\paket.test\ pdbonly diff --git a/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs b/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs index 2242a5b81a..dc10f6f447 100644 --- a/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs +++ b/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs @@ -9,9 +9,16 @@ open System.IO let emptymodel = InstallModel.EmptyModel(PackageName "Unknown",SemVer.Parse "0.1") +let fromLegacyList (prefix:string) l = + l + |> List.map (fun (i:string) -> + if i.StartsWith prefix then + { FullPath = i; PathWithinPackage = i.Substring(prefix.Length) } + else failwithf "Expected '%s' to start with '%s'" i prefix) + [] let ``should create empty model with net40, net45 ...``() = - let model = emptymodel.AddReferences [ @"..\Rx-Main\lib\net40\Rx.dll"; @"..\Rx-Main\lib\net45\Rx.dll" ] + let model = emptymodel.AddReferences ([ @"..\Rx-Main\lib\net40\Rx.dll"; @"..\Rx-Main\lib\net45\Rx.dll" ] |> fromLegacyList @"..\Rx-Main\") let targets = model.LegacyReferenceFileFolders @@ -23,20 +30,20 @@ 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" ] + 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" [] let ``should understand lib in lib.dll``() = - let model = emptymodel.AddReferences [ @"..\FunScript.TypeScript\lib\net40\FunScript.TypeScript.Binding.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" [] let ``should understand libuv in runtimes``() = - let model = emptymodel.AddReferences [ @"..\Microsoft.AspNetCore.Server.Kestrel\runtimes\win7-x64\native\libuv.dll"; ] + 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" @@ -44,9 +51,9 @@ let ``should understand libuv in runtimes``() = let ``should understand reference folder``() = let model = emptymodel.AddReferences - [ @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" + ([ @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" ] + @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" ] |> fromLegacyList @"..\System.Security.Cryptography.Algorithms\") let refs = model.GetLibReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" @@ -65,9 +72,9 @@ let ``should understand reference folder``() = let model = emptymodel.AddReferences - [ @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" + ([ @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\lib\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.GetLibReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) refs |> shouldNotContain @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" @@ -81,21 +88,21 @@ let ``should understand reference folder``() = [] let ``should understand aot in runtimes``() = - let model = emptymodel.AddReferences [ @"..\packages\System.Diagnostics.Contracts\runtimes\aot\lib\netcore50\System.Diagnostics.Contracts.dll"; ] + 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 ``should understand mylib in mylib.dll``() = - let model = emptymodel.AddReferences [ @"c:/users/username/workspace/myproject/packages/mylib.mylib/lib/net45/mylib.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" [] 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" ]) + 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" @@ -106,7 +113,7 @@ let ``should add net35 if we have net20 and net40``() = [] let ``should put _._ files into right buckets``() = - let model = emptymodel.AddReferences [ @"..\Rx-Main\lib\net40\_._"; @"..\Rx-Main\lib\net20\_._" ] + 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\_._" @@ -114,7 +121,7 @@ let ``should put _._ files into right buckets``() = [] let ``should inherit _._ files to higher frameworks``() = let model = - emptymodel.AddReferences([ @"..\Rx-Main\lib\net40\_._"; @"..\Rx-Main\lib\net20\_._" ]) + 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\_._" @@ -126,7 +133,7 @@ let ``should inherit _._ files to higher frameworks``() = [] let ``should skip buckets which contain placeholder while adjusting upper versions``() = let model = - emptymodel.AddReferences([ @"..\Rx-Main\lib\net20\Rx.dll"; @"..\Rx-Main\lib\net40\_._"; ]) + 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" @@ -136,7 +143,7 @@ let ``should skip buckets which contain placeholder while adjusting upper versio [] let ``should filter _._ when processing blacklist``() = let model = - emptymodel.AddReferences([ @"..\Rx-Main\lib\net40\_._"; @"..\Rx-Main\lib\net20\_._" ]) + 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\_._" @@ -145,7 +152,7 @@ let ``should filter _._ when processing blacklist``() = [] let ``should install single client profile lib for everything``() = let model = - emptymodel.AddReferences([ @"..\Castle.Core\lib\net40-client\Castle.Core.dll" ]) + 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" @@ -156,8 +163,8 @@ let ``should install single client profile lib for everything``() = let ``should install net40 for client profile``() = let model = emptymodel.AddReferences( - [ @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" - @"..\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll"]) + [ @"..\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" @@ -167,8 +174,8 @@ let ``should install net40 for client profile``() = let ``should install not use net40-full for client profile``() = let model = emptymodel.AddReferences( - [ @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" - @"..\Newtonsoft.Json\lib\net40-full\Newtonsoft.Json.dll"]) + [ @"..\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" @@ -178,13 +185,13 @@ let ``should install not use net40-full for client profile``() = let ``should handle lib install of Microsoft.Net.Http for .NET 4.5``() = let model = emptymodel.AddReferences( - [ @"..\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\net45\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\lib\") model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldNotContain @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.dll" @@ -197,15 +204,15 @@ let ``should handle lib install of Microsoft.Net.Http for .NET 4.5``() = [] let ``should add portable lib``() = - let model = - emptymodel.AddReferences([ @"..\Jint\lib\portable-net40+sl50+win+wp80\Jint.dll" ]) + 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" [] 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" ]) + 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" @@ -216,13 +223,13 @@ let ``should handle lib install of Jint for NET >= 40 and SL >= 50``() = [] let ``should handle lib install of Microsoft.BCL for NET >= 40``() = - let model = + let model = emptymodel.AddReferences( - [ @"..\Microsoft.Bcl\lib\net40\System.IO.dll" - @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + [ @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" - @"..\Microsoft.Bcl\lib\net45\_._" ]) + @"..\Microsoft.Bcl\lib\net45\_._" ] |> fromLegacyList @"..\Microsoft.Bcl\") .FilterBlackList() model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) |> shouldNotContain @"..\Microsoft.Bcl\lib\net40\System.IO.dll" @@ -236,15 +243,15 @@ let ``should handle lib install of Microsoft.BCL for NET >= 40``() = [] -let ``should skip lib install of Microsoft.BCL for monotouch and monoandroid``() = - let model = +let ``should skip lib install of Microsoft.BCL for monotouch and monoandroid``() = + let model = emptymodel.AddReferences( - [ @"..\Microsoft.Bcl\lib\net40\System.IO.dll" - @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" - @"..\Microsoft.Bcl\lib\monoandroid\_._" - @"..\Microsoft.Bcl\lib\monotouch\_._" - @"..\Microsoft.Bcl\lib\net45\_._" ]) + [ @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + @"..\Microsoft.Bcl\lib\monoandroid\_._" + @"..\Microsoft.Bcl\lib\monotouch\_._" + @"..\Microsoft.Bcl\lib\net45\_._" ] |> fromLegacyList @"..\Microsoft.Bcl\") .FilterBlackList() model.GetLibReferences(SinglePlatform MonoAndroid) |> shouldBeEmpty @@ -252,16 +259,16 @@ let ``should skip lib install of Microsoft.BCL for monotouch and monoandroid``() [] let ``should not use portable-net40 if we have net40``() = - let model = + let model = emptymodel.AddReferences( - [ @"..\Microsoft.Bcl\lib\net40\System.IO.dll" - @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + [ @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + + @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" + @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" ] |> fromLegacyList @"..\Microsoft.Bcl\") - @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" - @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" ]) - 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" @@ -273,7 +280,7 @@ let ``should not use portable-net40 if we have net40``() = [] let ``should handle lib install of DotNetZip 1.9.3``() = - let model = emptymodel.AddReferences([ @"..\DotNetZip\lib\net20\Ionic.Zip.dll" ]) + 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" @@ -282,7 +289,7 @@ let ``should handle lib install of DotNetZip 1.9.3``() = [] let ``should handle lib install of NUnit 2.6 for windows 8``() = - let model = emptymodel.AddReferences([ @"..\NUnit\lib\nunit.framework.dll" ]) + 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" @@ -291,34 +298,34 @@ let ``should handle lib install of NUnit 2.6 for windows 8``() = [] let ``should handle lib install of Microsoft.Net.Http 2.2.28``() = - let model = + let model = emptymodel.AddReferences( - [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" + [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" + + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" + + @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll" - @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ]) + + @"..\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" @@ -356,40 +363,40 @@ let ``should handle lib install of Microsoft.Net.Http 2.2.28``() = [] let ``should handle lib install of MicrosoftBcl``() = - let model = + let model = emptymodel.AddReferences( - [ @"..\Microsoft.Net.Http\lib\monoandroid\_._" - - @"..\Microsoft.Net.Http\lib\monotouch\_._" + [ @"..\Microsoft.Net.Http\lib\monoandroid\_._" - @"..\Microsoft.Bcl\lib\net40\System.IO.dll" + @"..\Microsoft.Net.Http\lib\monotouch\_._" + + @"..\Microsoft.Bcl\lib\net40\System.IO.dll" @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" + @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" @"..\Microsoft.Net.Http\lib\net45\_._" - @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" - @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" + @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" + @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Threading.Tasks.dll" + + @"..\Microsoft.Bcl\lib\sl4\System.IO.dll" + @"..\Microsoft.Bcl\lib\sl4\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\sl4\System.Threading.Tasks.dll" - @"..\Microsoft.Bcl\lib\sl4\System.IO.dll" - @"..\Microsoft.Bcl\lib\sl4\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\sl4\System.Threading.Tasks.dll" + @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.IO.dll" + @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Threading.Tasks.dll" - @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.IO.dll" - @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\sl4-windowsphone71\System.Threading.Tasks.dll" + @"..\Microsoft.Bcl\lib\sl5\System.IO.dll" + @"..\Microsoft.Bcl\lib\sl5\System.Runtime.dll" + @"..\Microsoft.Bcl\lib\sl5\System.Threading.Tasks.dll" - @"..\Microsoft.Bcl\lib\sl5\System.IO.dll" - @"..\Microsoft.Bcl\lib\sl5\System.Runtime.dll" - @"..\Microsoft.Bcl\lib\sl5\System.Threading.Tasks.dll" - @"..\Microsoft.Bcl\lib\win8\_._" @"..\Microsoft.Bcl\lib\wp8\_._" @"..\Microsoft.Bcl\lib\wpa81\_._" @"..\Microsoft.Bcl\lib\portable-net451+win81\_._" @"..\Microsoft.Bcl\lib\portable-net451+win81+wpa81\_._" - ]).FilterBlackList() + ] |> 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" @@ -424,11 +431,11 @@ let ``should handle lib install of MicrosoftBcl``() = [] let ``should handle lib install of Fantomas 1.5``() = - let model = + let model = emptymodel.AddReferences( - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ]) + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\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" @@ -444,13 +451,13 @@ let ``should handle lib install of Fantomas 1.5``() = [] let ``should handle lib install of Fantomas 1.5.0 with explicit references``() = - let model = + let model = emptymodel.AddLibReferences( - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\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" @@ -466,12 +473,12 @@ let ``should handle lib install of Fantomas 1.5.0 with explicit references``() = [] let ``should only handle dll and exe files``() = - let model = + let model = emptymodel.AddLibReferences( - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FantomasLib.xml" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FantomasLib.xml" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\", NuspecReferences.All) .FilterBlackList() @@ -482,11 +489,11 @@ let ``should only handle dll and exe files``() = [] let ``should use portable net40 in net45 when don't have other files``() = - let model = + let model = emptymodel.AddLibReferences( - [ @"..\Google.Apis.Core\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll" ], + [ @"..\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" @@ -495,11 +502,11 @@ let ``should use portable net40 in net45 when don't have other files``() = [] let ``should not install tools``() = - let model = + let model = emptymodel.AddReferences( - [ @"..\FAKE\tools\FAKE.exe" - @"..\FAKE\tools\FakeLib.dll" - @"..\FAKE\tools\Fake.SQL.dll" ]) + [ @"..\FAKE\tools\FAKE.exe" + @"..\FAKE\tools\FakeLib.dll" + @"..\FAKE\tools\Fake.SQL.dll" ] |> fromLegacyList @"..\FAKE\") model.LegacyReferenceFileFolders |> Seq.forall (fun folder -> folder.Files.References.IsEmpty) @@ -507,55 +514,55 @@ let ``should not install tools``() = [] let ``should handle props files``() = - let model = + let model = emptymodel.AddTargetsFiles( - [ @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props" - @"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ]) + [ @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props" + @"..\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" [] let ``should handle Targets files``() = - let model = + let model = emptymodel.AddTargetsFiles( - [ @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" ]) + [ @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" ] |> fromLegacyList @"..\StyleCop.MSBuild\") .FilterBlackList() model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> 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.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll"; + let expected = + [ @"..\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" ] |> Seq.ofList - let model = + let model = InstallModel.CreateFromLibs - (PackageName "System.Net.Http", SemVer.Parse "2.2.8", - [ ], - [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll"; - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ], [], [], Nuspec.All) + (PackageName "System.Net.Http", SemVer.Parse "2.2.8", + [ ], + [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\", [], [], Nuspec.All) model.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4))) |> shouldEqual expected @@ -567,29 +574,29 @@ let ``should filter .NET 4.5 dlls for System.Net.Http 2.2.8``() = @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll"] |> Seq.ofList - let model = + let model = InstallModel.CreateFromLibs - (PackageName "System.Net.Http", SemVer.Parse "2.2.8", - [ ], - [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll"; - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll"; - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll"; - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ], [], [], Nuspec.All) + (PackageName "System.Net.Http", SemVer.Parse "2.2.8", + [ ], + [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll" + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\", [], [], Nuspec.All) model.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4_5))) |> shouldEqual expected @@ -599,20 +606,19 @@ let ``should filter .NET 4.5 dlls for System.Net.Http 2.2.8``() = [] let ``should filter properly when portables are available``() = - let model = + let model = InstallModel.CreateFromLibs - (PackageName "Newtonsoft.Json", SemVer.Parse "8.0.3", - [ ], + (PackageName "Newtonsoft.Json", SemVer.Parse "8.0.3", + [ ], [ @"..\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll" @"..\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll" @"..\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll" @"..\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll" @"..\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll" - @"..\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll" ], [], [], Nuspec.All) - + @"..\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll" ] |> fromLegacyList @"..\Newtonsoft.Json\", [], [], Nuspec.All) + let filteredModel = model.ApplyFrameworkRestrictions ( [ FrameworkRestriction.Exactly (FrameworkIdentifier.DotNetFramework FrameworkVersion.V4_5) ] ) - filteredModel.GetLibReferences(SinglePlatform(DotNetFramework(FrameworkVersion.V4_5))) |> Seq.toList @@ -624,12 +630,12 @@ let ``should filter properly when portables are available``() = [] let ``should keep net20 if nothing better is available``() = - let model = + let model = InstallModel.CreateFromLibs - (PackageName "EPPlus", SemVer.Parse "4.0.5", - [ ], - [ @"..\EPPlus\lib\net20\EPPlus.dll" ], [], [], Nuspec.All) - + (PackageName "EPPlus", SemVer.Parse "4.0.5", + [ ], + [ @"..\EPPlus\lib\net20\EPPlus.dll" ] |> fromLegacyList @"..\EPPlus\", [], [], Nuspec.All) + let filteredModel = model.ApplyFrameworkRestrictions ( [ FrameworkRestriction.Exactly (FrameworkIdentifier.DotNetFramework FrameworkVersion.V4_6_1) ] ) @@ -643,13 +649,13 @@ let ``should keep net20 if nothing better is available``() = [] let ``prefer net20 over empty folder``() = - let model = + let model = InstallModel.CreateFromLibs - (PackageName "EPPlus", SemVer.Parse "4.0.5", - [ ], + (PackageName "EPPlus", SemVer.Parse "4.0.5", + [ ], [ @"..\EPPlus\lib\readme.txt" - @"..\EPPlus\lib\net20\EPPlus.dll" ], [], [], Nuspec.All) - + @"..\EPPlus\lib\net20\EPPlus.dll" ] |> fromLegacyList @"..\EPPlus\", [], [], Nuspec.All) + let filteredModel = model.ApplyFrameworkRestrictions ( [ FrameworkRestriction.Exactly (FrameworkIdentifier.DotNetFramework FrameworkVersion.V4_6_1) ] ) @@ -662,8 +668,8 @@ let ``prefer net20 over empty folder``() = |> shouldEqual [ ] [] -let ``should understand xamarinios``() = +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" ] + 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 diff --git a/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs b/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs index 73b73c4142..8f191e0649 100644 --- a/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs +++ b/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs @@ -29,9 +29,10 @@ let ``should generate Xml for codecracker.CSharp``() = [ [".."; "codecracker.CSharp"; "analyzers"; "dotnet"; "cs"; "CodeCracker.CSharp.dll"] |> toPath [".."; "codecracker.CSharp"; "analyzers"; "dotnet"; "cs"; "CodeCracker.Common.dll"] |> toPath - ], + ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList ([".."; "codecracker.CSharp"; ""] |> toPath), Nuspec.All) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") Assert.IsTrue(project.IsSome) let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>() ,Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) @@ -50,7 +51,7 @@ let ``should generate Xml for codecracker.CSharp in VisualBasic project``() = [ [".."; "codecracker.CSharp"; "analyzers"; "dotnet"; "cs"; "CodeCracker.CSharp.dll"] |> toPath [".."; "codecracker.CSharp"; "analyzers"; "dotnet"; "cs"; "CodeCracker.Common.dll"] |> toPath - ], + ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList ([".."; "codecracker.CSharp"; ""] |> toPath), Nuspec.All) let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") @@ -81,9 +82,9 @@ let ``should generate Xml for codecracker.VisualBasic``() = [ [".."; "codecracker.CSharp"; "analyzers"; "dotnet"; "vb"; "CodeCracker.VisualBasic.dll"] |> toPath [".."; "codecracker.CSharp"; "analyzers"; "dotnet"; "vb"; "CodeCracker.Common.dll"] |> toPath - ], + ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList ([".."; "codecracker.CSharp"; ""] |> toPath), Nuspec.All) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") Assert.IsTrue(project.IsSome) let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) diff --git a/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs b/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs index 58618bcdef..6b8993b0db 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs @@ -31,15 +31,16 @@ let ``should generate Xml for FSharp.Data.SqlClient 1.4.4``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "FSharp.Data.SqlClient", SemVer.Parse "1.4.4", [], - [ @"..\FSharp.Data.SqlClient\lib\net40\FSharp.Data.SqlClient.dll" - @"..\FSharp.Data.SqlClient\lib\net40\FSharp.Data.SqlClient.pdb" + [ @"..\FSharp.Data.SqlClient\lib\net40\FSharp.Data.SqlClient.dll" + @"..\FSharp.Data.SqlClient\lib\net40\FSharp.Data.SqlClient.pdb" @"..\FSharp.Data.SqlClient\lib\net40\FSharp.Data.SqlClient.XML" @"..\FSharp.Data.SqlClient\lib\net40\Microsoft.SqlServer.TransactSql.ScriptDom.dll" - @"..\FSharp.Data.SqlClient\lib\net40\Microsoft.SqlServer.Types.dll" ], + @"..\FSharp.Data.SqlClient\lib\net40\Microsoft.SqlServer.Types.dll" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\FSharp.Data.SqlClient\", [], [], Nuspec.Load("Nuspec/FSharp.Data.SqlClient.nuspec")) - + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML diff --git a/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs b/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs index 8350039fb7..73a70a84a1 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs @@ -16,18 +16,20 @@ let expected = """ """ +let fromLegacyList = Paket.InstallModel.ProcessingSpecs.fromLegacyList + [] let ``should generate Xml for Fantomas 1.5``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\", [], [], Nuspec.Explicit ["FantomasLib.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 |> normalizeXml @@ -59,13 +61,13 @@ let ``should generate full Xml for Fantomas 1.5``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\", [], [], Nuspec.Explicit ["FantomasLib.dll"]) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value let completeModel = [(Constants.MainDependencyGroup, (PackageName "Fantomas")),(model,model)] |> Map.ofSeq let used = [(Constants.MainDependencyGroup, (PackageName "fantoMas")), (InstallSettings.Default,InstallSettings.Default)] |> Map.ofSeq @@ -81,13 +83,13 @@ let ``should not generate full Xml for Fantomas 1.5 if not referenced``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\", [], [], Nuspec.Explicit ["FantomasLib.dll"]) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value let completeModel = [(Constants.MainDependencyGroup, (PackageName "Fantomas")),(model,model)] |> Map.ofSeq let used = [(Constants.MainDependencyGroup, (PackageName "blub")), (InstallSettings.Default,InstallSettings.Default) ] |> Map.ofSeq @@ -118,13 +120,13 @@ let ``should generate full Xml with reference condition for Fantomas 1.5``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList @"..\Fantomas\", [], [], Nuspec.Explicit ["FantomasLib.dll"]) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value let completeModel = [(Constants.MainDependencyGroup, (PackageName "Fantomas")),(model,model)] |> Map.ofSeq let settings = @@ -162,7 +164,7 @@ let ``should generate full Xml with reference condition and framework restrictio InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [ FrameworkRestriction.Exactly (FrameworkIdentifier.XamariniOS) FrameworkRestriction.Exactly (FrameworkIdentifier.MonoAndroid)], - [ @"..\Fantomas\lib\portable-net45+win8\FantomasLib.dll" ], + [ @"..\Fantomas\lib\portable-net45+win8\FantomasLib.dll" ] |> fromLegacyList @"..\Fantomas\", [], [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs index 63ed5dccbc..8c28e02596 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs @@ -23,7 +23,7 @@ let ``should generate Xml for Fantomas 1.5``() = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], [ @"..\Fantomas\Lib\FantomasLib.dll" @"..\Fantomas\Lib\FSharp.Core.dll" - @"..\Fantomas\Lib\Fantomas.exe" ], + @"..\Fantomas\Lib\Fantomas.exe" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Fantomas\", [], [], Nuspec.Explicit ["FantomasLib.dll"]) diff --git a/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs b/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs index 0ebfff959a..26b83b2df0 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs @@ -21,9 +21,9 @@ let ``should generate Xml for Fuchu 0.4``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fuchu", SemVer.Parse "0.4.0", [], - [ @"..\Fuchu\lib\Fuchu.dll" - @"..\Fuchu\lib\Fuchu.XML" - @"..\Fuchu\lib\Fuchu.pdb" ], + [ @"..\Fuchu\lib\Fuchu.dll" + @"..\Fuchu\lib\Fuchu.XML" + @"..\Fuchu\lib\Fuchu.pdb" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Fuchu\", [], [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs index 173e69ea7b..79c1972d39 100644 --- a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs +++ b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs @@ -22,7 +22,8 @@ let ``should generate Xml for GitInfoPlanter2.0.0``() = let model = InstallModel.CreateFromLibs(PackageName "GitInfoPlanter", SemVer.Parse "0.21", [], [ ], - [ @"..\GitInfoPlanter\build\GitInfoPlanter.targets" ], + [ @"..\GitInfoPlanter\build\GitInfoPlanter.targets" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\GitInfoPlanter\", [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs index 9a63e278ee..1a5a679a45 100644 --- a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs @@ -37,8 +37,10 @@ let ``should generate Xml for LibGit2Sharp 2.0.0``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "LibGit2Sharp", SemVer.Parse "0.21", [], - [ @"..\LibGit2Sharp\lib\net40\LibGit2Sharp.dll" ], - [ @"..\LibGit2Sharp\build\net40\LibGit2Sharp.props" ], + [ @"..\LibGit2Sharp\lib\net40\LibGit2Sharp.dll" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\LibGit2Sharp\", + [ @"..\LibGit2Sharp\build\net40\LibGit2Sharp.props" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\LibGit2Sharp\", [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs b/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs index 32e4f2ad85..7a0c03a992 100644 --- a/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs +++ b/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs @@ -7,18 +7,20 @@ open Paket.Domain open Paket.Requirements open TestHelpers +let fromLegacyList = Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Fantomas\" + [] let ``should find custom nodes in doc``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList, [], [], Nuspec.Explicit ["FantomasLib.dll"]) - + ProjectFile.TryLoad("./ProjectFile/TestData/CustomFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty |> shouldEqual false @@ -27,13 +29,13 @@ let ``should find custom Paket nodes in doc``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList, [], [], Nuspec.Explicit ["FantomasLib.dll"]) - + ProjectFile.TryLoad("./ProjectFile/TestData/CustomPaketFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty |> shouldEqual false @@ -43,9 +45,9 @@ let ``should not find custom nodes if there are none``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList, [], [], Nuspec.Explicit ["FantomasLib.dll"]) @@ -59,9 +61,9 @@ let ``should delete custom nodes if there are some``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ], + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> fromLegacyList, [], [], Nuspec.Explicit ["FantomasLib.dll"]) diff --git a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs index ed3f7143e7..38fa793757 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs @@ -7,15 +7,16 @@ open Paket.Domain open Paket.TestHelpers [] -let ``should not install targets node for Microsoft.Bcl.Build``() = +let ``should not install targets node for Microsoft.Bcl.Build``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Microsoft.Bcl.Build", SemVer.Parse "1.0.21", [], [ ], - [ @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.Tasks.dll"; @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets" ], + [ @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.Tasks.dll"; @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Microsoft.Bcl.Build\", [], Nuspec.All) - + model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> 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/Microsoft.CodeAnalysis.Analyzers.fs b/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs index c66f99d8f3..1d6302cb7a 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs @@ -18,7 +18,7 @@ let model = [".."; "Microsoft.CodeAnalysis.Analyzers"; "analyzers"; "dotnet"; "cs"; "Microsoft.CodeAnalysis.CSharp.Analyzers.dll"] |> toPath [".."; "Microsoft.CodeAnalysis.Analyzers"; "analyzers"; "dotnet"; "vb"; "Microsoft.CodeAnalysis.Analyzers.dll"] |> toPath [".."; "Microsoft.CodeAnalysis.Analyzers"; "analyzers"; "dotnet"; "vb"; "Microsoft.CodeAnalysis.VisualBasic.Analyzers.dll"] |> toPath - ], + ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList ([".."; "Microsoft.CodeAnalysis.Analyzers"; ""] |> toPath), Nuspec.All) let expectedCs = """ diff --git a/tests/Paket.Tests/InstallModel/Xml/Plossum.fs b/tests/Paket.Tests/InstallModel/Xml/Plossum.fs index a63c5ca43c..48b49e1d47 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Plossum.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Plossum.fs @@ -25,7 +25,8 @@ let ``should generate Xml for Plossum``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Plossum.CommandLine", SemVer.Parse "1.5.0", [], - [ @"..\Plossum.CommandLine\lib\net40\Plossum CommandLine.dll" ], + [ @"..\Plossum.CommandLine\lib\net40\Plossum CommandLine.dll" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Plossum.CommandLine\", [], [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs b/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs index 87999d9e55..76eaefaf69 100644 --- a/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs +++ b/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs @@ -22,9 +22,9 @@ let ``should generate Xml for RefactoringEssentials in CSharp project``() = [], [ [".."; "RefactoringEssentials"; "analyzers"; "dotnet"; "RefactoringEssentials.dll"] |> toPath - ], + ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList ([".."; "RefactoringEssentials"; ""] |> toPath), Nuspec.All) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") Assert.IsTrue(project.IsSome) let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) @@ -42,9 +42,9 @@ let ``should generate Xml for RefactoringEssentials in VisualBasic project``() = [], [ [".."; "RefactoringEssentials"; "analyzers"; "dotnet"; "RefactoringEssentials.dll"] |> toPath - ], + ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList ([".."; "RefactoringEssentials"; ""] |> toPath), Nuspec.All) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") Assert.IsTrue(project.IsSome) let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) diff --git a/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs b/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs index 07cf87f911..c7894967bb 100644 --- a/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs +++ b/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs @@ -91,13 +91,14 @@ let ``should generate Xml for Rx-XAML 2.2.4 with correct framework assembly refe ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Rx-XAML", SemVer.Parse "2.2.4", [], - [ @"..\Rx-XAML\lib\net40\System.Reactive.Windows.Threading.dll" - @"..\Rx-XAML\lib\net45\System.Reactive.Windows.Threading.dll" - @"..\Rx-XAML\lib\portable-win81+wpa81\System.Reactive.Windows.Threading.dll" - @"..\Rx-XAML\lib\sl5\System.Reactive.Windows.Threading.dll" - @"..\Rx-XAML\lib\windows8\System.Reactive.Windows.Threading.dll" - @"..\Rx-XAML\lib\windowsphone8\System.Reactive.Windows.Threading.dll" - @"..\Rx-XAML\lib\windowsphone71\System.Reactive.Windows.Threading.dll" ], + [ @"..\Rx-XAML\lib\net40\System.Reactive.Windows.Threading.dll" + @"..\Rx-XAML\lib\net45\System.Reactive.Windows.Threading.dll" + @"..\Rx-XAML\lib\portable-win81+wpa81\System.Reactive.Windows.Threading.dll" + @"..\Rx-XAML\lib\sl5\System.Reactive.Windows.Threading.dll" + @"..\Rx-XAML\lib\windows8\System.Reactive.Windows.Threading.dll" + @"..\Rx-XAML\lib\windowsphone8\System.Reactive.Windows.Threading.dll" + @"..\Rx-XAML\lib\windowsphone71\System.Reactive.Windows.Threading.dll" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Rx-XAML\", [], [], { References = NuspecReferences.All diff --git a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs index 2da40e73f7..9c82acdcea 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs @@ -8,6 +8,8 @@ open Paket.Domain open Paket.Requirements open Paket.InstallModel +let fromLegacyList = Paket.InstallModel.ProcessingSpecs.fromLegacyList + let expectedReferenceNodes = """ @@ -90,6 +92,7 @@ let ``should extract lib folders for SQLite``() = @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net45\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"] + |> fromLegacyList @"..\System.Data.SQLite.Core\" let model = libs @@ -105,6 +108,7 @@ let ``should calc lib folders for SQLite``() = @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net45\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"] + |> fromLegacyList @"..\System.Data.SQLite.Core\" let model = calcLibFolders (PackageName "System.Data.SQLite.Core") libs let folder = model |> List.item 2 @@ -118,6 +122,7 @@ let ``should init model for SQLite``() = @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net45\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"] + |> fromLegacyList @"..\System.Data.SQLite.Core\" let model = emptyModel (PackageName "System.Data.SQLite.Core") (SemVer.Parse "3.8.2") @@ -135,11 +140,13 @@ let ``should generate model for SQLite``() = [ @"..\System.Data.SQLite.Core\lib\net20\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net45\System.Data.SQLite.dll" - @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"], + @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"] + |> fromLegacyList @"..\System.Data.SQLite.Core\", [ @"..\System.Data.SQLite.Core\build\net20\System.Data.SQLite.Core.targets" @"..\System.Data.SQLite.Core\build\net40\System.Data.SQLite.Core.targets" @"..\System.Data.SQLite.Core\build\net45\System.Data.SQLite.Core.targets" - @"..\System.Data.SQLite.Core\build\net451\System.Data.SQLite.Core.targets" ], + @"..\System.Data.SQLite.Core\build\net451\System.Data.SQLite.Core.targets" ] + |> fromLegacyList @"..\System.Data.SQLite.Core\", [], Nuspec.All) @@ -155,11 +162,13 @@ let ``should generate Xml for SQLite``() = [ @"..\System.Data.SQLite.Core\lib\net20\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net45\System.Data.SQLite.dll" - @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"], + @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"] + |> fromLegacyList @"..\System.Data.SQLite.Core\", [ @"..\System.Data.SQLite.Core\build\net20\System.Data.SQLite.Core.targets" @"..\System.Data.SQLite.Core\build\net40\System.Data.SQLite.Core.targets" @"..\System.Data.SQLite.Core\build\net45\System.Data.SQLite.Core.targets" - @"..\System.Data.SQLite.Core\build\net451\System.Data.SQLite.Core.targets" ], + @"..\System.Data.SQLite.Core\build\net451\System.Data.SQLite.Core.targets" ] + |> fromLegacyList @"..\System.Data.SQLite.Core\", [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs index e328f4b366..380b959f90 100644 --- a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs +++ b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs @@ -18,7 +18,7 @@ let ``should generate Xml for StyleCop.MSBuild``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "StyleCop.MSBuild", SemVer.Parse "4.7.49.1", [],[], - [ @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" ], + [ @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\StyleCop.MSBuild\", [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/System.Security.Cryptography.Algorithms.fs b/tests/Paket.Tests/InstallModel/Xml/System.Security.Cryptography.Algorithms.fs index 655a5aa405..74f04e346d 100644 --- a/tests/Paket.Tests/InstallModel/Xml/System.Security.Cryptography.Algorithms.fs +++ b/tests/Paket.Tests/InstallModel/Xml/System.Security.Cryptography.Algorithms.fs @@ -69,26 +69,27 @@ let ``should generate Xml for System.Security.Cryptography.Algorithms in CSharp ensureDir() let model = InstallModel.CreateFromLibs(PackageName "System.Security.Cryptography.Algorithms", SemVer.Parse "1.2.0", [], - [ @"..\System.Security.Cryptography.Algorithms\lib\net46\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\lib\net461\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\lib\net463\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\ref\net46\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\ref\net461\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\ref\net463\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.3\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.4\System.Security.Cryptography.Algorithms.dll" + [ @"..\System.Security.Cryptography.Algorithms\lib\net46\System.Security.Cryptography.Algorithms.dll" + @"..\System.Security.Cryptography.Algorithms\lib\net461\System.Security.Cryptography.Algorithms.dll" + @"..\System.Security.Cryptography.Algorithms\lib\net463\System.Security.Cryptography.Algorithms.dll" + @"..\System.Security.Cryptography.Algorithms\ref\net46\System.Security.Cryptography.Algorithms.dll" + @"..\System.Security.Cryptography.Algorithms\ref\net461\System.Security.Cryptography.Algorithms.dll" + @"..\System.Security.Cryptography.Algorithms\ref\net463\System.Security.Cryptography.Algorithms.dll" + @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.3\System.Security.Cryptography.Algorithms.dll" + @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.4\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - + @"..\System.Security.Cryptography.Algorithms\runtimes\unix\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net461\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net463\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\netcore50\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" ], + @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\netstandard1.6\System.Security.Cryptography.Algorithms.dll" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\System.Security.Cryptography.Algorithms\", [], [], Nuspec.All) - + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") Assert.IsTrue(project.IsSome) let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,None,true,KnownTargetProfiles.AllProfiles,None) diff --git a/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs b/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs index 6ca3de913c..bd407979ce 100644 --- a/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs +++ b/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs @@ -43,7 +43,7 @@ let ``should generate Xml for System.Spatial``() = @"..\System.Spatial\lib\sl4\de\System.Spatial.resources.dll" @"..\System.Spatial\lib\sl4\es\System.Spatial.resources.dll" @"..\System.Spatial\lib\sl4\zh-Hans\System.Spatial.resources.dll" - ],[],[],Nuspec.All) + ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\System.Spatial\",[],[],Nuspec.All) let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs index 35c80283e4..9a39dc7085 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs @@ -154,40 +154,40 @@ let expected = """ [] let ``should generate Xml for System.Net.Http 2.2.8``() = - ensureDir() - let model = + ensureDir() + let model = InstallModel.CreateFromLibs(PackageName "System.Net.Http", SemVer.Parse "2.2.8", [], - [ - @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" + [ + @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" + + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.dll" - @"..\Microsoft.Net.Http\lib\portable-net45+monoandroid10+monotouch10+xamarinios10+Xamarin.Mac20\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\portable-net45+monoandroid10+monotouch10+xamarinios10+Xamarin.Mac20\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\portable-net45+monoandroid10+monotouch10+xamarinios10+Xamarin.Mac20\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" + + @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll" - @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" - ], + + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" + ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Microsoft.Net.Http\", [], [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs index e2e208f50d..45fb5b0482 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs @@ -38,34 +38,34 @@ let expected = """ [] let ``should generate Xml for System.Net.Http 2.2.8``() = ensureDir() - let model = + let model = InstallModel.CreateFromLibs(PackageName "System.Net.Http", SemVer.Parse "2.2.8", [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4))], - [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.dll" + [ @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monoandroid\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" - @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\monotouch\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" + + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll" + @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" + + @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\portable-net45+win8\System.Net.Http.Primitives.dll" - @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Extensions.dll" @"..\Microsoft.Net.Http\lib\win8\System.Net.Http.Primitives.dll" - - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ], + + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\wpa81\System.Net.Http.Primitives.dll" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Microsoft.Net.Http\", [], [], Nuspec.All) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs index 344cc21e0a..c059226697 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs @@ -52,13 +52,14 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "System.Net.Http", SemVer.Parse "2.2.8", [], - [ @"..\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\net45\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll"] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Microsoft.Net.Http\", [], [], { References = NuspecReferences.All diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs index c3c336a86c..4a9f16a4a0 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs @@ -60,13 +60,13 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "System.Net.Http", SemVer.Parse "2.2.8", [], - [ @"..\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\net45\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.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\net45\System.Net.Http.Extensions.dll" + @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll"] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Microsoft.Net.Http\", [], [], { References = NuspecReferences.All diff --git a/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs b/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs index 6cae69e2bb..a77fa2d214 100644 --- a/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs +++ b/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs @@ -33,7 +33,8 @@ let ``should generate Xml for xunit.runner.visualstudio 2.0.0``() = let model = InstallModel.CreateFromLibs(PackageName "xunit.runner.visualstudio", SemVer.Parse "2.50.0", [],[], [ @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props" - @"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ], + @"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\xunit.runner.visualstudio\", [], Nuspec.All) @@ -64,10 +65,11 @@ let ``should not generate Xml for xunit.runner.visualstudio 2.0.0 if import is d let model = InstallModel.CreateFromLibs(PackageName "xunit.runner.visualstudio", SemVer.Parse "2.50.0", [],[], [ @"..\xunit.runner.visualstudio\build\net20\xunit.runner.visualstudio.props" - @"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ], + @"..\xunit.runner.visualstudio\build\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.runner.visualstudio.props" ] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\xunit.runner.visualstudio\", [], Nuspec.All) - + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,false,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml From e9ec445e9f81cc90db6ecb7996817c0979ca4341 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Fri, 14 Apr 2017 14:05:10 +0200 Subject: [PATCH 04/15] fixup for step 1 + add scanf implementation for simplification. --- src/Paket.Core/InstallModel.fs | 97 +++++++++++++++++-- .../InstallModel/ProcessingSpecs.fs | 26 ++--- 2 files changed, 103 insertions(+), 20 deletions(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 12077595d6..b4c2f886f1 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -129,6 +129,84 @@ type InstallModel = Analyzers: AnalyzerLib list LicenseUrl: string option } +module FolderScanner = + // Stolen and modifed to our needs from http://www.fssnip.net/4I/title/sscanf-parsing-with-format-strings + open System + open System.Text + open System.Text.RegularExpressions + open Microsoft.FSharp.Reflection + + let check f x = if f x then x + else failwithf "format failure \"%s\"" x + + let parseDecimal x = Decimal.Parse(x, System.Globalization.CultureInfo.InvariantCulture) + + let parsers = dict [ + 'b', Boolean.Parse >> box + 'd', int >> box + 'i', int >> box + 's', box + 'u', uint32 >> int >> box + 'x', check (String.forall Char.IsLower) >> ((+) "0x") >> int >> box + 'X', check (String.forall Char.IsUpper) >> ((+) "0x") >> int >> box + 'o', ((+) "0o") >> int >> box + 'e', float >> box // no check for correct format for floats + 'E', float >> box + 'f', float >> box + 'F', float >> box + 'g', float >> box + 'G', float >> box + 'M', parseDecimal >> box + 'c', char >> box + ] + + //let advancedParsers = dict [ + // "", + //] + + // array of all possible formatters, i.e. [|"%b"; "%d"; ...|] + let separators = + parsers.Keys + |> Seq.map (fun c -> "%" + sprintf "%c" c) + |> Seq.toArray + + + // Creates a list of formatter characters from a format string, + // for example "(%s,%d)" -> ['s', 'd'] + let rec getFormatters xs = + match xs with + | '%'::'%'::xr -> getFormatters xr + //| '%'::'A'::xr -> getFormatters xr + | '%'::x::xr -> if parsers.ContainsKey x then x::getFormatters xr + else failwithf "Unknown formatter %%%c" x + | x::xr -> getFormatters xr + | [] -> [] + + + let sscanf (pf:PrintfFormat<_,_,_,_,'t>) s : 't = + let formatStr = pf.Value.Replace("%%", "%") + let constants = formatStr.Split(separators, StringSplitOptions.None) + let regex = Regex("^" + String.Join("(.*?)", constants |> Array.map Regex.Escape) + "$") + let formatters = pf.Value.ToCharArray() // need original string here (possibly with "%%"s) + |> Array.toList |> getFormatters + let groups = + regex.Match(s).Groups + |> Seq.cast + |> Seq.skip 1 + let matches = + (groups, formatters) + ||> Seq.map2 (fun g f -> g.Value |> parsers.[f]) + |> Seq.toArray + + if matches.Length = 1 then matches.[0] :?> 't + else FSharpValue.MakeTuple(matches, typeof<'t>) :?> 't + + // some basic testing + //let (a,b) = sscanf "(%%%s,%M)" "(%hello, 4.53)" + //let (x,y,z) = sscanf "%s-%s-%s" "test-this-string" + //let (c,d,e,f,g,h,i) = sscanf "%b-%d-%i,%u,%x,%X,%o" "false-42--31,13,ff,FF,42" + //let (j,k,l,m,n,o,p) = sscanf "%f %F %g %G %e %E %c" "1 2.1 3.4 .3 43.2e32 0 f" + //let (t:string, asdfy: obj) = sscanf "%A %A" "asdas" [] module InstallModel = @@ -146,14 +224,17 @@ module InstallModel = LicenseUrl = None } let getReferenceFolders (installModel: InstallModel) = - if installModel.NewReferenceFileFolders.IsEmpty then - installModel.LegacyReferenceFileFolders - else installModel.NewReferenceFileFolders - - let getLibraryFolders (installModel: InstallModel) = - if installModel.NewReferenceFileFolders.IsEmpty then - installModel.LegacyReferenceFileFolders - else installModel.NewReferenceFileFolders + installModel.LegacyReferenceFileFolders @ + (installModel.NewReferenceFileFolders + |> List.choose (fun r -> + match installModel.LegacyReferenceFileFolders |> List.tryFind (fun r2 -> r2.Targets = r.Targets) with + | None -> Some r + | _ -> None)) + + //let getLibraryFolders (installModel: InstallModel) = + // if installModel.NewReferenceFileFolders.IsEmpty then + // installModel.LegacyReferenceFileFolders + // else installModel.NewReferenceFileFolders let extractRefFolder packageName (path:UnparsedPackageFile) = let path = path.FullPath.Replace("\\", "/").ToLower() diff --git a/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs b/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs index dc10f6f447..45e1c45064 100644 --- a/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs +++ b/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs @@ -48,23 +48,24 @@ let ``should understand libuv in runtimes``() = model.GetLibReferences(SinglePlatform (Runtimes("win7-x64"))) |> shouldContain @"..\Microsoft.AspNetCore.Server.Kestrel\runtimes\win7-x64\native\libuv.dll" [] -let ``should understand reference folder``() = - let model = - emptymodel.AddReferences +let ``should understand reference folder``() = + let model = + emptymodel.AddReferences ([ @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" @"..\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll" - @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" ] |> fromLegacyList @"..\System.Security.Cryptography.Algorithms\") + @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" ] + |> fromLegacyList @"..\System.Security.Cryptography.Algorithms\") let refs = model.GetLibReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) 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.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) 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.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) 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" @@ -365,15 +366,16 @@ let ``should handle lib install of Microsoft.Net.Http 2.2.28``() = let ``should handle lib install of MicrosoftBcl``() = let model = emptymodel.AddReferences( - [ @"..\Microsoft.Net.Http\lib\monoandroid\_._" - - @"..\Microsoft.Net.Http\lib\monotouch\_._" + ([ @"..\Microsoft.Net.Http\lib\monoandroid\_._" + @"..\Microsoft.Net.Http\lib\monotouch\_._" + @"..\Microsoft.Net.Http\lib\net45\_._" + ] |> fromLegacyList @"..\Microsoft.Net.Http\") @ + ([ @"..\Microsoft.Bcl\lib\net40\System.IO.dll" @"..\Microsoft.Bcl\lib\net40\System.Runtime.dll" @"..\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll" - @"..\Microsoft.Net.Http\lib\net45\_._" @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.IO.dll" @"..\Microsoft.Bcl\lib\portable-net40+sl4+win8\System.Runtime.dll" @@ -395,8 +397,8 @@ let ``should handle lib install of MicrosoftBcl``() = @"..\Microsoft.Bcl\lib\wp8\_._" @"..\Microsoft.Bcl\lib\wpa81\_._" @"..\Microsoft.Bcl\lib\portable-net451+win81\_._" - @"..\Microsoft.Bcl\lib\portable-net451+win81+wpa81\_._" - ] |> fromLegacyList @"..\Microsoft.Bcl\").FilterBlackList() + @"..\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" From c229b3fd7a9f3d67422072f0054826f3982e02a4 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Fri, 14 Apr 2017 16:57:15 +0200 Subject: [PATCH 05/15] implement generic sscanf functionality. --- src/Paket.Core/InstallModel.fs | 198 +++++++++++++++++++++++++-------- 1 file changed, 153 insertions(+), 45 deletions(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index b4c2f886f1..27ad1b76da 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -131,38 +131,54 @@ type InstallModel = module FolderScanner = // Stolen and modifed to our needs from http://www.fssnip.net/4I/title/sscanf-parsing-with-format-strings - open System - open System.Text open System.Text.RegularExpressions open Microsoft.FSharp.Reflection - let check f x = if f x then x - else failwithf "format failure \"%s\"" x - - let parseDecimal x = Decimal.Parse(x, System.Globalization.CultureInfo.InvariantCulture) + type ParseResult<'t> = + | ParseSucceeded of 't + | ParseError of string + module ParseResult = + let bind f r = + match r with + | ParseSucceeded res -> f res + | ParseError err -> ParseError err + let map f r = + r |> bind (fun r -> ParseSucceeded (f r)) + let box r = + r |> map box + + let toParseResult error (wasSuccess, result) = + if wasSuccess then ParseSucceeded result + else ParseError error + + let check errorMsg f x = + if f x then ParseSucceeded x + else ParseError (errorMsg) + + let parseDecimal x = Decimal.TryParse(x, Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture) let parsers = dict [ - 'b', Boolean.Parse >> box - 'd', int >> box - 'i', int >> box - 's', box - 'u', uint32 >> int >> box - 'x', check (String.forall Char.IsLower) >> ((+) "0x") >> int >> box - 'X', check (String.forall Char.IsUpper) >> ((+) "0x") >> int >> box - 'o', ((+) "0o") >> int >> box - 'e', float >> box // no check for correct format for floats - 'E', float >> box - 'f', float >> box - 'F', float >> box - 'g', float >> box - 'G', float >> box - 'M', parseDecimal >> box - 'c', char >> box + 'b', Boolean.TryParse >> toParseResult "Could not parse bool (b)" >> ParseResult.box + 'd', Int32.TryParse >> toParseResult "Could not parse int (d)" >> ParseResult.box + 'i', Int32.TryParse >> toParseResult "Could not parse int (i)" >> ParseResult.box + 's', (fun s -> ParseSucceeded s) >> ParseResult.box + 'u', UInt32.TryParse >> toParseResult "could not parse uint (u)" >> ParseResult.map int >> ParseResult.box + 'x', check "could not parse int (x)" (String.forall Char.IsLower) >> ParseResult.map ((+) "0x") >> ParseResult.bind (Int32.TryParse >> toParseResult "Could not parse int (0x via x)") >> ParseResult.box + 'X', check "could not parse int (X)" (String.forall Char.IsUpper) >> ParseResult.map ((+) "0x") >> ParseResult.bind (Int32.TryParse >> toParseResult "Could not parse int (0x via X)") >> ParseResult.box + 'o', ((+) "0o") >> Int32.TryParse >> toParseResult "Could not parse int (0o)" >> ParseResult.box + 'e', Double.TryParse >> toParseResult "Could not parse float (e)" >> ParseResult.box // no check for correct format for floats + 'E', Double.TryParse >> toParseResult "Could not parse float (e)" >> ParseResult.box + 'f', Double.TryParse >> toParseResult "Could not parse float (e)" >> ParseResult.box + 'F', Double.TryParse >> toParseResult "Could not parse float (e)" >> ParseResult.box + 'g', Double.TryParse >> toParseResult "Could not parse float (e)" >> ParseResult.box + 'G', Double.TryParse >> toParseResult "Could not parse float (e)" >> ParseResult.box + 'M', parseDecimal >> toParseResult "Could not parse decimal (m)" >> ParseResult.box + 'c', check "Could not parse character (c)" (String.length >> (=) 1) >> ParseResult.map char >> ParseResult.box + 'A', (fun s -> ParseSucceeded s) >> ParseResult.box ] - - //let advancedParsers = dict [ - // "", - //] + type AdvancedScanner = + { Name : string + Parser : string -> ParseResult } // array of all possible formatters, i.e. [|"%b"; "%d"; ...|] let separators = @@ -170,43 +186,135 @@ module FolderScanner = |> Seq.map (fun c -> "%" + sprintf "%c" c) |> Seq.toArray - // Creates a list of formatter characters from a format string, // for example "(%s,%d)" -> ['s', 'd'] let rec getFormatters xs = match xs with | '%'::'%'::xr -> getFormatters xr - //| '%'::'A'::xr -> getFormatters xr | '%'::x::xr -> if parsers.ContainsKey x then x::getFormatters xr else failwithf "Unknown formatter %%%c" x | x::xr -> getFormatters xr | [] -> [] + type private ScanResult = + | ScanSuccess of obj[] + | ScanRegexFailure of stringToScan:string * regex:string + | ScanParserFailure of error:string + let private sscanfHelper (pf:PrintfFormat<_,_,_,_,'t>) s : ScanResult = + let formatStr = pf.Value.Replace("%%", "%") + let constants = formatStr.Split(separators, StringSplitOptions.None) + let regexString = "^" + String.Join("(.*?)", constants |> Array.map Regex.Escape) + "$" + let regex = Regex(regexString) + let formatters = pf.Value.ToCharArray() // need original string here (possibly with "%%"s) + |> Array.toList |> getFormatters + let matchres = regex.Match(s) + if not matchres.Success then ScanRegexFailure(s, regexString) + else + let groups = + matchres.Groups + |> Seq.cast + |> Seq.skip 1 + let results = + (groups, formatters) + ||> Seq.map2 (fun g f -> g.Value |> parsers.[f]) + |> Seq.toArray + match results |> Seq.choose (fun r -> match r with ParseError error -> Some error | _ -> None) |> Seq.tryHead with + | Some error -> + ScanParserFailure error + | None -> + ScanSuccess (results |> Seq.map (function ParseSucceeded res -> res | ParseError _ -> failwithf "Should not happen here") |> Seq.toArray) + + let inline toGenericTuple<'t> (matches:obj[]) = + if matches.Length = 1 then matches.[0] :?> 't + else if matches.Length = 0 then Unchecked.defaultof<'t> + else FSharpValue.MakeTuple(matches, typeof<'t>) :?> 't + + let trySscanf (pf:PrintfFormat<_,_,_,_,'t>) s : 't option = + //raise <| FormatException(sprintf "Unable to scan string '%s' with regex '%s'" s regexString) + match sscanfHelper pf s with + | ScanSuccess matches -> toGenericTuple matches |> Some + | _ -> None + let inline private handleErrors s r = + match r with + | ScanSuccess matches -> toGenericTuple matches + | ScanRegexFailure (s, regexString) -> raise <| FormatException(sprintf "Unable to scan string '%s' with regex '%s'" s regexString) + | ScanParserFailure e -> raise <| FormatException(sprintf "Unable to parse string '%s' with parser: %s" s e) let sscanf (pf:PrintfFormat<_,_,_,_,'t>) s : 't = - let formatStr = pf.Value.Replace("%%", "%") - let constants = formatStr.Split(separators, StringSplitOptions.None) - let regex = Regex("^" + String.Join("(.*?)", constants |> Array.map Regex.Escape) + "$") - let formatters = pf.Value.ToCharArray() // need original string here (possibly with "%%"s) - |> Array.toList |> getFormatters - let groups = - regex.Match(s).Groups - |> Seq.cast - |> Seq.skip 1 - let matches = - (groups, formatters) - ||> Seq.map2 (fun g f -> g.Value |> parsers.[f]) - |> Seq.toArray - - if matches.Length = 1 then matches.[0] :?> 't - else FSharpValue.MakeTuple(matches, typeof<'t>) :?> 't + sscanfHelper pf s + |> handleErrors s + + let private findSpecifiers = Regex(@"%(?.)({(?.*?)})?") + + // Extends the syntax of the format string with %A{scanner}, and uses the corresponding named scanner from the advancedScanners parameter. + let private sscanfExtHelper (advancedScanners:AdvancedScanner seq) (pf:PrintfFormat<_,_,_,_,'t>) s : ScanResult = + let scannerMap = + advancedScanners + |> Seq.map (fun s -> s.Name, s) + |> dict + // replace advanced scanning formatters "%A{name}" + let matches = + findSpecifiers.Matches(pf.Value) + |> Seq.cast + |> Seq.map (fun m -> + let formatSpec = m.Groups.["formatSpec"].Value + let scannerName = m.Groups.["inside"].Value + formatSpec, scannerName, m.Value, m.Index) + |> Seq.toList + let advancedFormatters = + matches + |> Seq.filter (fun (formatSpec, scannerName, _, _) -> + formatSpec <> "%") + |> Seq.map (fun (formatSpec, scannerName, _, _) -> + if formatSpec = "A" then + if System.String.IsNullOrWhiteSpace scannerName then + None + else Some scannerMap.[scannerName] + else None) + + let replacedFormatString = + matches + |> List.rev // start replacing on the back, this way indices are correct + |> Seq.fold (fun (currentFormatterString:string) (formatSpec, scannerName, originalValue, index) -> + let replacement = + match formatSpec with + | "A" -> "%A" + | _ -> originalValue + currentFormatterString.Substring(0, index) + replacement + currentFormatterString.Substring(index + originalValue.Length)) pf.Value + + match sscanfHelper (PrintfFormat<_,_,_,_,'t> replacedFormatString) s with + | ScanSuccess objResults -> + let results = + (objResults, advancedFormatters) + ||> Seq.map2 (fun r a -> match a with Some p -> p.Parser (string r) | None -> ParseSucceeded r) + |> Seq.toArray + match results |> Seq.choose (fun r -> match r with ParseError error -> Some error | _ -> None) |> Seq.tryHead with + | Some error -> + ScanParserFailure error + | None -> + ScanSuccess (results |> Seq.map (function ParseSucceeded res -> res | ParseError _ -> failwithf "Should not happen here") |> Seq.toArray) + | _ as s -> s + + let trySscanfExt advancedScanners (pf:PrintfFormat<_,_,_,_,'t>) s : 't option = + //raise <| FormatException(sprintf "Unable to scan string '%s' with regex '%s'" s regexString) + match sscanfExtHelper advancedScanners pf s with + | ScanSuccess matches -> toGenericTuple matches |> Some + | _ -> None + + let sscanfExt advancedScanners (pf:PrintfFormat<_,_,_,_,'t>) s : 't = + sscanfExtHelper advancedScanners pf s + |> handleErrors s // some basic testing //let (a,b) = sscanf "(%%%s,%M)" "(%hello, 4.53)" //let (x,y,z) = sscanf "%s-%s-%s" "test-this-string" //let (c,d,e,f,g,h,i) = sscanf "%b-%d-%i,%u,%x,%X,%o" "false-42--31,13,ff,FF,42" //let (j,k,l,m,n,o,p) = sscanf "%f %F %g %G %e %E %c" "1 2.1 3.4 .3 43.2e32 0 f" - //let (t:string, asdfy: obj) = sscanf "%A %A" "asdas" + //let t = trySscanf "test%s" "test123" + //let t2 = sscanf "test%s" "invalid" + //let (blub:Guid option) = trySscanfExt [ { Name = "tbf"; Parser = fun s -> Guid.NewGuid() |> box } ] "test%A{tbf}" "6" + //let (blub2:Guid) = sscanfExt [ { Name = "tbf"; Parser = fun s -> Guid.NewGuid() |> box } ] "test%A{tbf}" "6" + //let testParserError = trySscanf "test%d" "testasd" [] module InstallModel = From 66e5cfd178f5fa53d8bccb0ff93008127cd05c85 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Fri, 14 Apr 2017 23:20:34 +0200 Subject: [PATCH 06/15] step 2 - remove runtime support and rewrite InstallModel --- src/Paket.Core/Files/ProjectFile.fs | 20 +- src/Paket.Core/FrameworkHandling.fs | 38 +-- src/Paket.Core/InstallModel.fs | 263 ++++++++++++------ src/Paket.Core/InstallProcess.fs | 7 +- src/Paket.Core/NuGetV2.fs | 2 +- src/Paket.Core/PlatformMatching.fs | 58 ++-- src/Paket.Core/Requirements.fs | 4 +- src/Paket.Core/ScriptGeneration.fs | 4 +- src/Paket.Core/Utils.fs | 54 ---- src/Paket/Paket.fsproj | 4 +- .../InstallModel/Penalty/PenaltySpecs.fs | 244 ++++++++-------- .../InstallModel/ProcessingSpecs.fs | 81 ++++-- .../InstallModel/Xml/FantomasLib.fs | 12 +- .../InstallModel/Xml/LibGit2Sharp.fs | 4 +- tests/Paket.Tests/InstallModel/Xml/SQLite.fs | 36 ++- 15 files changed, 480 insertions(+), 351 deletions(-) diff --git a/src/Paket.Core/Files/ProjectFile.fs b/src/Paket.Core/Files/ProjectFile.fs index 52fc0458c1..277518080b 100644 --- a/src/Paket.Core/Files/ProjectFile.fs +++ b/src/Paket.Core/Files/ProjectFile.fs @@ -744,12 +744,20 @@ module ProjectFile = model.GetReferenceFolders() |> List.map (fun lib -> lib.Targets) + // Just in case anyone wants to compile FOR netcore in the old format... + // I don't think there is anyone actually using this part, but it's there for backwards compat. + let netCoreRestricted = + model.ApplyFrameworkRestrictions + [ FrameworkRestriction.AtLeast (FrameworkIdentifier.DotNetStandard DotNetStandardVersion.V1_0); + FrameworkRestriction.AtLeast (FrameworkIdentifier.DotNetCore DotNetCoreVersion.V1_0) ] + + // handle legacy conditions let conditions = - model.GetReferenceFolders() - |> List.sortBy (fun libFolder -> libFolder.Name) - |> List.collect (fun libFolder -> + ((model.GetReferenceFolders() |> List.sortBy (fun libFolder -> libFolder.Name)) @ + netCoreRestricted.CompileRefFolders |> List.sortBy (fun libFolder -> libFolder.Name)) + |> List.collect (fun libFolder -> match libFolder with - | x when (match x.Targets with | [SinglePlatform(Runtimes(_))] -> true | _ -> false) -> [] // TODO: Add reference to custom task instead + //| 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 | "" -> [] @@ -788,7 +796,7 @@ module ProjectFile = [lowerCondition,createItemGroup !assemblyTargets frameworkAssemblies,true condition,createItemGroup libFolder.Targets rest,false] ) - + // global targets are targets, that are either directly in the /build folder, // or, if there is a framework-restriction, specific to the framework(s). // (ref https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package). @@ -797,7 +805,7 @@ module ProjectFile = let sortedTargets = model.TargetsFileFolders |> List.sortBy (fun lib -> lib.Name) sortedTargets |> List.partition (fun lib -> allTargetProfiles = set lib.Targets ) - + let frameworkSpecificTargetsFileConditions = frameworkSpecificTargets |> List.map (fun lib -> PlatformMatching.getCondition referenceCondition allTargets lib.Targets,createPropertyGroup lib.Files.References) diff --git a/src/Paket.Core/FrameworkHandling.fs b/src/Paket.Core/FrameworkHandling.fs index a37a99eb25..0cff63ae08 100644 --- a/src/Paket.Core/FrameworkHandling.fs +++ b/src/Paket.Core/FrameworkHandling.fs @@ -156,7 +156,7 @@ type FrameworkIdentifier = | MonoTouch | MonoMac | Native of string * string - | Runtimes of string + //| Runtimes of string | XamariniOS | XamarinMac | Windows of string @@ -176,7 +176,7 @@ type FrameworkIdentifier = | MonoTouch -> "monotouch" | MonoMac -> "monomac" | Native(_) -> "native" - | Runtimes(_) -> "runtimes" + //| Runtimes(_) -> "runtimes" | XamariniOS -> "xamarinios" | UAP v -> "uap" + v.ShortString() | XamarinMac -> "xamarinmac" @@ -193,7 +193,7 @@ type FrameworkIdentifier = | MonoTouch -> [ ] | MonoMac -> [ ] | Native(_) -> [ ] - | Runtimes(_) -> [ ] + //| Runtimes(_) -> [ ] | XamariniOS -> [ ] | XamarinMac -> [ ] | UAP UAPVersion.V10 -> [ ] @@ -253,7 +253,7 @@ type FrameworkIdentifier = | DNXCore _, DNXCore _ -> true | MonoAndroid _, MonoAndroid _ -> true | MonoMac _, MonoMac _ -> true - | Runtimes _, Runtimes _ -> true + //| Runtimes _, Runtimes _ -> true | MonoTouch _, MonoTouch _ -> true | Windows _, Windows _ -> true | WindowsPhoneApp _, WindowsPhoneApp _ -> true @@ -314,7 +314,7 @@ 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))) + //| 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) @@ -619,20 +619,20 @@ 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) @ + //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 27ad1b76da..8da7fc96e9 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -83,11 +83,14 @@ type InstallFiles with 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 = { Name : string Targets : TargetProfile list - Files : InstallFiles} + Files : InstallFiles } member this.GetSinglePlatforms() = this.Targets @@ -123,8 +126,9 @@ type AnalyzerLib = type InstallModel = { PackageName : PackageName PackageVersion : SemVerInfo - LegacyReferenceFileFolders : LibFolder list - NewReferenceFileFolders : LibFolder list + CompileLibFolders : LibFolder list + CompileRefFolders : LibFolder list + RuntimeLibFolders : LibFolder list TargetsFileFolders : LibFolder list Analyzers: AnalyzerLib list LicenseUrl: string option } @@ -221,7 +225,7 @@ module FolderScanner = | Some error -> ScanParserFailure error | None -> - ScanSuccess (results |> Seq.map (function ParseSucceeded res -> res | ParseError _ -> failwithf "Should not happen here") |> Seq.toArray) + ScanSuccess (results |> Array.map (function ParseSucceeded res -> res | ParseError _ -> failwithf "Should not happen here")) let inline toGenericTuple<'t> (matches:obj[]) = if matches.Length = 1 then matches.[0] :?> 't @@ -292,7 +296,7 @@ module FolderScanner = | Some error -> ScanParserFailure error | None -> - ScanSuccess (results |> Seq.map (function ParseSucceeded res -> res | ParseError _ -> failwithf "Should not happen here") |> Seq.toArray) + ScanSuccess (results |> Array.map (function ParseSucceeded res -> res | ParseError _ -> failwithf "Should not happen here")) | _ as s -> s let trySscanfExt advancedScanners (pf:PrintfFormat<_,_,_,_,'t>) s : 't option = @@ -321,46 +325,74 @@ module InstallModel = // A lot of insights can be gained from https://github.com/NuGet/NuGet.Client/blob/85731166154d0818d79a19a6d2417de6aa851f39/src/NuGet.Core/NuGet.Packaging/ContentModel/ManagedCodeConventions.cs#L385-L505 // if you read this update the hash ;) open Logging + open PlatformMatching let emptyModel packageName packageVersion = { PackageName = packageName PackageVersion = packageVersion - LegacyReferenceFileFolders = [] - NewReferenceFileFolders = [] + CompileLibFolders = [] + CompileRefFolders = [] + RuntimeLibFolders = [] TargetsFileFolders = [] Analyzers = [] LicenseUrl = None } - let getReferenceFolders (installModel: InstallModel) = - installModel.LegacyReferenceFileFolders @ - (installModel.NewReferenceFileFolders - |> List.choose (fun r -> - match installModel.LegacyReferenceFileFolders |> List.tryFind (fun r2 -> r2.Targets = r.Targets) with - | None -> Some r - | _ -> None)) - - //let getLibraryFolders (installModel: InstallModel) = - // if installModel.NewReferenceFileFolders.IsEmpty then - // installModel.LegacyReferenceFileFolders - // else installModel.NewReferenceFileFolders - - let extractRefFolder packageName (path:UnparsedPackageFile) = - let path = path.FullPath.Replace("\\", "/").ToLower() - Utils.extractPath ("ref", packageName, path) - - let extractLibFolder packageName (path:UnparsedPackageFile) = - let path = path.FullPath.Replace("\\", "/").ToLower() - if path.Contains "runtimes" then - Utils.extractPath ("runtimes", packageName, path) - else - Utils.extractPath ("lib", packageName, path) - - let extractBuildFolder packageName (path:UnparsedPackageFile) = Utils.extractPath ("build", packageName, path.FullPath) + type Tfm = PlatformMatching.ParsedPlatformPath + type Rid = RuntimeIdentifier + let scanners = + [ { FolderScanner.AdvancedScanner.Name = "noSeperator"; + FolderScanner.AdvancedScanner.Parser = FolderScanner.check "seperator not allowed" (fun s -> not (s.Contains "/" || s.Contains "\\")) >> FolderScanner.ParseResult.box } + { FolderScanner.AdvancedScanner.Name = "tfm"; + FolderScanner.AdvancedScanner.Parser = PlatformMatching.extractPlatforms >> FolderScanner.ParseResult.ParseSucceeded >> FolderScanner.ParseResult.box } + { FolderScanner.AdvancedScanner.Name = "rid"; + FolderScanner.AdvancedScanner.Parser = (fun rid -> { Rid = rid }) >> FolderScanner.ParseResult.ParseSucceeded >> FolderScanner.ParseResult.box }] + let trySscanf pf s = FolderScanner.trySscanfExt scanners 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 }) + + 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.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.orElseWith (fun _ -> + (trySscanf "lib/%A{noSeperator}" p.PathWithinPackage : string option) + |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = RuntimeIdentifier.Any })) + + let getCompileLibAssembly (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.orElseWith (fun _ -> + (trySscanf "lib/%A{noSeperator}" p.PathWithinPackage : string option) + |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = RuntimeIdentifier.Any })) + + let getNativeLibraries (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.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 })) + + 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.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 - LegacyReferenceFileFolders = List.map mapfn installModel.LegacyReferenceFileFolders - NewReferenceFileFolders = List.map mapfn installModel.NewReferenceFileFolders + 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) = @@ -372,28 +404,56 @@ module InstallModel = | Some folder -> folder.Files.References |> Seq.choose choosefn | None -> Seq.empty - let getLibReferences (target : TargetProfile) installModel = + /// 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) + |> Seq.cache + + [] + let getCompileLibFolders (installModel: InstallModel) = installModel.CompileLibFolders + + /// This is for reference assemblies (new dotnetcore world) + let getCompileReferences (target: TargetProfile) (installModel : InstallModel) = let results = - getFileFolders target (getReferenceFolders installModel) (function Reference.Library lib -> Some lib | _ -> None) - |> Seq.cache + getFileFolders target (installModel.CompileRefFolders) (function Reference.Library lib -> Some lib | _ -> None) + |> Seq.cache if results |> Seq.isEmpty then - getFileFolders target installModel.LegacyReferenceFileFolders (function Reference.Library lib -> Some lib | _ -> None) + // 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) - let getPlatformReferences frameworkIdentifier installModel = - getLibReferences (SinglePlatform frameworkIdentifier) installModel + /// 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 - let getFrameworkAssembliesLazy installModel = - lazy ([ for lib in getReferenceFolders installModel do + /// 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) - let getLibReferencesLazy installModel = - lazy ([ for lib in getReferenceFolders installModel do + /// 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) @@ -403,25 +463,30 @@ module InstallModel = |> Set.ofList) let removeIfCompletelyEmpty (this:InstallModel) = - if Set.isEmpty (getFrameworkAssembliesLazy this |> force) - && Set.isEmpty (getLibReferencesLazy this |> force) + 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 emptyModel this.PackageName this.PackageVersion else this - let calcLibFoldersG extract packageName (libs:UnparsedPackageFile list) = - libs - |> List.choose (extract packageName) - |> List.distinct + let calcLibFoldersG (parsePackage : UnparsedPackageFile -> FrameworkDependentFile option) (libs:UnparsedPackageFile list) = + libs + |> List.choose parsePackage + |> List.map (fun p -> p.Path) + |> List.distinctBy (fun f -> f.Name) |> List.sort |> PlatformMatching.getSupportedTargetProfiles - |> Seq.map (fun entry -> { Name = entry.Key; Targets = entry.Value; Files = InstallFiles.empty }) + |> Seq.map (fun entry -> { Name = entry.Key.Name; Targets = entry.Value; Files = InstallFiles.empty }) |> Seq.toList - let calcLibFolders = calcLibFoldersG extractLibFolder - let calcRefFolders = calcLibFoldersG extractRefFolder + let calcLegacyReferenceLibFolders = calcLibFoldersG getCompileLibAssembly + let calcReferenceFolders = calcLibFoldersG getCompileRefAssembly + let calcRuntimeFolders = calcLibFoldersG getRuntimeAssembly + //let calcRefFolders = calcLibFoldersG extractRefFolder let addFileToFolder (path:LibFolder) (file:UnparsedPackageFile) (folders:LibFolder list) (addfn: string -> InstallFiles -> InstallFiles) = folders @@ -429,7 +494,7 @@ module InstallModel = if p.Name <> path.Name then p else { p with Files = addfn file.FullPath p.Files }) - let private addPackageFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = + let private addPackageLegacyLibFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true @@ -437,7 +502,7 @@ module InstallModel = if not install then this else { this with - LegacyReferenceFileFolders = addFileToFolder path file this.LegacyReferenceFileFolders InstallFiles.addReference } + CompileLibFolders = addFileToFolder path file this.CompileLibFolders InstallFiles.addReference } let private addPackageRefFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = let install = @@ -447,24 +512,40 @@ module InstallModel = if not install then this else { this with - NewReferenceFileFolders = addFileToFolder path file this.NewReferenceFileFolders InstallFiles.addReference } + CompileRefFolders = addFileToFolder path file this.CompileRefFolders InstallFiles.addReference } + + let private addPackageRuntimeFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = + let install = + match references with + | NuspecReferences.All -> true + | NuspecReferences.Explicit list -> List.exists file.FullPath.EndsWith list + + if not install then this else + { this with + RuntimeLibFolders = addFileToFolder path file this.RuntimeLibFolders InstallFiles.addReference } let addLibReferences (libs:UnparsedPackageFile seq) references (installModel:InstallModel) : InstallModel = let libs = libs |> Seq.toList - let libFolders = calcLibFolders installModel.PackageName libs - let refFolders = calcRefFolders installModel.PackageName libs + let legacyLibFolders = calcLegacyReferenceLibFolders libs + let refFolders = calcReferenceFolders libs + let runtimeFolders = calcRuntimeFolders libs let addItem extract addFunc getFolder initialState = List.fold (fun (model:InstallModel) file -> - match extract installModel.PackageName file with - | Some folderName -> - match List.tryFind (fun folder -> folder.Name = folderName) (getFolder model) with + match extract file with + | Some (folderName:FrameworkDependentFile) -> + match List.tryFind (fun (folder:LibFolder) -> folder.Name = folderName.Path.Name) (getFolder model) with | Some path -> addFunc path file references model | _ -> model | None -> model) initialState libs - let newState = addItem extractLibFolder addPackageFile (fun i -> i.LegacyReferenceFileFolders) { installModel with LegacyReferenceFileFolders = libFolders } - addItem extractRefFolder addPackageRefFile (fun i -> i.NewReferenceFileFolders) { newState with NewReferenceFileFolders = refFolders } + { installModel with + CompileLibFolders = legacyLibFolders + CompileRefFolders = refFolders + RuntimeLibFolders = runtimeFolders } + |> addItem getCompileLibAssembly addPackageLegacyLibFile (fun i -> i.CompileLibFolders) + |> addItem getCompileRefAssembly addPackageRefFile (fun i -> i.CompileRefFolders) + |> addItem getRuntimeAssembly addPackageRuntimeFile (fun i -> i.RuntimeLibFolders) let addAnalyzerFiles (analyzerFiles:UnparsedPackageFile seq) (installModel:InstallModel) : InstallModel = let analyzerLibs = @@ -505,9 +586,10 @@ module InstallModel = |> List.exists (fun t -> t >= min && t < max && t.IsSameCategoryAs(min))) let model = - if List.isEmpty installModel.LegacyReferenceFileFolders then - let folders = calcLibFolders installModel.PackageName [{ FullPath ="lib/Default.dll"; PathWithinPackage = "lib/Default.dll" }] - { installModel with LegacyReferenceFileFolders = folders } + if List.isEmpty installModel.CompileLibFolders then + // TODO: Ask forki about this wtf + let folders = calcLegacyReferenceLibFolders [{ FullPath ="lib/Default.dll"; PathWithinPackage = "lib/Default.dll" }] + { installModel with CompileLibFolders = folders } else installModel @@ -562,13 +644,18 @@ module InstallModel = { folder with Targets = applyRestrictionsToTargets restrictions folder.Targets} { installModel with - LegacyReferenceFileFolders = - installModel.LegacyReferenceFileFolders + CompileLibFolders = + installModel.CompileLibFolders |> List.map applRestriction |> List.filter (fun folder -> folder.Targets <> []) - NewReferenceFileFolders = - installModel.NewReferenceFileFolders + CompileRefFolders = + installModel.CompileRefFolders + |> List.map applRestriction + |> List.filter (fun folder -> folder.Targets <> []) + + RuntimeLibFolders = + installModel.RuntimeLibFolders |> List.map applRestriction |> List.filter (fun folder -> folder.Targets <> []) @@ -580,16 +667,17 @@ module InstallModel = let rec addTargetsFiles (targetsFiles:UnparsedPackageFile list) (this:InstallModel) : InstallModel = let targetsFileFolders = targetsFiles - |> List.choose (extractBuildFolder this.PackageName) + |> List.choose getMsbuildFile + |> List.map (fun p -> p.Path) |> List.distinct |> PlatformMatching.getSupportedTargetProfiles - |> Seq.map (fun entry -> { Name = entry.Key; Targets = List.ofSeq entry.Value; Files = InstallFiles.empty }) + |> Seq.map (fun entry -> { Name = entry.Key.Name; Targets = List.ofSeq entry.Value; Files = InstallFiles.empty }) |> Seq.toList List.fold (fun model file -> - match extractBuildFolder this.PackageName file with + match getMsbuildFile file with | Some folderName -> - match List.tryFind (fun folder -> folder.Name = folderName) model.TargetsFileFolders with + match List.tryFind (fun (folder:LibFolder) -> folder.Name = folderName.Path.Name) model.TargetsFileFolders with | Some path -> addTargetsFile path file model | _ -> model | None -> model) { this with TargetsFileFolders = targetsFileFolders } targetsFiles @@ -621,25 +709,40 @@ type InstallModel with static member EmptyModel (packageName, packageVersion) = InstallModel.emptyModel packageName packageVersion - member this.GetReferenceFolders() = InstallModel.getReferenceFolders this + [] + 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.getLibReferences target 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.GetLibReferences frameworkIdentifier = InstallModel.getPlatformReferences frameworkIdentifier this + [] + member this.GetLibReferences frameworkIdentifier = InstallModel.getLegacyPlatformReferences frameworkIdentifier this member this.GetTargetsFiles target = InstallModel.getTargetsFiles target this - member this.GetFrameworkAssembliesLazy = InstallModel.getFrameworkAssembliesLazy this + [] + member this.GetFrameworkAssembliesLazy = InstallModel.getLegacyFrameworkAssembliesLazy this + member this.GetLegacyFrameworkAssembliesLazy = InstallModel.getLegacyFrameworkAssembliesLazy this - member this.GetLibReferencesLazy = InstallModel.getLibReferencesLazy 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.CalcLibFolders libs = InstallModel.calcLibFolders libs + [] + member this.CalcLibFolders libs = InstallModel.calcLegacyReferenceLibFolders libs + member this.CalcLegacyReferencesFolders libs = InstallModel.calcLegacyReferenceLibFolders libs + member this.CalcReferencesFolders libs = InstallModel.calcReferenceFolders libs + member this.AddLibReferences (libs, references) = InstallModel.addLibReferences libs references this diff --git a/src/Paket.Core/InstallProcess.fs b/src/Paket.Core/InstallProcess.fs index 33379f37b4..85c3cca3c2 100644 --- a/src/Paket.Core/InstallProcess.fs +++ b/src/Paket.Core/InstallProcess.fs @@ -261,8 +261,11 @@ let private applyBindingRedirects isFirstGroup createNewBindingFiles redirects c dependencies |> Set.filter (fst >> ((=) model.PackageName)) |> Seq.collect (fun (_,profile) -> - model.GetLibReferences profile - |> Seq.map (fun x -> x, redirects, profile))) + let res = + model.GetLibReferences profile + |> Seq.map (fun x -> x, redirects, profile) + |> Seq.toArray + res)) |> Seq.groupBy (fun (p,_,profile) -> profile,FileInfo(p).Name) |> Seq.choose(fun (_,librariesForPackage) -> librariesForPackage diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index 6521891425..a366e0cb85 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -614,7 +614,7 @@ let private getFilesMatching targetFolder searchPattern subFolderName filesDescr |> Array.filter (fun fi -> String.equalsIgnoreCase fi.FullName path) |> Array.collect (fun dir -> dir.GetFiles(searchPattern, SearchOption.AllDirectories)) |> Array.map (fun file -> - { UnparsedPackageFile.FullPath = file.FullName; UnparsedPackageFile.PathWithinPackage = file.FullName.Substring(dir.FullName.Length) }) + { UnparsedPackageFile.FullPath = file.FullName; UnparsedPackageFile.PathWithinPackage = file.FullName.Substring(dir.FullName.Length + 1).Replace("\\", "/") }) else [||] diff --git a/src/Paket.Core/PlatformMatching.fs b/src/Paket.Core/PlatformMatching.fs index 829e909fc7..314f44c54f 100644 --- a/src/Paket.Core/PlatformMatching.fs +++ b/src/Paket.Core/PlatformMatching.fs @@ -5,26 +5,40 @@ open System [] let MaxPenalty = 1000000 -let inline split (path : string) = +type ParsedPlatformPath = + { Name : string + Platforms : FrameworkIdentifier list } + static member Empty = { Name = ""; Platforms = [] } + +let inline split (path : string) = path.Split('+') |> Array.map (fun s -> System.Text.RegularExpressions.Regex.Replace(s, "portable\\d*-","")) - -let extractPlatforms = memoize (fun path -> split path |> Array.choose FrameworkDetection.Extract |> Array.toList) + +let extractPlatforms = memoize (fun path -> { Name = path; Platforms = split path |> Array.choose FrameworkDetection.Extract |> Array.toList }) let knownInPortable = KnownTargetProfiles.AllPortableProfiles |> List.collect snd |> List.distinct -let extractAndTryGetProfile = memoize (fun path -> - let platforms = extractPlatforms path +let tryGetProfile platforms = let filtered = - platforms + platforms.Platforms |> List.filter (fun p -> knownInPortable |> Seq.exists ((=) p)) |> List.sort KnownTargetProfiles.AllPortableProfiles |> Seq.tryFind (snd >> List.sort >> (=) filtered) - |> Option.map PortableProfile) + |> Option.map PortableProfile + +//let extractAndTryGetProfile = memoize (fun path -> +// let platforms = extractPlatforms path +// let filtered = +// platforms.Platforms +// |> List.filter (fun p -> knownInPortable |> Seq.exists ((=) p)) +// |> List.sort +// +// KnownTargetProfiles.AllPortableProfiles |> Seq.tryFind (snd >> List.sort >> (=) filtered) +// |> Option.map PortableProfile) let getPlatformPenalty = let rec getPlatformPenalty alreadyChecked (targetPlatform:FrameworkIdentifier) (packagePlatform:FrameworkIdentifier) = @@ -48,27 +62,27 @@ let getPlatformPenalty = let getPathPenalty = memoize - (fun (path:string,platform:FrameworkIdentifier) -> - if String.IsNullOrWhiteSpace path then + (fun (path:ParsedPlatformPath,platform:FrameworkIdentifier) -> + if String.IsNullOrWhiteSpace path.Name then match platform with | Native(_) -> MaxPenalty // an empty path is considered incompatible with native targets | _ -> 500 // an empty path is considered compatible with every .NET target, but with a high penalty so explicit paths are preferred else - extractPlatforms path + path.Platforms |> List.map (fun target -> getPlatformPenalty(platform,target)) |> List.append [ MaxPenalty ] |> List.min) // Checks wether a list of target platforms is supported by this path and with which penalty. -let getPenalty (requiredPlatforms:FrameworkIdentifier list) (path:string) = +let getPenalty (requiredPlatforms:FrameworkIdentifier list) (path:ParsedPlatformPath) = requiredPlatforms |> List.sumBy (fun p -> getPathPenalty(path,p)) -type PathPenalty = (string * int) +type PathPenalty = (ParsedPlatformPath * int) let comparePaths (p1 : PathPenalty) (p2 : PathPenalty) = - let platformCount1 = (extractPlatforms (fst p1)).Length - let platformCount2 = (extractPlatforms (fst p2)).Length + let platformCount1 = (fst p1).Platforms.Length + let platformCount2 = (fst p2).Platforms.Length // prefer full framework over portable if platformCount1 = 1 && platformCount2 > 1 then @@ -107,14 +121,14 @@ let platformsSupport = let findBestMatch = - let rec findBestMatch (paths : string list, targetProfile : TargetProfile) = + let rec findBestMatch (paths : ParsedPlatformPath list, targetProfile : TargetProfile) = let requiredPlatforms = match targetProfile with | PortableProfile(_, platforms) -> platforms | SinglePlatform(platform) -> [ platform ] let supported = - paths + paths |> List.map (fun path -> path, (getPenalty requiredPlatforms path)) |> List.filter (fun (_, penalty) -> penalty < MaxPenalty) |> List.sortWith comparePaths @@ -123,7 +137,7 @@ let findBestMatch = let findBestPortableMatch findPenalty (portableProfile:TargetProfile) paths = paths - |> Seq.tryFind (fun p -> extractAndTryGetProfile p = Some portableProfile) + |> Seq.tryFind (fun p -> tryGetProfile p = Some portableProfile) |> Option.map (fun p -> p, findPenalty) match supported with @@ -140,18 +154,18 @@ let findBestMatch = None | _ -> None) |> List.distinct - |> List.sortBy (fun (x, pen) -> pen, (extractPlatforms x).Length) // prefer portable platform with less platforms + |> List.sortBy (fun (x, pen) -> pen, x.Platforms.Length) // prefer portable platform with less platforms |> List.map fst |> List.tryHead | path -> path - memoize (fun (paths : string list,targetProfile : TargetProfile) -> findBestMatch(paths,targetProfile)) + memoize (fun (paths : ParsedPlatformPath list,targetProfile : TargetProfile) -> findBestMatch(paths,targetProfile)) // For a given list of paths and target profiles return tuples of paths with their supported target profiles. // Every target profile will only be listed for own path - the one that best supports it. let getSupportedTargetProfiles = memoize - (fun (paths : string list) -> + (fun (paths : ParsedPlatformPath list) -> KnownTargetProfiles.AllProfiles |> List.choose (fun target -> match findBestMatch(paths,target) with @@ -185,7 +199,7 @@ let getTargetCondition (target:TargetProfile) = | XamarinMac -> "$(TargetFrameworkIdentifier) == 'Xamarin.Mac'", "" | Native("","") -> "true", "" | Native("",bits) -> (sprintf "'$(Platform)'=='%s'" bits), "" - | Runtimes(platform) -> failwithf "Runtime dependencies are unsupported in project files." + //| Runtimes(platform) -> failwithf "Runtime dependencies are unsupported in project files." | Native(profile,bits) -> (sprintf "'$(Configuration)|$(Platform)'=='%s|%s'" profile bits), "" | PortableProfile(name, _) -> sprintf "$(TargetFrameworkProfile) == '%O'" name,"" @@ -228,7 +242,7 @@ let getCondition (referenceCondition:string option) (allTargets: TargetProfile l targets |> List.filter (function | SinglePlatform(Native("", "")) -> false - | SinglePlatform(Runtimes(_)) -> false + //| SinglePlatform(Runtimes(_)) -> false | SinglePlatform(DotNetFramework(FrameworkVersion.V4_Client)) -> targets |> List.contains (SinglePlatform(DotNetFramework(FrameworkVersion.V4))) |> not | _ -> true) diff --git a/src/Paket.Core/Requirements.fs b/src/Paket.Core/Requirements.fs index 14cd85f21c..5693b39252 100644 --- a/src/Paket.Core/Requirements.fs +++ b/src/Paket.Core/Requirements.fs @@ -68,7 +68,7 @@ let parseRestrictions failImmediatly (text:string) = match FrameworkDetection.Extract(framework) with | None -> - if PlatformMatching.extractPlatforms framework |> List.isEmpty |> not then + if (PlatformMatching.extractPlatforms framework).Platforms |> List.isEmpty |> not then yield FrameworkRestriction.Portable framework else handleError <| sprintf "Could not parse framework '%s'. Try to update or install again or report a paket bug." framework @@ -503,7 +503,7 @@ let isTargetMatchingRestrictions = memoize <| fun (restrictions:FrameworkRestriction list, target) -> if List.isEmpty restrictions then true else match target with - | SinglePlatform (Runtimes _ ) -> true + //| SinglePlatform (Runtimes _ ) -> true | SinglePlatform pf -> restrictions |> List.exists (fun restriction -> diff --git a/src/Paket.Core/ScriptGeneration.fs b/src/Paket.Core/ScriptGeneration.fs index 816d17ea9f..696a1215c2 100644 --- a/src/Paket.Core/ScriptGeneration.fs +++ b/src/Paket.Core/ScriptGeneration.fs @@ -57,7 +57,7 @@ module PackageAndAssemblyResolution = let getDllsWithinPackage (framework: FrameworkIdentifier) (installModel :InstallModel) = let dllFiles = installModel - |> InstallModel.getLibReferences (SinglePlatform framework) + |> InstallModel.getLegacyReferences (SinglePlatform framework) |> Seq.map (fun path -> AssemblyDefinition.ReadAssembly path, FileInfo(path)) |> dict @@ -77,7 +77,7 @@ module PackageAndAssemblyResolution = then List.empty else installModel - |> InstallModel.getFrameworkAssembliesLazy + |> InstallModel.getLegacyFrameworkAssembliesLazy |> force |> Set.toList diff --git a/src/Paket.Core/Utils.fs b/src/Paket.Core/Utils.fs index 58806a01e9..73a6568d21 100644 --- a/src/Paket.Core/Utils.fs +++ b/src/Paket.Core/Utils.fs @@ -158,60 +158,6 @@ let inline createRelativePath root path = let uri = Uri basePath uri.MakeRelativeUri(Uri path).ToString().Replace("/", "\\").Replace("%20", " ") -let getNative (path:string) = - if path.Contains "/native/" |> not && path.Contains "/runtimes/" |> not then "" else - if path.Contains "/x86/debug" then "x86/debug" else - if path.Contains "/x86/release" then "/x86/release" else - if path.Contains "/arm/debug" then "/arm/debug" else - if path.Contains "/arm/release" then "/arm/release" else - if path.Contains "/x64/debug" then "/x64/debug" else - if path.Contains "/x64/release" then "/x64/release" else - if path.Contains "/address-model-32" then "/address-model-32" else - if path.Contains "/address-model-64" then "/address-model-64" else - if path.Contains "/win7-x64" then "/win7-x64" else - if path.Contains "/win7-x86" then "/win7-x86" else - if path.Contains "/win7-arm" then "/win7-arm" else - if path.Contains "/debian-x64" then "/debian-x64" else - if path.Contains "/aot" then "/aot" else - if path.Contains "/osx" then "/osx" else - if path.Contains "/win" then "/win" else - if path.Contains "/linux" then "/linux" else - if path.Contains "/unix" then "/unix" else - "" - -let extractPath = - memoize <| fun (infix, packageName:PackageName, fileName : string) -> - let path = fileName.Replace("\\", "/").ToLower() - let path = if path.StartsWith "lib/" then "/" + path else path - let needle = sprintf "/%s/" infix - if path.Contains needle |> not then None else - let fi = FileInfo path - - let packagesPos = path.LastIndexOf "packages/" - let startPos = - if packagesPos >= 0 then - let packagenamePos = path.IndexOf(packageName.ToString().ToLower() + "/",packagesPos) - if packagenamePos >= 0 then - path.IndexOf(needle,packagenamePos) + 1 - else - path.IndexOf(needle,packagesPos) + 1 - else - path.LastIndexOf(needle) + 1 - - let endPos = path.IndexOf('/', startPos + infix.Length + 1) - if startPos < 0 then None - elif endPos < 0 then Some("") - else - if infix = "runtimes" then - Some("runtimes" + getNative path) - elif infix = "ref" then - let libPart = path.Substring(startPos + infix.Length + 1, endPos - startPos - infix.Length - 1) - Some libPart - else - let nativePart = getNative path - let libPart = path.Substring(startPos + infix.Length + 1, endPos - startPos - infix.Length - 1) - Some (libPart + nativePart) - /// The path of the "Program Files" folder - might be x64 on x64 machine let ProgramFiles = Environment.GetFolderPath Environment.SpecialFolder.ProgramFiles diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index 87dbf7a789..41ea8a71e3 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -37,8 +37,8 @@ D:\temp\coreclrtest install C:\dev\src\Paket\integrationtests\scenarios\loading-scripts\dependencies-file-flag\temp - update - C:\PROJ\paket.test\ + install --createnewbindingfiles + C:\PROJ\Paket\integrationtests\scenarios\i001270-force-redirects\temp pdbonly diff --git a/tests/Paket.Tests/InstallModel/Penalty/PenaltySpecs.fs b/tests/Paket.Tests/InstallModel/Penalty/PenaltySpecs.fs index 5455f84606..0103fb9bf8 100644 --- a/tests/Paket.Tests/InstallModel/Penalty/PenaltySpecs.fs +++ b/tests/Paket.Tests/InstallModel/Penalty/PenaltySpecs.fs @@ -5,107 +5,120 @@ open NUnit.Framework open FsUnit open Paket.PlatformMatching -module ``Given a target platform`` = +module ``Given a target platform`` = [] - let ``it should return no penalty for the same platform``() = - getPlatformPenalty (DotNetFramework FrameworkVersion.V4_5, DotNetFramework FrameworkVersion.V4_5) + let ``it should return no penalty for the same platform``() = + getPlatformPenalty (DotNetFramework FrameworkVersion.V4_5, DotNetFramework FrameworkVersion.V4_5) |> shouldEqual 0 - + [] - let ``it should return the right penalty for a compatible platform``() = - getPlatformPenalty (DotNetFramework FrameworkVersion.V4_5, DotNetFramework FrameworkVersion.V4) + let ``it should return the right penalty for a compatible platform``() = + getPlatformPenalty (DotNetFramework FrameworkVersion.V4_5, DotNetFramework FrameworkVersion.V4) |> shouldEqual 1 - + [] - let ``it should return > 1000 for an incompatible platform``() = + let ``it should return > 1000 for an incompatible platform``() = getPlatformPenalty (DotNetFramework FrameworkVersion.V4_5, Silverlight "v5.0") |> shouldBeGreaterThan MaxPenalty [] - let ``it should prefer .net proper``() = + let ``it should prefer .net proper``() = let p1 = getPlatformPenalty (DotNetFramework FrameworkVersion.V4_6_2, DotNetFramework FrameworkVersion.V4_5_1) let p2 = getPlatformPenalty (DotNetFramework FrameworkVersion.V4_6_2, DotNetStandard DotNetStandardVersion.V1_5) p1 |> shouldBeSmallerThan p2 -module ``Given a path`` = +module ``Given a path`` = [] - let ``it should split it into the right platforms``() = - extractPlatforms "net40+win8" |> shouldEqual [ DotNetFramework FrameworkVersion.V4_Client - Windows "v4.5" ] - + let ``it should split it into the right platforms``() = + extractPlatforms "net40+win8" + |> shouldEqual + { Platforms = [ DotNetFramework FrameworkVersion.V4_Client; Windows "v4.5" ] + Name = "net40+win8" } + [] - let ``it should ignore 'portable-'``() = - extractPlatforms "portable-net40+win8" |> shouldEqual [ DotNetFramework FrameworkVersion.V4_Client - Windows "v4.5" ] - + let ``it should ignore 'portable-'``() = + extractPlatforms "portable-net40+win8" + |> shouldEqual + { Platforms = [ DotNetFramework FrameworkVersion.V4_Client; Windows "v4.5" ] + Name = "portable-net40+win8" } + [] - let ``it should return no penalty for a matching .NET framework``() = - getPenalty [ DotNetFramework FrameworkVersion.V4_5 ] "net45" |> shouldEqual 0 - + let ``it should return no penalty for a matching .NET framework``() = + let path = extractPlatforms "net45" + getPenalty [ DotNetFramework FrameworkVersion.V4_5 ] path |> shouldEqual 0 + [] - let ``it should return no penalty for a matching portable profile``() = + let ``it should return no penalty for a matching portable profile``() = + let path = extractPlatforms "net40+sl4" getPenalty [ DotNetFramework FrameworkVersion.V4_Client - Silverlight "v4.0" ] "net40+sl4" + Silverlight "v4.0" ] path |> shouldEqual 0 - + [] - let ``it should return 1 for a compatible portable profile``() = + let ``it should return 1 for a compatible portable profile``() = + let path = extractPlatforms "net40+sl4" getPenalty [ DotNetFramework FrameworkVersion.V4_Client - Silverlight "v5.0" ] "net40+sl4" + Silverlight "v5.0" ] path |> shouldEqual 1 - + [] - let ``it should return the correct penalty for compatible .NET Frameworks``() = - let path = "net20" + let ``it should return the correct penalty for compatible .NET Frameworks``() = + let path = extractPlatforms "net20" getPenalty [ DotNetFramework FrameworkVersion.V2 ] path |> shouldEqual 0 getPenalty [ DotNetFramework FrameworkVersion.V3 ] path |> shouldEqual 1 getPenalty [ DotNetFramework FrameworkVersion.V3_5 ] path |> shouldEqual 2 getPenalty [ DotNetFramework FrameworkVersion.V4_Client ] path |> shouldEqual 3 -module ``Given an empty path`` = +module ``Given an empty path`` = [] - let ``it should be okay to use from .NET``() = - getPenalty [ DotNetFramework FrameworkVersion.V4_5 ] "" |> shouldBeSmallerThan 1000 + let ``it should be okay to use from .NET``() = + let path = extractPlatforms "" + getPenalty [ DotNetFramework FrameworkVersion.V4_5 ] path |> shouldBeSmallerThan 1000 [] - let ``it should be okay to use from a portable profile``() = - getPenalty [ DotNetFramework FrameworkVersion.V4_5; Windows "v4.5"; WindowsPhoneApp "v8.1" ] "" |> shouldBeSmallerThan 2000 + let ``it should be okay to use from a portable profile``() = + let path = extractPlatforms "" + getPenalty [ DotNetFramework FrameworkVersion.V4_5; Windows "v4.5"; WindowsPhoneApp "v8.1" ] path |> shouldBeSmallerThan 2000 -module ``Given a list of paths`` = - let paths = - [ "net40"; "portable-monotouch+monoandroid"; "portable-net40+sl5+win8+wp8+wpa81"; - "portable-net45+winrt45+wp8+wpa81"; "portable-win81+wpa81"; "portable-windows8+net45+wp8"; "sl5"; "win8"; +module ``Given a list of paths`` = + let paths = + [ "net40"; "portable-monotouch+monoandroid"; "portable-net40+sl5+win8+wp8+wpa81" + "portable-net45+winrt45+wp8+wpa81"; "portable-win81+wpa81"; "portable-windows8+net45+wp8"; "sl5"; "win8" "wp8" ] - + |> List.map extractPlatforms + let find n = + paths + |> Seq.find (fun p -> p.Name = n) + [] - let ``it should find the best match for .NET 4.0``() = - findBestMatch (paths, SinglePlatform(DotNetFramework FrameworkVersion.V4)) |> shouldEqual (Some "net40") - + let ``it should find the best match for .NET 4.0``() = + findBestMatch (paths, SinglePlatform(DotNetFramework FrameworkVersion.V4)) |> shouldEqual (find "net40" |> Some) + [] - let ``it should find the best match for Silverlight 5``() = - findBestMatch (paths, SinglePlatform(Silverlight "v5.0")) |> shouldEqual (Some "sl5") - + let ``it should find the best match for Silverlight 5``() = + findBestMatch (paths, SinglePlatform(Silverlight "v5.0")) |> shouldEqual (find "sl5"|> Some) + [] - let ``it should find no match for Silverlight 4``() = + let ``it should find no match for Silverlight 4``() = findBestMatch (paths, SinglePlatform(Silverlight "v4.0")) |> shouldEqual None - + [] - let ``it should prefer (older) full .NET frameworks over portable class libraries``() = - findBestMatch (paths, SinglePlatform(DotNetFramework FrameworkVersion.V4_5)) |> shouldEqual (Some "net40") - - module ``when I get the supported target profiles`` = + let ``it should prefer (older) full .NET frameworks over portable class libraries``() = + findBestMatch (paths, SinglePlatform(DotNetFramework FrameworkVersion.V4_5)) |> shouldEqual (find "net40"|> Some) + + module ``when I get the supported target profiles`` = let supportedTargetProfiles = getSupportedTargetProfiles paths - + [] - let ``it should contain profile 32``() = - supportedTargetProfiles.["portable-win81+wpa81"] + let ``it should contain profile 32``() = + supportedTargetProfiles.[find "portable-win81+wpa81"] |> shouldContain (KnownTargetProfiles.FindPortableProfile "Profile32") - + [] - let ``it should not contain profile 41``() = + let ``it should not contain profile 41``() = let flattend = - seq { + seq { for item in supportedTargetProfiles do yield! item.Value } @@ -114,128 +127,127 @@ module ``Given a list of paths`` = module ``ProfileAnalyzer tests`` = [] let ``test that we cannot detect portable-net40+sl4+win8+wp71+wpa81`` () = - let res = Paket.PlatformMatching.extractAndTryGetProfile "portable-net40+sl4+win8+wp71+wpa81" + let res = Paket.PlatformMatching.tryGetProfile (extractPlatforms "portable-net40+sl4+win8+wp71+wpa81") res |> shouldEqual None module ``General Penalty checks`` = - [] let ``prefer net20 over emtpy folder``()= - Paket.PlatformMatching.findBestMatch ([""; "net20"], SinglePlatform(DotNetFramework(FrameworkVersion.V4_6_1))) - |> shouldEqual (Some "net20") + Paket.PlatformMatching.findBestMatch ([""; "net20"] |> List.map extractPlatforms, SinglePlatform(DotNetFramework(FrameworkVersion.V4_6_1))) + |> shouldEqual (Some (extractPlatforms "net20")) [] let ``best match for DotNet Standard 1.0``()= - Paket.PlatformMatching.findBestMatch (["net20"; "net40"; "net45"; "net451"], SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_0))) + Paket.PlatformMatching.findBestMatch (["net20"; "net40"; "net45"; "net451"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_0))) |> shouldEqual (None) [] let ``best match for DotNet Standard 1.1``()= - Paket.PlatformMatching.findBestMatch (["net20"; "net40"; "net45"; "net451"], SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_1))) + Paket.PlatformMatching.findBestMatch (["net20"; "net40"; "net45"; "net451"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_1))) |> shouldEqual (None) [] let ``best match for DotNet Standard 1.5``()= - Paket.PlatformMatching.findBestMatch (["net20"; "net40"; "net45"; "net451"], SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_5))) + Paket.PlatformMatching.findBestMatch (["net20"; "net40"; "net45"; "net451"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_5))) |> shouldEqual (None) [] let ``best match for net45``()= - Paket.PlatformMatching.findBestMatch - (["netstandard10"; "netstandard11"; "netstandard12"; "netstandard13"; "netstandard14"; "netstandard15"; "netstandard16"], + Paket.PlatformMatching.findBestMatch + (["netstandard10"; "netstandard11"; "netstandard12"; "netstandard13"; "netstandard14"; "netstandard15"; "netstandard16"]|> List.map extractPlatforms, SinglePlatform(DotNetFramework(FrameworkVersion.V4_5))) - |> shouldEqual (Some ("netstandard11")) + |> shouldEqual (Some (extractPlatforms "netstandard11")) [] let ``best match for netstandard in portable``()= - Paket.PlatformMatching.findBestMatch - (["portable-netcore451+wpa81"], + Paket.PlatformMatching.findBestMatch + (["portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_1))) |> shouldEqual (None) - Paket.PlatformMatching.findBestMatch - (["portable-netcore451+wpa81"], + Paket.PlatformMatching.findBestMatch + (["portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_2))) - |> shouldEqual (Some ("portable-netcore451+wpa81")) - - Paket.PlatformMatching.findBestMatch - (["portable-netcore451+wpa81"], + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wpa81")) + + Paket.PlatformMatching.findBestMatch + (["portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_3))) - |> shouldEqual (Some ("portable-netcore451+wpa81")) - - Paket.PlatformMatching.findBestMatch - (["portable-netcore451+wpa81"], + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wpa81")) + + Paket.PlatformMatching.findBestMatch + (["portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_4))) - |> shouldEqual (Some ("portable-netcore451+wpa81")) - - Paket.PlatformMatching.findBestMatch - (["portable-netcore451+wpa81"], + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wpa81")) + + Paket.PlatformMatching.findBestMatch + (["portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_5))) - |> shouldEqual (Some ("portable-netcore451+wpa81")) + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wpa81")) - Paket.PlatformMatching.findBestMatch - (["portable-netcore451+wpa81"], + Paket.PlatformMatching.findBestMatch + (["portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_6))) - |> shouldEqual (Some ("portable-netcore451+wpa81")) + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wpa81")) [] let ``best match for netstandard, netstandard is preferred``()= - Paket.PlatformMatching.findBestMatch - (["portable-win81+wpa81"; "netstandard1.3"], + Paket.PlatformMatching.findBestMatch + (["portable-win81+wpa81"; "netstandard1.3"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_2))) - |> shouldEqual (Some ("portable-win81+wpa81")) - - Paket.PlatformMatching.findBestMatch - (["portable-win81+wpa81"; "netstandard1.3"], + |> shouldEqual (Some (extractPlatforms "portable-win81+wpa81")) + + Paket.PlatformMatching.findBestMatch + (["portable-win81+wpa81"; "netstandard1.3"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_3))) - |> shouldEqual (Some ("netstandard1.3")) - - Paket.PlatformMatching.findBestMatch - (["portable-win81+wpa81"; "netstandard1.3"], + |> shouldEqual (Some (extractPlatforms "netstandard1.3")) + + Paket.PlatformMatching.findBestMatch + (["portable-win81+wpa81"; "netstandard1.3"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_4))) - |> shouldEqual (Some ("netstandard1.3")) - + |> shouldEqual (Some (extractPlatforms "netstandard1.3")) + [] let ``best match for netstandard, use possible.``()= - Paket.PlatformMatching.findBestMatch + Paket.PlatformMatching.findBestMatch // Profile31 (supports netstandard1.0), Profile32 (supports netstandard1.2) - (["portable-netcore451+wp81"; "portable-netcore451+wpa81"], + (["portable-netcore451+wp81"; "portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_0))) - |> shouldEqual (Some "portable-netcore451+wp81") + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wp81")) - Paket.PlatformMatching.findBestMatch + Paket.PlatformMatching.findBestMatch // Profile31 (supports netstandard1.0), Profile32 (supports netstandard1.2) - (["portable-netcore451+wp81"; "portable-netcore451+wpa81"], + (["portable-netcore451+wp81"; "portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_2))) - |> shouldEqual (Some "portable-netcore451+wpa81") + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wpa81")) - Paket.PlatformMatching.findBestMatch + Paket.PlatformMatching.findBestMatch // Profile31 (supports netstandard1.0), Profile32 (supports netstandard1.2) - (["portable-netcore451+wp81"; "portable-netcore451+wpa81"], + (["portable-netcore451+wp81"; "portable-netcore451+wpa81"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_4))) - |> shouldEqual (Some "portable-netcore451+wpa81") + |> shouldEqual (Some (extractPlatforms "portable-netcore451+wpa81")) [] let ``make sure not all portable profiles match``()= // Not all portable profiles have a match. - Paket.PlatformMatching.findBestMatch - (["portable-net403+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1"], + Paket.PlatformMatching.findBestMatch + (["portable-net403+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1"]|> List.map extractPlatforms, SinglePlatform(DotNetStandard(DotNetStandardVersion.V1_0))) |> shouldEqual (None) [] let ``best match for net451``()= - Paket.PlatformMatching.findBestMatch - (["netstandard10"; "netstandard11"; "netstandard12"; "netstandard13"; "netstandard14"; "netstandard15"; "netstandard16"], + Paket.PlatformMatching.findBestMatch + (["netstandard10"; "netstandard11"; "netstandard12"; "netstandard13"; "netstandard14"; "netstandard15"; "netstandard16"]|> List.map extractPlatforms, SinglePlatform(DotNetFramework(FrameworkVersion.V4_5_1))) - |> shouldEqual (Some ("netstandard12")) + |> shouldEqual (Some (extractPlatforms "netstandard12")) [] let ``best match for net463``()= - Paket.PlatformMatching.findBestMatch - (["netstandard10"; "netstandard11"; "netstandard12"; "netstandard13"; "netstandard14"; "netstandard15"; "netstandard16"], + Paket.PlatformMatching.findBestMatch + (["netstandard10"; "netstandard11"; "netstandard12"; "netstandard13"; "netstandard14"; "netstandard15"; "netstandard16"]|> List.map extractPlatforms, SinglePlatform(DotNetFramework(FrameworkVersion.V4_6_3))) - |> shouldEqual (Some ("netstandard16")) + |> shouldEqual (Some (extractPlatforms "netstandard16")) diff --git a/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs b/tests/Paket.Tests/InstallModel/ProcessingSpecs.fs index 45e1c45064..a6cdb13154 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) } + { FullPath = i; PathWithinPackage = i.Substring(prefix.Length).Replace("\\", "/") } else failwithf "Expected '%s' to start with '%s'" i prefix) [] @@ -21,7 +21,7 @@ let ``should create empty model with net40, net45 ...``() = let model = emptymodel.AddReferences ([ @"..\Rx-Main\lib\net40\Rx.dll"; @"..\Rx-Main\lib\net45\Rx.dll" ] |> fromLegacyList @"..\Rx-Main\") let targets = - model.LegacyReferenceFileFolders + model.CompileLibFolders |> List.map (fun folder -> folder.Targets) |> List.concat @@ -41,11 +41,11 @@ let ``should understand lib in lib.dll``() = model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> 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.GetLibReferences(SinglePlatform (Runtimes("win7-x64"))) |> shouldContain @"..\Microsoft.AspNetCore.Server.Kestrel\runtimes\win7-x64\native\libuv.dll" [] let ``should understand reference folder``() = @@ -56,42 +56,79 @@ let ``should understand reference folder``() = @"..\System.Security.Cryptography.Algorithms\lib\net35\System.Security.Cryptography.Algorithms.dll" ] |> fromLegacyList @"..\System.Security.Cryptography.Algorithms\") - let refs = model.GetLibReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + let refs = model.GetLegacyReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + 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)) + 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)) + 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)) 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.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) + let refs = model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V3_5)) 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.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) + let refs = model.GetCompileReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) 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 model = - emptymodel.AddReferences + let model = + emptymodel.AddReferences ([ @"..\System.Security.Cryptography.Algorithms\runtimes\win\lib\net46\System.Security.Cryptography.Algorithms.dll" @"..\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.GetLibReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + let refs = model.GetLegacyReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) 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.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) + + let refs = model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_6_3)) 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\netcore50\System.Diagnostics.Contracts.dll" ] |> fromLegacyList @"..\packages\System.Diagnostics.Contracts\") + let refs = model.GetCompileReferences(SinglePlatform (DotNetStandard DotNetStandardVersion.V1_6)) + 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)) + 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)) + 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)) + 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" - model.GetLibReferences(SinglePlatform (Runtimes("aot"))) |> shouldContain @"..\packages\System.Diagnostics.Contracts\runtimes\aot\lib\netcore50\System.Diagnostics.Contracts.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" [] @@ -192,7 +229,7 @@ let ``should handle lib install of Microsoft.Net.Http for .NET 4.5``() = @"..\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll" @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Extensions.dll" - @"..\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll" ] |> fromLegacyList @"..\Microsoft.Net.Http\lib\") + @"..\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" @@ -510,7 +547,7 @@ let ``should not install tools``() = @"..\FAKE\tools\FakeLib.dll" @"..\FAKE\tools\Fake.SQL.dll" ] |> fromLegacyList @"..\FAKE\") - model.LegacyReferenceFileFolders + model.CompileLibFolders |> Seq.forall (fun folder -> folder.Files.References.IsEmpty) |> shouldEqual true @@ -650,7 +687,7 @@ let ``should keep net20 if nothing better is available``() = |> shouldEqual [ ] [] -let ``prefer net20 over empty folder``() = +let ``prefer net20 over empty folder``() = let model = InstallModel.CreateFromLibs (PackageName "EPPlus", SemVer.Parse "4.0.5", diff --git a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs index 8c28e02596..ba206086de 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs @@ -10,24 +10,24 @@ open Paket.Requirements let expected = """ - ..\..\..\Fantomas\Lib\FantomasLib.dll + ..\..\..\Fantomas\lib\FantomasLib.dll False True """ [] -let ``should generate Xml for Fantomas 1.5``() = +let ``should generate Xml for Fantomas 1.5``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\Lib\FantomasLib.dll" - @"..\Fantomas\Lib\FSharp.Core.dll" - @"..\Fantomas\Lib\Fantomas.exe" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Fantomas\", + [ @"..\Fantomas\lib\FantomasLib.dll" + @"..\Fantomas\lib\FSharp.Core.dll" + @"..\Fantomas\lib\Fantomas.exe" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Fantomas\", [], [], Nuspec.Explicit ["FantomasLib.dll"]) - + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some false,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml diff --git a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs index 1a5a679a45..94713ae85f 100644 --- a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs @@ -33,7 +33,7 @@ let expectedPropertyNodes = """ """ [] -let ``should generate Xml for LibGit2Sharp 2.0.0``() = +let ``should generate Xml for LibGit2Sharp 2.0.0``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "LibGit2Sharp", SemVer.Parse "0.21", [], @@ -43,7 +43,7 @@ let ``should generate Xml for LibGit2Sharp 2.0.0``() = |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\LibGit2Sharp\", [], Nuspec.All) - + model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> 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) diff --git a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs index 9c82acdcea..97fa5173dd 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs @@ -7,6 +7,7 @@ open Paket.TestHelpers open Paket.Domain open Paket.Requirements open Paket.InstallModel +open Paket.PlatformMatching let fromLegacyList = Paket.InstallModel.ProcessingSpecs.fromLegacyList @@ -80,13 +81,16 @@ let expectedPropertyNodes = """ [] let ``can get supported target profile``()= - let profiles = PlatformMatching.getSupportedTargetProfiles ["net20"; "net40"; "net45"; "net451"; "netstandard14" ] - let folder = profiles |> Seq.item 2 - folder.Key |> shouldEqual "net45" + let profiles = + ["net20"; "net40"; "net45"; "net451"; "netstandard14" ] + |> List.map extractPlatforms + |> PlatformMatching.getSupportedTargetProfiles + let folder = profiles |> Seq.item 2 + folder.Key |> shouldEqual (extractPlatforms "net45") folder.Value |> shouldEqual [SinglePlatform (DotNetFramework FrameworkVersion.V4_5)] [] -let ``should extract lib folders for SQLite``() = +let ``should extract lib folders for SQLite``() = let libs = [@"..\System.Data.SQLite.Core\lib\net20\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @@ -95,14 +99,16 @@ let ``should extract lib folders for SQLite``() = |> fromLegacyList @"..\System.Data.SQLite.Core\" let model = - libs - |> List.choose (extractLibFolder (PackageName "System.Data.SQLite.Core")) - |> List.distinct + libs + |> List.choose getCompileLibAssembly + |> List.distinct - model |> shouldEqual ["net20"; "net40"; "net45"; "net451"] + model + |> List.map (fun m -> m.Path.Name) + |> shouldEqual ["net20"; "net40"; "net45"; "net451"] [] -let ``should calc lib folders for SQLite``() = +let ``should calc lib folders for SQLite``() = let libs = [@"..\System.Data.SQLite.Core\lib\net20\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @@ -110,13 +116,13 @@ let ``should calc lib folders for SQLite``() = @"..\System.Data.SQLite.Core\lib\net451\System.Data.SQLite.dll"] |> fromLegacyList @"..\System.Data.SQLite.Core\" - let model = calcLibFolders (PackageName "System.Data.SQLite.Core") libs + let model = calcLegacyReferenceLibFolders libs let folder = model |> List.item 2 folder.Targets |> shouldEqual [SinglePlatform (DotNetFramework FrameworkVersion.V4_5)] [] -let ``should init model for SQLite``() = +let ``should init model for SQLite``() = let libs = [@"..\System.Data.SQLite.Core\lib\net20\System.Data.SQLite.dll" @"..\System.Data.SQLite.Core\lib\net40\System.Data.SQLite.dll" @@ -128,13 +134,13 @@ let ``should init model for SQLite``() = emptyModel (PackageName "System.Data.SQLite.Core") (SemVer.Parse "3.8.2") |> addLibReferences libs Nuspec.All.References - let libFolder = model.LegacyReferenceFileFolders |> List.item 2 + let libFolder = model.CompileLibFolders |> List.item 2 libFolder.Name |> shouldEqual "net45" libFolder.Targets |> shouldEqual [SinglePlatform (DotNetFramework FrameworkVersion.V4_5)] [] -let ``should generate model for SQLite``() = +let ``should generate model for SQLite``() = let model = InstallModel.CreateFromLibs(PackageName "System.Data.SQLite.Core", SemVer.Parse "3.8.2", [], [ @"..\System.Data.SQLite.Core\lib\net20\System.Data.SQLite.dll" @@ -150,12 +156,12 @@ let ``should generate model for SQLite``() = [], Nuspec.All) - let libFolder = model.LegacyReferenceFileFolders |> List.item 2 + let libFolder = model.CompileLibFolders |> List.item 2 libFolder.Name |> shouldEqual "net45" libFolder.Targets |> shouldEqual [SinglePlatform (DotNetFramework FrameworkVersion.V4_5)] [] -let ``should generate Xml for SQLite``() = +let ``should generate Xml for SQLite``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "System.Data.SQLite.Core", SemVer.Parse "3.8.2", [], From 165a689436b09cabeeb418f1c90d6a49fba8aeb7 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sat, 15 Apr 2017 01:30:18 +0200 Subject: [PATCH 07/15] fix 'native' handling in lib/native folder. --- .../MyClassLibrary/PaketTest.vcxprojtemplate | 84 ++++++++++++++++--- src/Paket.Core/Files/ProjectFile.fs | 11 +-- src/Paket.Core/FrameworkHandling.fs | 67 ++++++++++----- src/Paket.Core/InstallModel.fs | 39 ++++++--- src/Paket.Core/InstallProcess.fs | 7 +- src/Paket.Core/PlatformMatching.fs | 10 +-- src/Paket.Core/Requirements.fs | 2 +- src/Paket/Paket.fsproj | 4 +- tests/Paket.Tests/InstallModel/Xml/SQLite.fs | 4 +- tests/Paket.Tests/RestrictionFilterSpecs.fs | 8 +- 10 files changed, 172 insertions(+), 64 deletions(-) diff --git a/integrationtests/scenarios/i001467-cpp-native/before/MyClassLibrary/PaketTest.vcxprojtemplate b/integrationtests/scenarios/i001467-cpp-native/before/MyClassLibrary/PaketTest.vcxprojtemplate index dc2041c557..fc07a1ba12 100644 --- a/integrationtests/scenarios/i001467-cpp-native/before/MyClassLibrary/PaketTest.vcxprojtemplate +++ b/integrationtests/scenarios/i001467-cpp-native/before/MyClassLibrary/PaketTest.vcxprojtemplate @@ -114,7 +114,6 @@ - @@ -125,19 +124,28 @@ - + - - ..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest120_app_2_7.dll + + ..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest120d_app_2_7.dll True True - + - ..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest120d_app_2_7.dll + ..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_app_2_7.dll + True + True + + + + + + + ..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest120_app_2_7.dll True True @@ -172,6 +180,15 @@ + + + + ..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn\lib\native\v120\windesktop\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_2_7.dll + True + True + + + @@ -201,6 +218,15 @@ + + + + ..\packages\cpprestsdk.v120.winphone.msvcstl.dyn.rt-dyn\lib\native\v120\winphone\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_wp81_2_7.dll + True + True + + + @@ -230,6 +256,15 @@ + + + + ..\packages\cpprestsdk.v120.winphonesl.msvcstl.dyn.rt-dyn\lib\native\v120\winphonesl\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_wps81_2_7.dll + True + True + + + @@ -259,6 +294,15 @@ + + + + ..\packages\cpprestsdk.v120.winxp.msvcstl.dyn.rt-dyn\lib\native\v120\winxp\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_xp_2_7.dll + True + True + + + @@ -288,19 +332,28 @@ - + - - ..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest140_uwp_2_7.dll + + ..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest140d_uwp_2_7.dll True True - + - ..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest140d_uwp_2_7.dll + ..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\x86\Debug\cpprest140d_uwp_2_7.dll + True + True + + + + + + + ..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest140_uwp_2_7.dll True True @@ -335,6 +388,15 @@ + + + + ..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn\lib\native\v140\windesktop\msvcstl\dyn\rt-dyn\x86\Debug\cpprest140d_2_7.dll + True + True + + + diff --git a/src/Paket.Core/Files/ProjectFile.fs b/src/Paket.Core/Files/ProjectFile.fs index 277518080b..3f362d009a 100644 --- a/src/Paket.Core/Files/ProjectFile.fs +++ b/src/Paket.Core/Files/ProjectFile.fs @@ -753,8 +753,8 @@ module ProjectFile = // handle legacy conditions let conditions = - ((model.GetReferenceFolders() |> List.sortBy (fun libFolder -> libFolder.Name)) @ - netCoreRestricted.CompileRefFolders |> List.sortBy (fun libFolder -> libFolder.Name)) + ((model.GetReferenceFolders() |> List.sortBy (fun libFolder -> libFolder.Path)) @ + 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 @@ -802,9 +802,10 @@ module ProjectFile = // (ref https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package). let globalTargets, frameworkSpecificTargets = if not importTargets then List.empty, List.empty else - let sortedTargets = model.TargetsFileFolders |> List.sortBy (fun lib -> lib.Name) - sortedTargets - |> List.partition (fun lib -> allTargetProfiles = set lib.Targets ) + let sortedTargets = model.TargetsFileFolders |> List.sortBy (fun lib -> lib.Path) + //sortedTargets + //|> List.partition (fun lib -> allTargetProfiles = set lib.Targets ) + ([] : LibFolder list), sortedTargets let frameworkSpecificTargetsFileConditions = frameworkSpecificTargets diff --git a/src/Paket.Core/FrameworkHandling.fs b/src/Paket.Core/FrameworkHandling.fs index 0cff63ae08..f5542c2f90 100644 --- a/src/Paket.Core/FrameworkHandling.fs +++ b/src/Paket.Core/FrameworkHandling.fs @@ -2,6 +2,7 @@ open System.IO open System +open System.Diagnostics [] /// The Framework version. @@ -142,6 +143,33 @@ module KnownAliases = " ", "" ] |> List.map (fun (p,r) -> p.ToLower(),r.ToLower()) +type BuildMode = + | Debug + | Release + | NoBuildMode + | UnknownBuildMode of string + member x.AsString = + match x with + | Debug -> "Debug" + | Release -> "Release" + | NoBuildMode -> "" + | UnknownBuildMode s -> s + override x.ToString() = x.AsString + +type Platform = + | Arm + | X64 + | Win32 + | NoPlatform + | UnknownPlatform of string + member x.AsString = + match x with + | Arm -> "arm" + | X64 -> "x64" + | Win32 -> "Win32" + | NoPlatform -> "" + | UnknownPlatform s -> s + override x.ToString() = x.AsString /// Framework Identifier type. // Each time a new version is added NuGetPackageCache.CurrentCacheVersion should be bumped. @@ -155,7 +183,7 @@ type FrameworkIdentifier = | MonoAndroid | MonoTouch | MonoMac - | Native of string * string + | Native of BuildMode * Platform //| Runtimes of string | XamariniOS | XamarinMac @@ -336,15 +364,15 @@ module FrameworkDetection = | "monomac" | "monomac10" | "monomac1" -> Some MonoMac | "xamarinios" | "xamarinios10" | "xamarinios1" | "xamarin.ios10" -> Some XamariniOS | "xamarinmac" | "xamarinmac20" | "xamarin.mac20" -> Some XamarinMac - | "native/x86/debug" -> Some(Native("Debug","Win32")) - | "native/x64/debug" -> Some(Native("Debug","x64")) - | "native/arm/debug" -> Some(Native("Debug","arm")) - | "native/x86/release" -> Some(Native("Release","Win32")) - | "native/x64/release" -> Some(Native("Release","x64")) - | "native/arm/release" -> Some(Native("Release","arm")) - | "native/address-model-32" -> Some(Native("","Win32")) - | "native/address-model-64" -> Some(Native("","x64")) - | "native" -> Some(Native("","")) + | "native/x86/debug" -> Some(Native(Debug,Win32)) + | "native/x64/debug" -> Some(Native(Debug,X64)) + | "native/arm/debug" -> Some(Native(Debug,Arm)) + | "native/x86/release" -> Some(Native(Release,Win32)) + | "native/x64/release" -> Some(Native(Release,X64)) + | "native/arm/release" -> Some(Native(Release,Arm)) + | "native/address-model-32" -> Some(Native(NoBuildMode,Win32)) + | "native/address-model-64" -> Some(Native(NoBuildMode,X64)) + | "native" -> Some(Native(NoBuildMode,NoPlatform)) | "sl" | "sl3" | "sl30" -> Some (Silverlight "v3.0") | "sl4" | "sl40" -> Some (Silverlight "v4.0") | "sl5" | "sl50" -> Some (Silverlight "v5.0") @@ -609,15 +637,16 @@ module KnownTargetProfiles = DotNetCoreProfiles let AllNativeProfiles = - [ Native("","") - Native("","Win32") - Native("","x64") - Native("Debug","Win32") - Native("Debug","arm") - Native("Debug","x64") - Native("Release","Win32") - Native("Release","x64") - Native("Release","arm")] + [ Native(NoBuildMode,NoPlatform) + Native(NoBuildMode,Win32) + Native(NoBuildMode,X64) + Native(NoBuildMode,Arm) + Native(Debug,Win32) + Native(Debug,Arm) + Native(Debug,X64) + Native(Release,Win32) + Native(Release,X64) + Native(Release,Arm)] //let AllRuntimes = // [ Runtimes("win7-x64") diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 8da7fc96e9..06c41b709c 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -5,6 +5,7 @@ open System.IO 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 = @@ -88,7 +89,7 @@ type RuntimeIdentifier = 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 = - { Name : string + { Path : ParsedPlatformPath Targets : TargetProfile list Files : InstallFiles } @@ -368,13 +369,31 @@ module InstallModel = |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = RuntimeIdentifier.Any })) let getCompileLibAssembly (p:UnparsedPackageFile) = - (trySscanf "lib/%A{tfm}/%A{noSeperator}" p.PathWithinPackage : (Tfm * string) option) - |> Option.map (fun (l,_) -> { Path = l; File = p; Runtime = RuntimeIdentifier.Any }) + // %s because 'native' uses subfolders... + (trySscanf "lib/%A{tfm}/%s" p.PathWithinPackage : (Tfm * string) option) + |> Option.map (fun (l,path) -> + if l.Name = "native" && l.Platforms = [ FrameworkIdentifier.Native(NoBuildMode,NoPlatform) ] then + // We need some special logic to detect the platform + let path = path.ToLowerInvariant() + let newPlatform = + if path.Contains "/x86/" then Win32 else + if path.Contains "/arm/" then Arm else + if path.Contains "/x64/" then X64 else + if path.Contains "/address-model-32" then UnknownPlatform "address-model-32" else + if path.Contains "/address-model-64" then UnknownPlatform "address-model-64" else + NoPlatform + let newBuildMode = + 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 } + else + { Path = l; File = p; Runtime = RuntimeIdentifier.Any }) |> Option.orElseWith (fun _ -> (trySscanf "lib/%A{noSeperator}" p.PathWithinPackage : string option) |> Option.map (fun (_) -> { Path = Tfm.Empty; File = p; Runtime = RuntimeIdentifier.Any })) - let getNativeLibraries (p:UnparsedPackageFile) = + 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.orElseWith (fun _ -> @@ -477,10 +496,10 @@ module InstallModel = libs |> List.choose parsePackage |> List.map (fun p -> p.Path) - |> List.distinctBy (fun f -> f.Name) + |> List.distinct //By (fun f -> f.Platforms) |> List.sort |> PlatformMatching.getSupportedTargetProfiles - |> Seq.map (fun entry -> { Name = entry.Key.Name; Targets = entry.Value; Files = InstallFiles.empty }) + |> Seq.map (fun entry -> { Path = entry.Key; Targets = entry.Value; Files = InstallFiles.empty }) |> Seq.toList let calcLegacyReferenceLibFolders = calcLibFoldersG getCompileLibAssembly @@ -491,7 +510,7 @@ module InstallModel = let addFileToFolder (path:LibFolder) (file:UnparsedPackageFile) (folders:LibFolder list) (addfn: string -> InstallFiles -> InstallFiles) = folders |> List.map (fun p -> - if p.Name <> path.Name then p else + if p.Path <> path.Path then p else { p with Files = addfn file.FullPath p.Files }) let private addPackageLegacyLibFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = @@ -534,7 +553,7 @@ module InstallModel = List.fold (fun (model:InstallModel) file -> match extract file with | Some (folderName:FrameworkDependentFile) -> - match List.tryFind (fun (folder:LibFolder) -> folder.Name = folderName.Path.Name) (getFolder model) with + match List.tryFind (fun (folder:LibFolder) -> folder.Path = folderName.Path) (getFolder model) with | Some path -> addFunc path file references model | _ -> model | None -> model) initialState libs @@ -671,13 +690,13 @@ module InstallModel = |> List.map (fun p -> p.Path) |> List.distinct |> PlatformMatching.getSupportedTargetProfiles - |> Seq.map (fun entry -> { Name = entry.Key.Name; Targets = List.ofSeq entry.Value; Files = InstallFiles.empty }) + |> Seq.map (fun entry -> { Path = entry.Key; Targets = List.ofSeq entry.Value; Files = InstallFiles.empty }) |> Seq.toList List.fold (fun model file -> match getMsbuildFile file with | Some folderName -> - match List.tryFind (fun (folder:LibFolder) -> folder.Name = folderName.Path.Name) model.TargetsFileFolders with + match List.tryFind (fun (folder:LibFolder) -> folder.Path = folderName.Path) model.TargetsFileFolders with | Some path -> addTargetsFile path file model | _ -> model | None -> model) { this with TargetsFileFolders = targetsFileFolders } targetsFiles diff --git a/src/Paket.Core/InstallProcess.fs b/src/Paket.Core/InstallProcess.fs index 85c3cca3c2..33379f37b4 100644 --- a/src/Paket.Core/InstallProcess.fs +++ b/src/Paket.Core/InstallProcess.fs @@ -261,11 +261,8 @@ let private applyBindingRedirects isFirstGroup createNewBindingFiles redirects c dependencies |> Set.filter (fst >> ((=) model.PackageName)) |> Seq.collect (fun (_,profile) -> - let res = - model.GetLibReferences profile - |> Seq.map (fun x -> x, redirects, profile) - |> Seq.toArray - res)) + model.GetLibReferences profile + |> Seq.map (fun x -> x, redirects, profile))) |> Seq.groupBy (fun (p,_,profile) -> profile,FileInfo(p).Name) |> Seq.choose(fun (_,librariesForPackage) -> librariesForPackage diff --git a/src/Paket.Core/PlatformMatching.fs b/src/Paket.Core/PlatformMatching.fs index 314f44c54f..fd60babd5b 100644 --- a/src/Paket.Core/PlatformMatching.fs +++ b/src/Paket.Core/PlatformMatching.fs @@ -197,10 +197,10 @@ let getTargetCondition (target:TargetProfile) = | XamariniOS -> "$(TargetFrameworkIdentifier) == 'Xamarin.iOS'", "" | UAP(version) ->"$(TargetPlatformIdentifier) == 'UAP'", sprintf "$(TargetPlatformVersion.StartsWith('%O'))" version | XamarinMac -> "$(TargetFrameworkIdentifier) == 'Xamarin.Mac'", "" - | Native("","") -> "true", "" - | Native("",bits) -> (sprintf "'$(Platform)'=='%s'" bits), "" + | 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 bits), "" + | Native(profile,bits) -> (sprintf "'$(Configuration)|$(Platform)'=='%s|%s'" profile.AsString bits.AsString), "" | PortableProfile(name, _) -> sprintf "$(TargetFrameworkProfile) == '%O'" name,"" let getCondition (referenceCondition:string option) (allTargets: TargetProfile list list) (targets : TargetProfile list) = @@ -236,12 +236,12 @@ let getCondition (referenceCondition:string option) (allTargets: TargetProfile l | _ -> target) let conditions = - if targets = [ SinglePlatform(Native("", "")) ] then + if targets = [ SinglePlatform(Native(NoBuildMode,NoPlatform)) ] then targets else targets |> List.filter (function - | SinglePlatform(Native("", "")) -> false + | SinglePlatform(Native(NoBuildMode,NoPlatform)) -> false //| SinglePlatform(Runtimes(_)) -> false | SinglePlatform(DotNetFramework(FrameworkVersion.V4_Client)) -> targets |> List.contains (SinglePlatform(DotNetFramework(FrameworkVersion.V4))) |> not diff --git a/src/Paket.Core/Requirements.fs b/src/Paket.Core/Requirements.fs index 5693b39252..f748f6f198 100644 --- a/src/Paket.Core/Requirements.fs +++ b/src/Paket.Core/Requirements.fs @@ -508,7 +508,7 @@ let isTargetMatchingRestrictions = restrictions |> List.exists (fun restriction -> match restriction with - | FrameworkRestriction.Exactly (Native("","")) -> + | FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform)) -> match pf with | Native(_) -> true | _ -> false diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index 41ea8a71e3..572df4068b 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -37,8 +37,8 @@ D:\temp\coreclrtest install C:\dev\src\Paket\integrationtests\scenarios\loading-scripts\dependencies-file-flag\temp - install --createnewbindingfiles - C:\PROJ\Paket\integrationtests\scenarios\i001270-force-redirects\temp + install + C:\PROJ\Paket\integrationtests\scenarios\i001467-cpp-native\temp pdbonly diff --git a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs index 97fa5173dd..b25ecc900e 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs @@ -135,7 +135,7 @@ let ``should init model for SQLite``() = |> addLibReferences libs Nuspec.All.References let libFolder = model.CompileLibFolders |> List.item 2 - libFolder.Name |> shouldEqual "net45" + libFolder.Path.Name |> shouldEqual "net45" libFolder.Targets |> shouldEqual [SinglePlatform (DotNetFramework FrameworkVersion.V4_5)] @@ -157,7 +157,7 @@ let ``should generate model for SQLite``() = Nuspec.All) let libFolder = model.CompileLibFolders |> List.item 2 - libFolder.Name |> shouldEqual "net45" + libFolder.Path.Name |> shouldEqual "net45" libFolder.Targets |> shouldEqual [SinglePlatform (DotNetFramework FrameworkVersion.V4_5)] [] diff --git a/tests/Paket.Tests/RestrictionFilterSpecs.fs b/tests/Paket.Tests/RestrictionFilterSpecs.fs index 5d5af7a44b..505014b638 100644 --- a/tests/Paket.Tests/RestrictionFilterSpecs.fs +++ b/tests/Paket.Tests/RestrictionFilterSpecs.fs @@ -124,10 +124,10 @@ let ``should filter >= net20 < net40 and >= net40``() = [] let ``should not filter native, net452``() = - FrameworkRestriction.Exactly(Native("","")).IsSameCategoryAs(FrameworkRestriction.Exactly(Native("",""))) |> shouldEqual (Some true) + FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform)).IsSameCategoryAs(FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform))) |> shouldEqual (Some true) - let l1 = FrameworkRestrictionList [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native("",""))] - let l2 = FrameworkRestrictionList [FrameworkRestriction.Exactly(Native("",""))] + let l1 = FrameworkRestrictionList [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform))] + let l2 = FrameworkRestrictionList [FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform))] filterRestrictions l1 l2 - |> shouldEqual (FrameworkRestrictionList [FrameworkRestriction.Exactly(Native("",""))]) + |> shouldEqual (FrameworkRestrictionList [FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform))]) From 00c4f571ab614c4e06be56cd4c187db89a3a1ea7 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sat, 15 Apr 2017 01:36:57 +0200 Subject: [PATCH 08/15] cleanup --- src/Paket.Core/Files/ProjectFile.fs | 4 ++-- src/Paket.Core/PlatformMatching.fs | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Paket.Core/Files/ProjectFile.fs b/src/Paket.Core/Files/ProjectFile.fs index 3f362d009a..cc8ca4d8e2 100644 --- a/src/Paket.Core/Files/ProjectFile.fs +++ b/src/Paket.Core/Files/ProjectFile.fs @@ -753,8 +753,8 @@ module ProjectFile = // handle legacy conditions let conditions = - ((model.GetReferenceFolders() |> List.sortBy (fun libFolder -> libFolder.Path)) @ - netCoreRestricted.CompileRefFolders |> List.sortBy (fun libFolder -> libFolder.Path)) + (model.GetReferenceFolders() @ 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 diff --git a/src/Paket.Core/PlatformMatching.fs b/src/Paket.Core/PlatformMatching.fs index fd60babd5b..88d84579de 100644 --- a/src/Paket.Core/PlatformMatching.fs +++ b/src/Paket.Core/PlatformMatching.fs @@ -30,16 +30,6 @@ let tryGetProfile platforms = KnownTargetProfiles.AllPortableProfiles |> Seq.tryFind (snd >> List.sort >> (=) filtered) |> Option.map PortableProfile -//let extractAndTryGetProfile = memoize (fun path -> -// let platforms = extractPlatforms path -// let filtered = -// platforms.Platforms -// |> List.filter (fun p -> knownInPortable |> Seq.exists ((=) p)) -// |> List.sort -// -// KnownTargetProfiles.AllPortableProfiles |> Seq.tryFind (snd >> List.sort >> (=) filtered) -// |> Option.map PortableProfile) - let getPlatformPenalty = let rec getPlatformPenalty alreadyChecked (targetPlatform:FrameworkIdentifier) (packagePlatform:FrameworkIdentifier) = if packagePlatform = targetPlatform then From 761e95d51d975d48a9427e85a0f60c3d26dd5263 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sat, 15 Apr 2017 02:08:38 +0200 Subject: [PATCH 09/15] ok some tests check the global build directory --- src/Paket.Core/Files/ProjectFile.fs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Paket.Core/Files/ProjectFile.fs b/src/Paket.Core/Files/ProjectFile.fs index cc8ca4d8e2..1ca200907f 100644 --- a/src/Paket.Core/Files/ProjectFile.fs +++ b/src/Paket.Core/Files/ProjectFile.fs @@ -803,9 +803,10 @@ module ProjectFile = let globalTargets, frameworkSpecificTargets = if not importTargets then List.empty, List.empty else let sortedTargets = model.TargetsFileFolders |> List.sortBy (fun lib -> lib.Path) - //sortedTargets - //|> List.partition (fun lib -> allTargetProfiles = set lib.Targets ) - ([] : LibFolder list), sortedTargets + sortedTargets + //|> List.partition (fun lib -> allTargetProfiles = set lib.Path.Targets ) + |> List.partition (fun lib -> "" = lib.Path.Name ) + //([] : LibFolder list), sortedTargets let frameworkSpecificTargetsFileConditions = frameworkSpecificTargets From 7f3fd5b78b3fa15b2ea4bf5b686784d137995725 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sat, 15 Apr 2017 03:22:20 +0200 Subject: [PATCH 10/15] simplify code and fix tests --- src/Paket.Core/InstallModel.fs | 49 +++++++------------ src/Paket.Core/NuGetV2.fs | 4 +- src/Paket.Core/Utils.fs | 8 +-- .../InstallModel/Xml/GitInfoPlanter.fs | 6 +-- .../InstallModel/Xml/StyleCop.MSBuild.fs | 6 +-- 5 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 06c41b709c..1f86c89155 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -513,7 +513,7 @@ module InstallModel = if p.Path <> path.Path then p else { p with Files = addfn file.FullPath p.Files }) - let private addPackageLegacyLibFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = + let private addPackageLegacyLibFile references (path:LibFolder) (file:UnparsedPackageFile) (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true @@ -523,7 +523,7 @@ module InstallModel = { this with CompileLibFolders = addFileToFolder path file this.CompileLibFolders InstallFiles.addReference } - let private addPackageRefFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = + let private addPackageRefFile references (path:LibFolder) (file:UnparsedPackageFile) (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true @@ -533,7 +533,7 @@ module InstallModel = { this with CompileRefFolders = addFileToFolder path file this.CompileRefFolders InstallFiles.addReference } - let private addPackageRuntimeFile (path:LibFolder) (file:UnparsedPackageFile) references (this:InstallModel) : InstallModel = + let private addPackageRuntimeFile references (path:LibFolder) (file:UnparsedPackageFile) (this:InstallModel) : InstallModel = let install = match references with | NuspecReferences.All -> true @@ -543,28 +543,28 @@ module InstallModel = { this with RuntimeLibFolders = addFileToFolder path file this.RuntimeLibFolders InstallFiles.addReference } + 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 + | _ -> model + | None -> model) initialState libs + let addLibReferences (libs:UnparsedPackageFile seq) references (installModel:InstallModel) : InstallModel = let libs = libs |> Seq.toList let legacyLibFolders = calcLegacyReferenceLibFolders libs let refFolders = calcReferenceFolders libs let runtimeFolders = calcRuntimeFolders libs - let addItem 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 references model - | _ -> model - | None -> model) initialState libs - { installModel with CompileLibFolders = legacyLibFolders CompileRefFolders = refFolders RuntimeLibFolders = runtimeFolders } - |> addItem getCompileLibAssembly addPackageLegacyLibFile (fun i -> i.CompileLibFolders) - |> addItem getCompileRefAssembly addPackageRefFile (fun i -> i.CompileRefFolders) - |> addItem getRuntimeAssembly addPackageRuntimeFile (fun i -> i.RuntimeLibFolders) + |> 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) let addAnalyzerFiles (analyzerFiles:UnparsedPackageFile seq) (installModel:InstallModel) : InstallModel = let analyzerLibs = @@ -685,22 +685,9 @@ module InstallModel = let rec addTargetsFiles (targetsFiles:UnparsedPackageFile list) (this:InstallModel) : InstallModel = let targetsFileFolders = - targetsFiles - |> List.choose getMsbuildFile - |> List.map (fun p -> p.Path) - |> List.distinct - |> PlatformMatching.getSupportedTargetProfiles - |> Seq.map (fun entry -> { Path = entry.Key; Targets = List.ofSeq entry.Value; Files = InstallFiles.empty }) - |> Seq.toList - - List.fold (fun model file -> - match getMsbuildFile file with - | Some folderName -> - match List.tryFind (fun (folder:LibFolder) -> folder.Path = folderName.Path) model.TargetsFileFolders with - | Some path -> addTargetsFile path file model - | _ -> model - | None -> model) { this with TargetsFileFolders = targetsFileFolders } targetsFiles - + calcLibFoldersG getMsbuildFile targetsFiles + { this with TargetsFileFolders = targetsFileFolders } + |> addItem targetsFiles getMsbuildFile (addTargetsFile) (fun i -> i.TargetsFileFolders) let filterReferences references (this:InstallModel) = let inline mapfn (files:InstallFiles) = diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index a366e0cb85..15c545877c 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -608,13 +608,15 @@ let DownloadLicense(root,force,packageName:PackageName,version:SemVerInfo,licens let private getFilesMatching targetFolder searchPattern subFolderName filesDescriptionForVerbose = let files = let dir = DirectoryInfo(targetFolder) + let dirFullPath = Path.GetFullPath targetFolder let path = Path.Combine(dir.FullName.ToLower(), subFolderName) if dir.Exists then dir.GetDirectories() |> Array.filter (fun fi -> String.equalsIgnoreCase fi.FullName path) |> Array.collect (fun dir -> dir.GetFiles(searchPattern, SearchOption.AllDirectories)) |> Array.map (fun file -> - { UnparsedPackageFile.FullPath = file.FullName; UnparsedPackageFile.PathWithinPackage = file.FullName.Substring(dir.FullName.Length + 1).Replace("\\", "/") }) + let fullPath = Path.GetFullPath file.FullName; + { UnparsedPackageFile.FullPath = fullPath; UnparsedPackageFile.PathWithinPackage = fullPath.Substring(dirFullPath.Length + 1).Replace("\\", "/") }) else [||] diff --git a/src/Paket.Core/Utils.fs b/src/Paket.Core/Utils.fs index 73a6568d21..b570143331 100644 --- a/src/Paket.Core/Utils.fs +++ b/src/Paket.Core/Utils.fs @@ -150,13 +150,15 @@ let getFileEncoding path = | _ -> Encoding.ASCII /// [omit] -let inline createRelativePath root path = +let createRelativePath root (path:string) = + let path = Path.GetFullPath path let basePath = if String.IsNullOrEmpty root then Directory.GetCurrentDirectory() + string Path.DirectorySeparatorChar else root - + let uri = Uri basePath - uri.MakeRelativeUri(Uri path).ToString().Replace("/", "\\").Replace("%20", " ") + let relative = uri.MakeRelativeUri(Uri path).ToString().Replace("/", "\\").Replace("%20", " ") + relative /// The path of the "Program Files" folder - might be x64 on x64 machine let ProgramFiles = Environment.GetFolderPath Environment.SpecialFolder.ProgramFiles diff --git a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs index 79c1972d39..d42d35698a 100644 --- a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs +++ b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs @@ -38,9 +38,9 @@ let ``should generate Xml for GitInfoPlanter2.0.0``() = ctx.FrameworkSpecificPropsNodes |> Seq.length |> shouldEqual 0 ctx.GlobalPropsNodes |> Seq.length |> shouldEqual 0 - ctx.FrameworkSpecificTargetsNodes |> Seq.length |> shouldEqual 1 - ctx.GlobalTargetsNodes |> Seq.length |> shouldEqual 0 + ctx.FrameworkSpecificTargetsNodes |> Seq.length |> shouldEqual 0 + ctx.GlobalTargetsNodes |> Seq.length |> shouldEqual 1 - (ctx.FrameworkSpecificTargetsNodes |> Seq.head).OuterXml + (ctx.GlobalTargetsNodes |> Seq.head).OuterXml |> normalizeXml |> shouldEqual (normalizeXml expectedPropertyNodes) \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs index 380b959f90..51c386cbc0 100644 --- a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs +++ b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs @@ -32,10 +32,10 @@ let ``should generate Xml for StyleCop.MSBuild``() = ctx.FrameworkSpecificPropsNodes |> Seq.length |> shouldEqual 0 - ctx.FrameworkSpecificTargetsNodes |> Seq.length |> shouldEqual 1 + ctx.FrameworkSpecificTargetsNodes |> Seq.length |> shouldEqual 0 ctx.GlobalPropsNodes |> Seq.length |> shouldEqual 0 - ctx.GlobalTargetsNodes |> Seq.length |> shouldEqual 0 + ctx.GlobalTargetsNodes |> Seq.length |> shouldEqual 1 - (ctx.FrameworkSpecificTargetsNodes |> Seq.head).OuterXml + (ctx.GlobalTargetsNodes |> Seq.head).OuterXml |> normalizeXml |> shouldEqual (normalizeXml expectedPropertyNodes) \ No newline at end of file From 1663d8b1a02b2d2c98a372000d085ca6224524cd Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sat, 15 Apr 2017 03:46:26 +0200 Subject: [PATCH 11/15] fix tests --- .../MyClassLibrary/MyClassLibrary.csprojtemplate | 2 +- .../MyClassLibrary/MyClassLibrary.csprojtemplate | 2 +- .../MyClassLibrary/MyClassLibrary.csprojtemplate | 2 +- .../MyClassLibrary/MyClassLibrary.csprojtemplate | 2 +- src/Paket.Core/Utils.fs | 5 +++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/integrationtests/scenarios/i000346-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate b/integrationtests/scenarios/i000346-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate index 867260b52e..cccb5ff178 100644 --- a/integrationtests/scenarios/i000346-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate +++ b/integrationtests/scenarios/i000346-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate @@ -1,7 +1,7 @@  - + Debug AnyCPU diff --git a/integrationtests/scenarios/i001145-excludes/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate b/integrationtests/scenarios/i001145-excludes/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate index b9a8ecc890..b0abf3ae85 100644 --- a/integrationtests/scenarios/i001145-excludes/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate +++ b/integrationtests/scenarios/i001145-excludes/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate @@ -1,7 +1,7 @@  - + Debug AnyCPU diff --git a/integrationtests/scenarios/i001219-props-files/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate b/integrationtests/scenarios/i001219-props-files/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate index 20479791ac..9b659edb95 100644 --- a/integrationtests/scenarios/i001219-props-files/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate +++ b/integrationtests/scenarios/i001219-props-files/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate @@ -1,7 +1,7 @@  - + Debug AnyCPU diff --git a/integrationtests/scenarios/i001732-lowercase-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate b/integrationtests/scenarios/i001732-lowercase-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate index 867260b52e..cccb5ff178 100644 --- a/integrationtests/scenarios/i001732-lowercase-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate +++ b/integrationtests/scenarios/i001732-lowercase-aliases/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate @@ -1,7 +1,7 @@  - + Debug AnyCPU diff --git a/src/Paket.Core/Utils.fs b/src/Paket.Core/Utils.fs index b570143331..93eed72d32 100644 --- a/src/Paket.Core/Utils.fs +++ b/src/Paket.Core/Utils.fs @@ -150,9 +150,10 @@ let getFileEncoding path = | _ -> Encoding.ASCII /// [omit] -let createRelativePath root (path:string) = +let createRelativePath root (path:string) = + let root = Path.GetFullPath root let path = Path.GetFullPath path - let basePath = + let basePath = if String.IsNullOrEmpty root then Directory.GetCurrentDirectory() + string Path.DirectorySeparatorChar else root From 77796cad78fddfca1fbb441662d1a976d32b2172 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sat, 15 Apr 2017 09:46:21 +0200 Subject: [PATCH 12/15] fix of the quickfix --- src/Paket.Core/Utils.fs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Paket.Core/Utils.fs b/src/Paket.Core/Utils.fs index 93eed72d32..99b4e24bc5 100644 --- a/src/Paket.Core/Utils.fs +++ b/src/Paket.Core/Utils.fs @@ -151,11 +151,10 @@ let getFileEncoding path = /// [omit] let createRelativePath root (path:string) = - let root = Path.GetFullPath root let path = Path.GetFullPath path let basePath = if String.IsNullOrEmpty root then Directory.GetCurrentDirectory() + string Path.DirectorySeparatorChar - else root + else Path.GetFullPath root let uri = Uri basePath let relative = uri.MakeRelativeUri(Uri path).ToString().Replace("/", "\\").Replace("%20", " ") From d17487d94288defeade8efa9d304348156ca3519 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Mon, 17 Apr 2017 14:37:19 +0200 Subject: [PATCH 13/15] ignore casing again... --- src/Paket.Core/InstallModel.fs | 30 +++++++++++-------- .../InstallModel/Xml/FantomasLib.fs | 8 ++--- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 1f86c89155..eb62a21d1e 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -204,11 +204,14 @@ module FolderScanner = | ScanSuccess of obj[] | ScanRegexFailure of stringToScan:string * regex:string | ScanParserFailure of error:string - let private sscanfHelper (pf:PrintfFormat<_,_,_,_,'t>) s : ScanResult = + type ScanOptions = + { IgnoreCase : bool } + static member Default = { IgnoreCase = false } + let private sscanfHelper (opts:ScanOptions) (pf:PrintfFormat<_,_,_,_,'t>) s : ScanResult = let formatStr = pf.Value.Replace("%%", "%") let constants = formatStr.Split(separators, StringSplitOptions.None) let regexString = "^" + String.Join("(.*?)", constants |> Array.map Regex.Escape) + "$" - let regex = Regex(regexString) + let regex = Regex(regexString, if opts.IgnoreCase then RegexOptions.IgnoreCase else RegexOptions.None) let formatters = pf.Value.ToCharArray() // need original string here (possibly with "%%"s) |> Array.toList |> getFormatters let matchres = regex.Match(s) @@ -233,9 +236,9 @@ module FolderScanner = else if matches.Length = 0 then Unchecked.defaultof<'t> else FSharpValue.MakeTuple(matches, typeof<'t>) :?> 't - let trySscanf (pf:PrintfFormat<_,_,_,_,'t>) s : 't option = + let trySscanf opts (pf:PrintfFormat<_,_,_,_,'t>) s : 't option = //raise <| FormatException(sprintf "Unable to scan string '%s' with regex '%s'" s regexString) - match sscanfHelper pf s with + match sscanfHelper opts pf s with | ScanSuccess matches -> toGenericTuple matches |> Some | _ -> None @@ -245,14 +248,14 @@ module FolderScanner = | ScanRegexFailure (s, regexString) -> raise <| FormatException(sprintf "Unable to scan string '%s' with regex '%s'" s regexString) | ScanParserFailure e -> raise <| FormatException(sprintf "Unable to parse string '%s' with parser: %s" s e) - let sscanf (pf:PrintfFormat<_,_,_,_,'t>) s : 't = - sscanfHelper pf s + let sscanf opts (pf:PrintfFormat<_,_,_,_,'t>) s : 't = + sscanfHelper opts pf s |> handleErrors s let private findSpecifiers = Regex(@"%(?.)({(?.*?)})?") // Extends the syntax of the format string with %A{scanner}, and uses the corresponding named scanner from the advancedScanners parameter. - let private sscanfExtHelper (advancedScanners:AdvancedScanner seq) (pf:PrintfFormat<_,_,_,_,'t>) s : ScanResult = + let private sscanfExtHelper (advancedScanners:AdvancedScanner seq) opts (pf:PrintfFormat<_,_,_,_,'t>) s : ScanResult = let scannerMap = advancedScanners |> Seq.map (fun s -> s.Name, s) @@ -287,7 +290,7 @@ module FolderScanner = | _ -> originalValue currentFormatterString.Substring(0, index) + replacement + currentFormatterString.Substring(index + originalValue.Length)) pf.Value - match sscanfHelper (PrintfFormat<_,_,_,_,'t> replacedFormatString) s with + match sscanfHelper opts (PrintfFormat<_,_,_,_,'t> replacedFormatString) s with | ScanSuccess objResults -> let results = (objResults, advancedFormatters) @@ -300,14 +303,14 @@ module FolderScanner = ScanSuccess (results |> Array.map (function ParseSucceeded res -> res | ParseError _ -> failwithf "Should not happen here")) | _ as s -> s - let trySscanfExt advancedScanners (pf:PrintfFormat<_,_,_,_,'t>) s : 't option = + let trySscanfExt advancedScanners opts (pf:PrintfFormat<_,_,_,_,'t>) s : 't option = //raise <| FormatException(sprintf "Unable to scan string '%s' with regex '%s'" s regexString) - match sscanfExtHelper advancedScanners pf s with + match sscanfExtHelper advancedScanners opts pf s with | ScanSuccess matches -> toGenericTuple matches |> Some | _ -> None - let sscanfExt advancedScanners (pf:PrintfFormat<_,_,_,_,'t>) s : 't = - sscanfExtHelper advancedScanners pf s + let sscanfExt advancedScanners opts (pf:PrintfFormat<_,_,_,_,'t>) s : 't = + sscanfExtHelper advancedScanners opts pf s |> handleErrors s // some basic testing @@ -347,7 +350,8 @@ module InstallModel = FolderScanner.AdvancedScanner.Parser = PlatformMatching.extractPlatforms >> FolderScanner.ParseResult.ParseSucceeded >> FolderScanner.ParseResult.box } { FolderScanner.AdvancedScanner.Name = "rid"; FolderScanner.AdvancedScanner.Parser = (fun rid -> { Rid = rid }) >> FolderScanner.ParseResult.ParseSucceeded >> FolderScanner.ParseResult.box }] - let trySscanf pf s = FolderScanner.trySscanfExt scanners pf s + let trySscanf pf s = + FolderScanner.trySscanfExt scanners { FolderScanner.ScanOptions.Default with IgnoreCase = true } pf s type FrameworkDependentFile = { Path : Tfm diff --git a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs index ba206086de..1e4e5111b8 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs @@ -10,7 +10,7 @@ open Paket.Requirements let expected = """ - ..\..\..\Fantomas\lib\FantomasLib.dll + ..\..\..\Fantomas\Lib\FantomasLib.dll False True @@ -21,9 +21,9 @@ let ``should generate Xml for Fantomas 1.5``() = ensureDir() let model = InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [], - [ @"..\Fantomas\lib\FantomasLib.dll" - @"..\Fantomas\lib\FSharp.Core.dll" - @"..\Fantomas\lib\Fantomas.exe" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Fantomas\", + [ @"..\Fantomas\Lib\FantomasLib.dll" + @"..\Fantomas\Lib\FSharp.Core.dll" + @"..\Fantomas\Lib\Fantomas.exe" ] |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\Fantomas\", [], [], Nuspec.Explicit ["FantomasLib.dll"]) From 6845ebc25cbd8d2074d2a65fc453bac5f11cdd27 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Mon, 17 Apr 2017 14:49:41 +0200 Subject: [PATCH 14/15] cleanup global targets detection and remove comment which is no longer true. --- src/Paket.Core/Files/ProjectFile.fs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Paket.Core/Files/ProjectFile.fs b/src/Paket.Core/Files/ProjectFile.fs index 1ca200907f..7c73474e81 100644 --- a/src/Paket.Core/Files/ProjectFile.fs +++ b/src/Paket.Core/Files/ProjectFile.fs @@ -797,16 +797,13 @@ module ProjectFile = condition,createItemGroup libFolder.Targets rest,false] ) - // global targets are targets, that are either directly in the /build folder, - // or, if there is a framework-restriction, specific to the framework(s). + // global targets are targets, that are either directly in the /build folder. // (ref https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package). let globalTargets, frameworkSpecificTargets = if not importTargets then List.empty, List.empty else let sortedTargets = model.TargetsFileFolders |> List.sortBy (fun lib -> lib.Path) sortedTargets - //|> List.partition (fun lib -> allTargetProfiles = set lib.Path.Targets ) - |> List.partition (fun lib -> "" = lib.Path.Name ) - //([] : LibFolder list), sortedTargets + |> List.partition (fun lib -> "" = lib.Path.Name) let frameworkSpecificTargetsFileConditions = frameworkSpecificTargets From a9d3a61f9294e56096718e66b1f2d45f8722d9d8 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Mon, 17 Apr 2017 14:53:08 +0200 Subject: [PATCH 15/15] fixup of previous merge... --- src/Paket.Core/InstallModel.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Paket.Core/InstallModel.fs b/src/Paket.Core/InstallModel.fs index 52fc3a3a85..60d8bf570b 100644 --- a/src/Paket.Core/InstallModel.fs +++ b/src/Paket.Core/InstallModel.fs @@ -679,7 +679,7 @@ module InstallModel = RuntimeLibFolders = installModel.RuntimeLibFolders - |> List.map applRestriction + |> List.map applyRestriction |> List.filter (fun folder -> folder.Targets <> []) TargetsFileFolders =