diff --git a/src/Paket.Core/Dependencies/DependenciesFileParser.fs b/src/Paket.Core/Dependencies/DependenciesFileParser.fs index 15fad4c285..b5fe6720bf 100644 --- a/src/Paket.Core/Dependencies/DependenciesFileParser.fs +++ b/src/Paket.Core/Dependencies/DependenciesFileParser.fs @@ -194,6 +194,7 @@ module DependenciesFileParser = | AutodetectFrameworkRestrictions | ImportTargets of bool | CopyLocal of bool + | SpecificVersion of bool | CopyContentToOutputDir of CopyToOutputDirectorySettings | GenerateLoadScripts of bool option | ReferenceCondition of string @@ -317,6 +318,7 @@ module DependenciesFileParser = Some (ParserOptions (ParserOption.OmitContent setting)) | String.RemovePrefix "import_targets" trimmed -> Some (ParserOptions (ParserOption.ImportTargets(trimmed.Replace(":","").Trim() = "true"))) | String.RemovePrefix "copy_local" trimmed -> Some (ParserOptions (ParserOption.CopyLocal(trimmed.Replace(":","").Trim() = "true"))) + | String.RemovePrefix "specific_version" trimmed -> Some (ParserOptions (ParserOption.SpecificVersion(trimmed.Replace(":","").Trim() = "true"))) | String.RemovePrefix "copy_content_to_output_dir" trimmed -> let setting = match trimmed.Replace(":","").Trim() with @@ -416,6 +418,7 @@ module DependenciesFileParser = | ResolverStrategyForTransitives strategy -> { current.Options with ResolverStrategyForTransitives = strategy } | ResolverStrategyForDirectDependencies strategy -> { current.Options with ResolverStrategyForDirectDependencies = strategy } | CopyLocal mode -> { current.Options with Settings = { current.Options.Settings with CopyLocal = Some mode } } + | SpecificVersion mode -> { current.Options with Settings = { current.Options.Settings with SpecificVersion = Some mode } } | CopyContentToOutputDir mode -> { current.Options with Settings = { current.Options.Settings with CopyContentToOutputDirectory = Some mode } } | ImportTargets mode -> { current.Options with Settings = { current.Options.Settings with ImportTargets = Some mode } } | FrameworkRestrictions r -> { current.Options with Settings = { current.Options.Settings with FrameworkRestrictions = r } } diff --git a/src/Paket.Core/PaketConfigFiles/LockFile.fs b/src/Paket.Core/PaketConfigFiles/LockFile.fs index 3f837761e8..a0569d9916 100644 --- a/src/Paket.Core/PaketConfigFiles/LockFile.fs +++ b/src/Paket.Core/PaketConfigFiles/LockFile.fs @@ -42,6 +42,9 @@ module LockFileSerializer = match options.Settings.CopyLocal with | Some x -> yield "COPY-LOCAL: " + x.ToString().ToUpper() | None -> () + match options.Settings.SpecificVersion with + | Some x -> yield "SPECIFIC-VERSION: " + x.ToString().ToUpper() + | None -> () match options.Settings.CopyContentToOutputDirectory with | Some CopyToOutputDirectorySettings.Always -> yield "COPY-CONTENT-TO-OUTPUT-DIR: ALWAYS" | Some CopyToOutputDirectorySettings.Never -> yield "COPY-CONTENT-TO-OUTPUT-DIR: NEVER" @@ -233,6 +236,7 @@ module LockFileParser = | GenerateLoadScripts of bool option | FrameworkRestrictions of FrameworkRestrictions | CopyLocal of bool + | SpecificVersion of bool | CopyContentToOutputDir of CopyToOutputDirectorySettings | Redirects of bool option | ReferenceCondition of string @@ -263,6 +267,7 @@ module LockFileParser = InstallOption (Redirects setting) | _, String.RemovePrefix "IMPORT-TARGETS:" trimmed -> InstallOption(ImportTargets(trimmed.Trim() = "TRUE")) | _, String.RemovePrefix "COPY-LOCAL:" trimmed -> InstallOption(CopyLocal(trimmed.Trim() = "TRUE")) + | _, String.RemovePrefix "SPECIFIC-VERSION:" trimmed -> InstallOption(SpecificVersion(trimmed.Trim() = "TRUE")) | _, String.RemovePrefix "GENERATE-LOAD-SCRIPTS:" trimmed -> let setting = match trimmed.Trim() with @@ -351,6 +356,7 @@ module LockFileParser = | Redirects mode -> { currentGroup.Options with Redirects = mode } | ImportTargets mode -> { currentGroup.Options with Settings = { currentGroup.Options.Settings with ImportTargets = Some mode } } | CopyLocal mode -> { currentGroup.Options with Settings = { currentGroup.Options.Settings with CopyLocal = Some mode }} + | SpecificVersion mode -> { currentGroup.Options with Settings = { currentGroup.Options.Settings with SpecificVersion = Some mode }} | CopyContentToOutputDir mode -> { currentGroup.Options with Settings = { currentGroup.Options.Settings with CopyContentToOutputDirectory = Some mode }} | FrameworkRestrictions r -> { currentGroup.Options with Settings = { currentGroup.Options.Settings with FrameworkRestrictions = r }} | OmitContent omit -> { currentGroup.Options with Settings = { currentGroup.Options.Settings with OmitContent = Some omit }} diff --git a/src/Paket.Core/PaketConfigFiles/ProjectFile.fs b/src/Paket.Core/PaketConfigFiles/ProjectFile.fs index fe35e1b491..9e3a8f4b80 100644 --- a/src/Paket.Core/PaketConfigFiles/ProjectFile.fs +++ b/src/Paket.Core/PaketConfigFiles/ProjectFile.fs @@ -664,7 +664,7 @@ module ProjectFile = AnalyzersNode : XmlElement } - let generateXml (model:InstallModel) (usedFrameworkLibs:HashSet) (aliases:Map) (copyLocal:bool option) (importTargets:bool) (referenceCondition:string option) (allTargetProfiles:Set) (project:ProjectFile) : XmlContext = + let generateXml (model:InstallModel) (usedFrameworkLibs:HashSet) (aliases:Map) (copyLocal:bool option) (specificVersion:bool option) (importTargets:bool) (referenceCondition:string option) (allTargetProfiles:Set) (project:ProjectFile) : XmlContext = let references = getCustomReferenceAndFrameworkNodes project |> List.map (fun node -> node.Attributes.["Include"].InnerText.Split(',').[0]) @@ -693,10 +693,20 @@ module ProjectFile = | Some false -> "False" | None -> if relativePath.Contains @"\ref\" then "False" else "True" + let specificVersionSettings = + match specificVersion with + | Some true -> "True" + | Some false -> "False" + | None -> "True" + if relativePath.Contains @"\native\" then createNode "NativeReference" project else createNode "Reference" project |> addAttribute "Include" (fi.Name.Replace(fi.Extension,"")) |> addChild (createNodeSet "HintPath" relativePath project) |> addChild (createNodeSet "Private" privateSettings project) + |> fun n -> + match specificVersion with + | None -> n + | Some(bool) -> addChild (createNodeSet "SpecificVersion" specificVersionSettings project) n |> addChild (createNodeSet "Paket" "True" project) |> fun n -> match aliases with @@ -1057,7 +1067,7 @@ module ProjectFile = let importTargets = defaultArg installSettings.ImportTargets true let allFrameworks = applyRestrictionsToTargets restrictionList KnownTargetProfiles.AllProfiles - generateXml projectModel usedFrameworkLibs installSettings.Aliases installSettings.CopyLocal importTargets installSettings.ReferenceCondition (set allFrameworks) project) + generateXml projectModel usedFrameworkLibs installSettings.Aliases installSettings.CopyLocal installSettings.SpecificVersion importTargets installSettings.ReferenceCondition (set allFrameworks) project) |> Seq.iter (fun ctx -> for chooseNode in ctx.ChooseNodes do let i = ref (project.ProjectNode.ChildNodes.Count-1) @@ -1461,7 +1471,7 @@ type ProjectFile with member this.DeleteCustomModelNodes(model:InstallModel) = ProjectFile.deleteCustomModelNodes model this - member this.GenerateXml(model, usedFrameworkLibs:HashSet, aliases, copyLocal, importTargets, allTargetProfiles:#seq, referenceCondition) = ProjectFile.generateXml model usedFrameworkLibs aliases copyLocal importTargets referenceCondition (set allTargetProfiles) this + member this.GenerateXml(model, usedFrameworkLibs:HashSet, aliases, copyLocal, specificVersion, importTargets, allTargetProfiles:#seq, referenceCondition) = ProjectFile.generateXml model usedFrameworkLibs aliases copyLocal specificVersion importTargets referenceCondition (set allTargetProfiles) this member this.RemovePaketNodes () = ProjectFile.removePaketNodes this diff --git a/src/Paket.Core/PaketConfigFiles/ReferencesFile.fs b/src/Paket.Core/PaketConfigFiles/ReferencesFile.fs index fa7f3bdb99..9615c3fe95 100644 --- a/src/Paket.Core/PaketConfigFiles/ReferencesFile.fs +++ b/src/Paket.Core/PaketConfigFiles/ReferencesFile.fs @@ -128,11 +128,12 @@ type ReferencesFile = { ReferencesFile.FromLines lines with FileName = fileName } with e -> raise <| new Exception(sprintf "Could not parse reference file '%s': %s" fileName e.Message, e) - member this.AddNuGetReference(groupName, packageName : PackageName, copyLocal: bool, importTargets: bool, frameworkRestrictions, includeVersionInPath, omitContent : bool, createBindingRedirects, referenceCondition) = + member this.AddNuGetReference(groupName, packageName : PackageName, copyLocal: bool, specificVersion: bool, importTargets: bool, frameworkRestrictions, includeVersionInPath, omitContent : bool, createBindingRedirects, referenceCondition) = let package: PackageInstallSettings = { Name = packageName Settings = { CopyLocal = if not copyLocal then Some copyLocal else None + SpecificVersion = if not specificVersion then Some specificVersion else None CopyContentToOutputDirectory = None ImportTargets = if not importTargets then Some importTargets else None FrameworkRestrictions = frameworkRestrictions @@ -168,7 +169,7 @@ type ReferencesFile = { this with Groups = newGroups } - member this.AddNuGetReference(groupName, packageName : PackageName) = this.AddNuGetReference(groupName, packageName, true, true, ExplicitRestriction FrameworkRestriction.NoRestriction, false, false, None, null) + member this.AddNuGetReference(groupName, packageName : PackageName) = this.AddNuGetReference(groupName, packageName, true, true, true, ExplicitRestriction FrameworkRestriction.NoRestriction, false, false, None, null) member this.RemoveNuGetReference(groupName, packageName : PackageName) = let group = this.Groups.[groupName] diff --git a/src/Paket.Core/Versioning/Requirements.fs b/src/Paket.Core/Versioning/Requirements.fs index 72ad539767..3d0b3d3d49 100644 --- a/src/Paket.Core/Versioning/Requirements.fs +++ b/src/Paket.Core/Versioning/Requirements.fs @@ -677,6 +677,7 @@ type InstallSettings = ReferenceCondition : string option CreateBindingRedirects : BindingRedirectsSettings option CopyLocal : bool option + SpecificVersion : bool option Excludes : string list Aliases : Map CopyContentToOutputDirectory : CopyToOutputDirectorySettings option @@ -684,6 +685,7 @@ type InstallSettings = static member Default = { CopyLocal = None + SpecificVersion = None ImportTargets = None FrameworkRestrictions = ExplicitRestriction FrameworkRestriction.NoRestriction IncludeVersionInPath = None @@ -700,6 +702,9 @@ type InstallSettings = [ match this.CopyLocal with | Some x -> yield "copy_local: " + x.ToString().ToLower() | None -> () + match this.SpecificVersion with + | Some x -> yield "specific_version: " + x.ToString().ToLower() + | None -> () match this.CopyContentToOutputDirectory with | Some CopyToOutputDirectorySettings.Never -> yield "copy_content_to_output_dir: never" | Some CopyToOutputDirectorySettings.Always -> yield "copy_content_to_output_dir: always" @@ -745,6 +750,7 @@ type InstallSettings = FrameworkRestrictions = filterRestrictions self.FrameworkRestrictions other.FrameworkRestrictions OmitContent = self.OmitContent ++ other.OmitContent CopyLocal = self.CopyLocal ++ other.CopyLocal + SpecificVersion = self.SpecificVersion ++ other.SpecificVersion CopyContentToOutputDirectory = self.CopyContentToOutputDirectory ++ other.CopyContentToOutputDirectory ReferenceCondition = self.ReferenceCondition ++ other.ReferenceCondition Excludes = self.Excludes @ other.Excludes @@ -808,6 +814,11 @@ type InstallSettings = | Some "false" -> Some false | Some "true" -> Some true | _ -> None + SpecificVersion = + match getPair "specific_version" with + | Some "false" -> Some false + | Some "true" -> Some true + | _ -> None GenerateLoadScripts = match getPair "generate_load_scripts" with | Some "on" | Some "true" -> Some true diff --git a/tests/Paket.Tests/DependenciesFile/ParserSpecs.fs b/tests/Paket.Tests/DependenciesFile/ParserSpecs.fs index b8b0fd9f54..ea3da0e6f1 100644 --- a/tests/Paket.Tests/DependenciesFile/ParserSpecs.fs +++ b/tests/Paket.Tests/DependenciesFile/ParserSpecs.fs @@ -216,6 +216,7 @@ let ``should read content none config``() = let cfg = DependenciesFile.FromSource(noneContentConfig) cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.OmitContent |> shouldEqual (Some ContentCopySettings.Omit) cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.CopyLocal |> shouldEqual None + cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.SpecificVersion |> shouldEqual None cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.ImportTargets |> shouldEqual None cfg.Groups.[Constants.MainDependencyGroup].Sources |> shouldEqual [PackageSource.NuGetV2Source "http://www.nuget.org/api/v2"] @@ -232,6 +233,7 @@ let ``should read config with specific framework``() = let cfg = DependenciesFile.FromSource(specificFrameworkConfig) cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.OmitContent |> shouldEqual None cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.CopyLocal |> shouldEqual None + cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.SpecificVersion |> shouldEqual None cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.ImportTargets |> shouldEqual None cfg.Groups.[Constants.MainDependencyGroup].Sources |> shouldEqual [PackageSource.NuGetV2Source "http://www.nuget.org/api/v2"] @@ -239,6 +241,7 @@ let ``should read config with specific framework``() = let noTargetsImportConfig = """ import_targets false copy_local false +specific_version false source "http://www.nuget.org/api/v2" // first source nuget "Microsoft.SqlServer.Types" @@ -249,6 +252,7 @@ let ``should read no targets import config``() = let cfg = DependenciesFile.FromSource(noTargetsImportConfig) cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.ImportTargets |> shouldEqual (Some false) cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.CopyLocal |> shouldEqual (Some false) + cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.SpecificVersion |> shouldEqual (Some false) cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.OmitContent |> shouldEqual None cfg.Groups.[Constants.MainDependencyGroup].Sources |> shouldEqual [PackageSource.NuGetV2Source "http://www.nuget.org/api/v2"] @@ -786,11 +790,12 @@ let ``should read config with framework restriction``() = p.Settings.FrameworkRestrictions |> getExplicitRestriction |> shouldEqual (makeOrList [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V3_5)); FrameworkRestriction.AtLeast(DotNetFramework(FrameworkVersion.V4))] |> getExplicitRestriction) p.Settings.ImportTargets |> shouldEqual None p.Settings.CopyLocal |> shouldEqual None + p.Settings.SpecificVersion |> shouldEqual None [] let ``should read config with no targets import``() = let config = """ - nuget Foobar 1.2.3 alpha beta import_targets: false, copy_local: false + nuget Foobar 1.2.3 alpha beta import_targets: false, copy_local: false, specific_version: false """ let cfg = DependenciesFile.FromSource(config) @@ -799,12 +804,13 @@ let ``should read config with no targets import``() = p.Settings.FrameworkRestrictions |> getExplicitRestriction |> shouldEqual FrameworkRestriction.NoRestriction p.Settings.ImportTargets |> shouldEqual (Some false) p.Settings.CopyLocal |> shouldEqual (Some false) + p.Settings.SpecificVersion |> shouldEqual (Some false) p.Settings.OmitContent |> shouldEqual None [] let ``should read config with content none``() = let config = """ - nuget Foobar 1.2.3 alpha beta content: none, copy_local: false + nuget Foobar 1.2.3 alpha beta content: none, copy_local: false, specific_version: true """ let cfg = DependenciesFile.FromSource(config) @@ -813,6 +819,7 @@ let ``should read config with content none``() = p.Settings.FrameworkRestrictions |> getExplicitRestriction |> shouldEqual FrameworkRestriction.NoRestriction p.Settings.ImportTargets |> shouldEqual None p.Settings.CopyLocal |> shouldEqual (Some false) + p.Settings.SpecificVersion |> shouldEqual (Some true) p.Settings.OmitContent |> shouldEqual (Some ContentCopySettings.Omit) [] diff --git a/tests/Paket.Tests/DependenciesFile/SaveSpecs.fs b/tests/Paket.Tests/DependenciesFile/SaveSpecs.fs index 8d0b82b56f..c4df338b75 100644 --- a/tests/Paket.Tests/DependenciesFile/SaveSpecs.fs +++ b/tests/Paket.Tests/DependenciesFile/SaveSpecs.fs @@ -76,6 +76,19 @@ let ``should serialize no local copy config``() = cfg.ToString() |> shouldEqual (normalizeLineEndings noLocalCopyConfig) +let noSpecificVersionConfig = """specific_version: false +source http://www.nuget.org/api/v2 + +nuget FAKE ~> 3.0""" + + +[] +let ``should serialize no specific version config``() = + let cfg = DependenciesFile.FromSource(noLocalCopyConfig) + + cfg.ToString() + |> shouldEqual (normalizeLineEndings noLocalCopyConfig) + let simplestConfig = """nuget FAKE ~> 3.0""" [] @@ -236,8 +249,8 @@ let ``should serialize config with framework restrictions``() = let withNoImportsRestrictions = """source https://www.nuget.org/api/v2 nuget FakeItEasy 1.24.0 -nuget json-ld.net 1.0.3 copy_local: false, import_targets: false, framework: net35, net40 -nuget Example3 !== 2.2.3 alpha beta import_targets: false +nuget json-ld.net 1.0.3 copy_local: false, import_targets: false, framework: net35, net40, specific_version: true +nuget Example3 !== 2.2.3 alpha beta import_targets: false, specific_version: false nuget Example4 import_targets: false, content: none nuget Example5 prerelease import_targets: false diff --git a/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs b/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs index 12e8057042..ab555d7d5d 100644 --- a/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs +++ b/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs @@ -36,7 +36,7 @@ let ``should generate Xml for codecracker.CSharp``() = 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>() ,Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml @@ -57,7 +57,7 @@ let ``should generate Xml for codecracker.CSharp in VisualBasic project``() = 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml @@ -88,7 +88,7 @@ let ``should generate Xml for codecracker.VisualBasic``() = 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml diff --git a/tests/Paket.Tests/InstallModel/Xml/ControlzEx.fs b/tests/Paket.Tests/InstallModel/Xml/ControlzEx.fs new file mode 100644 index 0000000000..b593ff413a --- /dev/null +++ b/tests/Paket.Tests/InstallModel/Xml/ControlzEx.fs @@ -0,0 +1,236 @@ +module Paket.InstallModel.Xml.ControlzEx + +open FsUnit +open NUnit.Framework +open Paket +open Paket.Requirements +open Paket.Domain +open Paket.TestHelpers + +let expectedWithoutSpecificVersion = """ + + + + + ..\..\..\ControlzEx\lib\net40\ControlzEx.dll + True + True + + + ..\..\..\ControlzEx\lib\net40\System.Windows.Interactivity.dll + True + True + + + + + + + ..\..\..\ControlzEx\lib\net45\ControlzEx.dll + True + True + + + ..\..\..\ControlzEx\lib\net45\System.Windows.Interactivity.dll + True + True + + + + + + + ..\..\..\ControlzEx\lib\net462\ControlzEx.dll + True + True + + + ..\..\..\ControlzEx\lib\net462\System.Windows.Interactivity.dll + True + True + + + +""" + +let expectedWithSpecificVersionSetToTrue = """ + + + + + ..\..\..\ControlzEx\lib\net40\ControlzEx.dll + True + True + True + + + ..\..\..\ControlzEx\lib\net40\System.Windows.Interactivity.dll + True + True + True + + + + + + + ..\..\..\ControlzEx\lib\net45\ControlzEx.dll + True + True + True + + + ..\..\..\ControlzEx\lib\net45\System.Windows.Interactivity.dll + True + True + True + + + + + + + ..\..\..\ControlzEx\lib\net462\ControlzEx.dll + True + True + True + + + ..\..\..\ControlzEx\lib\net462\System.Windows.Interactivity.dll + True + True + True + + + +""" + +let expectedWithSpecificVersionSetToFalse = """ + + + + + ..\..\..\ControlzEx\lib\net40\ControlzEx.dll + True + False + True + + + ..\..\..\ControlzEx\lib\net40\System.Windows.Interactivity.dll + True + False + True + + + + + + + ..\..\..\ControlzEx\lib\net45\ControlzEx.dll + True + False + True + + + ..\..\..\ControlzEx\lib\net45\System.Windows.Interactivity.dll + True + False + True + + + + + + + ..\..\..\ControlzEx\lib\net462\ControlzEx.dll + True + False + True + + + ..\..\..\ControlzEx\lib\net462\System.Windows.Interactivity.dll + True + False + True + + + +""" + +[] +let ``should generate Xml without specific version for ControlzEx in CSharp project``() = + ensureDir() + let model = + InstallModel.CreateFromLibs(PackageName "ControlzEx", SemVer.Parse "3.0.1", FrameworkRestriction.NoRestriction, + [ @"..\ControlzEx\lib\net40\ControlzEx.dll" + @"..\ControlzEx\lib\net40\System.Windows.Interactivity.dll" + @"..\ControlzEx\lib\net45\ControlzEx.dll" + @"..\ControlzEx\lib\net45\System.Windows.Interactivity.dll" + @"..\ControlzEx\lib\net462\ControlzEx.dll" + @"..\ControlzEx\lib\net462\System.Windows.Interactivity.dll"] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\ControlzEx\", + [], + [], + 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,None,true,KnownTargetProfiles.AllProfiles,None) + let result = + ctx.ChooseNodes + |> (fun n -> n.Head.OuterXml) + |> normalizeXml + let expectedXml = normalizeXml expectedWithoutSpecificVersion + result |> shouldEqual expectedXml + +[] +let ``should generate Xml with specific version set to true for ControlzEx in CSharp project``() = + ensureDir() + let model = + InstallModel.CreateFromLibs(PackageName "ControlzEx", SemVer.Parse "3.0.1", FrameworkRestriction.NoRestriction, + [ @"..\ControlzEx\lib\net40\ControlzEx.dll" + @"..\ControlzEx\lib\net40\System.Windows.Interactivity.dll" + @"..\ControlzEx\lib\net45\ControlzEx.dll" + @"..\ControlzEx\lib\net45\System.Windows.Interactivity.dll" + @"..\ControlzEx\lib\net462\ControlzEx.dll" + @"..\ControlzEx\lib\net462\System.Windows.Interactivity.dll"] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\ControlzEx\", + [], + [], + 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,Some true,true,KnownTargetProfiles.AllProfiles,None) + let result = + ctx.ChooseNodes + |> (fun n -> n.Head.OuterXml) + |> normalizeXml + let expectedXml = normalizeXml expectedWithSpecificVersionSetToTrue + result |> shouldEqual expectedXml + +[] +let ``should generate Xml with specific version set to false for ControlzEx in CSharp project``() = + ensureDir() + let model = + InstallModel.CreateFromLibs(PackageName "ControlzEx", SemVer.Parse "3.0.1", FrameworkRestriction.NoRestriction, + [ @"..\ControlzEx\lib\net40\ControlzEx.dll" + @"..\ControlzEx\lib\net40\System.Windows.Interactivity.dll" + @"..\ControlzEx\lib\net45\ControlzEx.dll" + @"..\ControlzEx\lib\net45\System.Windows.Interactivity.dll" + @"..\ControlzEx\lib\net462\ControlzEx.dll" + @"..\ControlzEx\lib\net462\System.Windows.Interactivity.dll"] + |> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\ControlzEx\", + [], + [], + 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,Some false,true,KnownTargetProfiles.AllProfiles,None) + let result = + ctx.ChooseNodes + |> (fun n -> n.Head.OuterXml) + |> normalizeXml + let expectedXml = normalizeXml expectedWithSpecificVersionSetToFalse + result |> shouldEqual expectedXml \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/EmptyLibs.fs b/tests/Paket.Tests/InstallModel/Xml/EmptyLibs.fs index 670258c47e..4631d2880f 100644 --- a/tests/Paket.Tests/InstallModel/Xml/EmptyLibs.fs +++ b/tests/Paket.Tests/InstallModel/Xml/EmptyLibs.fs @@ -24,7 +24,7 @@ let ``should generate Xml for framework references and empty libs``() = [], Nuspec.Load(__SOURCE_DIRECTORY__ + "/../../Nuspec/EmptyLibs.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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs b/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs index 1ecead7d76..4b870f5c46 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs @@ -43,7 +43,7 @@ let ``should generate Xml for FSharp.Data.SqlClient 1.4.4``() = [], Nuspec.Load(__SOURCE_DIRECTORY__ + @"\..\..\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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML |> shouldEqual (normalizeXml expected) \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs b/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs index c482357eab..b1c393a81a 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs @@ -30,7 +30,7 @@ let ``should generate Xml for Fantomas 1.5``() = [], 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) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) @@ -50,7 +50,7 @@ let fullDoc = """ ..\..\..\Fantomas\lib\FantomasLib.dll - True + True True diff --git a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs index 8cdeaf204b..1322368fe6 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs @@ -28,7 +28,7 @@ let ``should generate Xml for Fantomas 1.5``() = [], 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) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some false,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs b/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs index 53e030f02a..39ee4d7878 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs @@ -28,7 +28,7 @@ let ``should generate Xml for Fuchu 0.4``() = [], 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs index 85d3de7524..415d40382d 100644 --- a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs +++ b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs @@ -27,7 +27,7 @@ let ``should generate Xml for GitInfoPlanter2.0.0``() = [], 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml emptyReferences) diff --git a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs index 8192b1336c..07d8d5335a 100644 --- a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs @@ -47,7 +47,7 @@ let ``should generate Xml for LibGit2Sharp 2.0.0``() = model.GetLegacyReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> Seq.map (fun f -> f.Path) |> shouldContain @"..\LibGit2Sharp\lib\net40\LibGit2Sharp.dll" - let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expectedReferenceNodes) diff --git a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs index a909cbfccd..10ec969d80 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs @@ -21,7 +21,7 @@ let ``should not install targets node for Microsoft.Bcl.Build``() = model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> Seq.map (fun f -> f.Path) |> shouldContain @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets" - let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,false,KnownTargetProfiles.AllProfiles,None) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,false,KnownTargetProfiles.AllProfiles,None) ctx.FrameworkSpecificPropsNodes |> Seq.length |> shouldEqual 0 ctx.FrameworkSpecificTargetsNodes |> Seq.length |> shouldEqual 0 diff --git a/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs b/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs index d0cc3ce7df..69a0653c27 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs @@ -37,7 +37,7 @@ let ``should generate Xml for Microsoft.CodeAnalysis.Analyzers in CSharp project ensureDir() 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml @@ -58,7 +58,7 @@ let ``should generate Xml for RefactoringEssentials in VisualBasic project``() = ensureDir() 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml @@ -78,7 +78,7 @@ let ``should generate Xml for Microsoft.CodeAnalysis.Analyzers 1.0.0-rc2``() = ensureDir() let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") Assert.IsTrue(project.IsSome) - let ctx = project.Value.GenerateXml(oldModel, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) + let ctx = project.Value.GenerateXml(oldModel, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml diff --git a/tests/Paket.Tests/InstallModel/Xml/Plossum.fs b/tests/Paket.Tests/InstallModel/Xml/Plossum.fs index 2d7673229c..c154a1daa9 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Plossum.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Plossum.fs @@ -31,7 +31,7 @@ let ``should generate Xml for Plossum``() = [], 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs b/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs index b9746c6d7c..fc788b1738 100644 --- a/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs +++ b/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs @@ -28,7 +28,7 @@ let ``should generate Xml for RefactoringEssentials in CSharp project``() = 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml @@ -48,7 +48,7 @@ let ``should generate Xml for RefactoringEssentials in VisualBasic project``() = 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.AnalyzersNode |> (fun n -> n.OuterXml) |> normalizeXml diff --git a/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs b/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs index 21059c05e8..765a556444 100644 --- a/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs +++ b/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs @@ -113,7 +113,7 @@ let ``should generate Xml for Rx-XAML 2.2.4 with correct framework assembly refe { AssemblyName = "System.Windows"; FrameworkRestrictions = makeOrList [FrameworkRestriction.Exactly(Silverlight SilverlightVersion.V5)] } { AssemblyName = "System.Windows"; FrameworkRestrictions = makeOrList [FrameworkRestriction.Exactly(WindowsPhone WindowsPhoneVersion.V7_5)] }]}) - let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXml = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs index fd577deff0..48dc826762 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs @@ -179,7 +179,7 @@ let ``should generate Xml for SQLite``() = 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML |> shouldEqual (normalizeXml expectedReferenceNodes) diff --git a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs index a4a63f7b2f..a894ed9ecc 100644 --- a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs +++ b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs @@ -25,7 +25,7 @@ let ``should generate Xml for StyleCop.MSBuild``() = model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> Seq.map (fun f -> f.Path) |> shouldContain @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" - let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.FrameworkSpecificPropertyChooseNode.OuterXml |> normalizeXml 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 88e65b5daa..60c9d7e8d0 100644 --- a/tests/Paket.Tests/InstallModel/Xml/System.Security.Cryptography.Algorithms.fs +++ b/tests/Paket.Tests/InstallModel/Xml/System.Security.Cryptography.Algorithms.fs @@ -93,7 +93,7 @@ let ``should generate Xml for System.Security.Cryptography.Algorithms in CSharp 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) + let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,None,None,true,KnownTargetProfiles.AllProfiles,None) let result = ctx.ChooseNodes |> (fun n -> n.Head.OuterXml) diff --git a/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs b/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs index b04aa4757b..5885fdbb50 100644 --- a/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs +++ b/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs @@ -45,7 +45,7 @@ let ``should generate Xml for System.Spatial``() = @"..\System.Spatial\lib\sl4\zh-Hans\System.Spatial.resources.dll" ] |> 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML |> shouldEqual (normalizeXml expected) \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs index 49f7b30a96..6ec19bee94 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs @@ -193,7 +193,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [], 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs index 239758ed4e..a57a629d3e 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs @@ -70,7 +70,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [], 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs index 5c49ab1dbf..9d21ab882a 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs @@ -72,7 +72,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [{ AssemblyName = "System.Net.Http"; FrameworkRestrictions = makeOrList [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5))] } { AssemblyName = "System.Net.Http.WebRequest"; FrameworkRestrictions = makeOrList [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5))] }]}) - let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/FrameworkAssemblies.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/FrameworkAssemblies.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs index 0267226bd4..2291d04924 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs @@ -79,7 +79,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [{ AssemblyName = "System.Net.Http"; FrameworkRestrictions = makeOrList [FrameworkRestriction.AtLeast(DotNetFramework(FrameworkVersion.V4_5))] } { AssemblyName = "System.Net.Http.WebRequest"; FrameworkRestrictions = makeOrList [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5))] }]}) - let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,true,KnownTargetProfiles.AllProfiles,None) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) let currentXML = ctx.ChooseNodes.Head.OuterXml |> normalizeXml currentXML |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs b/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs index 7bd450e67e..dcd9fdef3f 100644 --- a/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs +++ b/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs @@ -38,7 +38,7 @@ let ``should generate Xml for xunit.runner.visualstudio 2.0.0``() = [], 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 ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,true,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml emptyReferenceNodes) @@ -70,7 +70,7 @@ let ``should not generate Xml for xunit.runner.visualstudio 2.0.0 if import is d [], 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) + let ctx = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,Some true,None,false,KnownTargetProfiles.AllProfiles,None) ctx.ChooseNodes.Head.OuterXml |> normalizeXml |> shouldEqual (normalizeXml emptyReferenceNodes) diff --git a/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs b/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs index e8ee2647c6..3567a07bc5 100644 --- a/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs +++ b/tests/Paket.Tests/Lockfile/GenerateWithOptionsSpecs.fs @@ -11,6 +11,7 @@ let config1 = """ references strict framework: >= net45 copy_local false +specific_version true source "http://www.nuget.org/api/v2" nuget "Castle.Windsor-log4net" "~> 3.2" @@ -23,6 +24,7 @@ let graph1 = let expected1 = """REFERENCES: STRICT COPY-LOCAL: FALSE +SPECIFIC-VERSION: TRUE RESTRICTION: >= net45 NUGET remote: http://www.nuget.org/api/v2 diff --git a/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs b/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs index d026fa3f2f..b6ee029532 100644 --- a/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs +++ b/tests/Paket.Tests/Lockfile/GeneratorSpecs.fs @@ -127,6 +127,30 @@ let ``should generate lock file with no copy local for packages``() = |> LockFileSerializer.serializePackages cfg.Groups.[Constants.MainDependencyGroup].Options |> shouldEqual (normalizeLineEndings expected) +let configWithSpecificVersion = """ +source "http://www.nuget.org/api/v2" + +nuget "Castle.Windsor-log4net" ~> 3.2 specific_version: false, import_targets: false, framework: net35 +nuget "Rx-Main" "~> 2.0" framework: >= net40 """ + +[] +let ``should generate lock file with no specific version for packages``() = + let expected = """NUGET + remote: http://www.nuget.org/api/v2 + Castle.Windsor (2.1) - specific_version: false, import_targets: false, restriction: == net35 + Castle.Windsor-log4net (3.3) - specific_version: false, import_targets: false, restriction: == net35 + Castle.Windsor (>= 2.0) + log4net (>= 1.0) + log (1.2) - specific_version: false, import_targets: false, restriction: == net35 + log4net (1.1) - specific_version: false, import_targets: false, restriction: == net35 + log (>= 1.0) + Rx-Core (2.1) - restriction: >= net40 + Rx-Main (2.0) - restriction: >= net40 + Rx-Core (>= 2.1)""" + let cfg = DependenciesFile.FromSource(configWithSpecificVersion) + ResolveWithGraph(cfg,noSha1,VersionsFromGraphAsSeq graph, PackageDetailsFromGraph graph).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail() + |> LockFileSerializer.serializePackages cfg.Groups.[Constants.MainDependencyGroup].Options + |> shouldEqual (normalizeLineEndings expected) let configWithDisabledContent = """ source "http://www.nuget.org/api/v2" diff --git a/tests/Paket.Tests/Lockfile/ParserSpecs.fs b/tests/Paket.Tests/Lockfile/ParserSpecs.fs index b6d678cd13..c1d344a8e2 100644 --- a/tests/Paket.Tests/Lockfile/ParserSpecs.fs +++ b/tests/Paket.Tests/Lockfile/ParserSpecs.fs @@ -353,7 +353,7 @@ let frameworkRestricted' = """NUGET ReadOnlyCollectionExtensions (1.2.0) LinqBridge (>= 1.3.0) - framework: >= net20 < net35 ReadOnlyCollectionInterfaces (1.0.0) - framework: net20, net35, >= net40 - ReadOnlyCollectionInterfaces (1.0.0) - copy_local: false, import_targets: false, framework: net20, net35, >= net40 + ReadOnlyCollectionInterfaces (1.0.0) - copy_local: false, specific_version: true, import_targets: false, framework: net20, net35, >= net40 System.Json (4.0.20126.16343) """ @@ -376,6 +376,7 @@ let ``should parse framework restricted lock file in new syntax``() = |> getExplicitRestriction |> shouldEqual (FrameworkRestriction.Between(FrameworkIdentifier.DotNetFramework(FrameworkVersion.V2),FrameworkIdentifier.DotNetFramework(FrameworkVersion.V3_5))) packages.[3].Settings.CopyLocal |> shouldEqual None + packages.[3].Settings.SpecificVersion |> shouldEqual None packages.[3].Settings.ImportTargets |> shouldEqual (Some false) packages.[3].Settings.IncludeVersionInPath |> shouldEqual (Some true) packages.[3].Settings.OmitContent |> shouldEqual (Some ContentCopySettings.Omit) @@ -397,6 +398,7 @@ let ``should parse framework restricted lock file in new syntax``() = packages.[5].Version |> shouldEqual (SemVer.Parse "1.0.0") packages.[5].Settings.ImportTargets |> shouldEqual (Some false) packages.[5].Settings.CopyLocal |> shouldEqual (Some false) + packages.[5].Settings.SpecificVersion |> shouldEqual (Some true) packages.[5].Settings.OmitContent |> shouldEqual None packages.[5].Settings.IncludeVersionInPath |> shouldEqual None packages.[5].Settings.FrameworkRestrictions diff --git a/tests/Paket.Tests/Paket.Tests.fsproj b/tests/Paket.Tests/Paket.Tests.fsproj index cba5f6aab4..2bbd9dfd5a 100644 --- a/tests/Paket.Tests/Paket.Tests.fsproj +++ b/tests/Paket.Tests/Paket.Tests.fsproj @@ -262,6 +262,7 @@ + diff --git a/tests/Paket.Tests/ReferencesFile/ReferencesFileSpecs.fs b/tests/Paket.Tests/ReferencesFile/ReferencesFileSpecs.fs index 56a09929f1..d805df8bdc 100644 --- a/tests/Paket.Tests/ReferencesFile/ReferencesFileSpecs.fs +++ b/tests/Paket.Tests/ReferencesFile/ReferencesFileSpecs.fs @@ -176,8 +176,24 @@ let ``should parse lines with CopyLocal settings correctly``() = refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Length |> shouldEqual 2 refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Name |> shouldEqual (PackageName "Castle.Windsor") refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Settings.CopyLocal |> shouldEqual (Some false) + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Settings.SpecificVersion |> shouldEqual None refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Name |> shouldEqual (PackageName "Newtonsoft.Json") refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.CopyLocal |> shouldEqual None + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.SpecificVersion |> shouldEqual None + +let refFileContentWithSpecificVersionFalse = """Castle.Windsor specific_version : false +Newtonsoft.Json""" + +[] +let ``should parse lines with SpecificVersion settings correctly``() = + let refFile = ReferencesFile.FromLines(toLines refFileContentWithSpecificVersionFalse) + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Length |> shouldEqual 2 + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Name |> shouldEqual (PackageName "Castle.Windsor") + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Settings.CopyLocal |> shouldEqual None + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Settings.SpecificVersion |> shouldEqual (Some false) + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Name |> shouldEqual (PackageName "Newtonsoft.Json") + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.CopyLocal |> shouldEqual None + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.SpecificVersion |> shouldEqual None [] let ``should serialize CopyLocal correctly``() = @@ -189,6 +205,16 @@ Newtonsoft.Json""" |> normalizeLineEndings |> shouldEqual (normalizeLineEndings expected) +[] +let ``should serialize SpecificVersion correctly``() = + let refFile = ReferencesFile.FromLines(toLines refFileContentWithSpecificVersionFalse) + let expected = """Castle.Windsor specific_version: false +Newtonsoft.Json""" + + refFile.ToString() + |> normalizeLineEndings + |> shouldEqual (normalizeLineEndings expected) + let refFileContentWithNoTargetsImport = """Castle.Windsor import_targets: false Newtonsoft.Json""" @@ -213,9 +239,11 @@ let ``should parse lines with CopyLocal and import_targets settings correctly``( refFile.NugetPackages.Length |> shouldEqual 3 refFile.NugetPackages.Head.Name |> shouldEqual (PackageName "Castle.Windsor") refFile.NugetPackages.Head.Settings.CopyLocal |> shouldEqual (Some false) + refFile.NugetPackages.Head.Settings.SpecificVersion |> shouldEqual None refFile.NugetPackages.Head.Settings.ImportTargets |> shouldEqual (Some false) refFile.NugetPackages.Tail.Head.Name |> shouldEqual (PackageName "Newtonsoft.Json") refFile.NugetPackages.Tail.Head.Settings.CopyLocal |> shouldEqual None + refFile.NugetPackages.Tail.Head.Settings.SpecificVersion |> shouldEqual None refFile.NugetPackages.Tail.Head.Settings.ImportTargets |> shouldEqual None [] @@ -231,11 +259,11 @@ xUnit import_targets: false""" let legacyRefFileContentWithMultipleSettings = """Castle.Windsor copy_local: false, import_targets: false, framework: net35, >= net40 -Newtonsoft.Json content: none, framework: net40 +Newtonsoft.Json content: none, specific_version: false, framework: net40 xUnit import_targets: false""" let refFileContentWithMultipleSettings = """Castle.Windsor copy_local: false, import_targets: false, restriction: || (== net35) (>= net40) -Newtonsoft.Json content: none, restriction: == net40 +Newtonsoft.Json specific_version: false, content: none, restriction: == net40 xUnit import_targets: false""" [] @@ -245,15 +273,18 @@ let ``should parse and serialize lines with multiple settings settings correctly refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Length |> shouldEqual 3 refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Name |> shouldEqual (PackageName "Castle.Windsor") refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Settings.CopyLocal |> shouldEqual (Some false) + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Settings.SpecificVersion |> shouldEqual None refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Head.Settings.ImportTargets |> shouldEqual (Some false) refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Name |> shouldEqual (PackageName "Newtonsoft.Json") refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.CopyLocal |> shouldEqual None + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.SpecificVersion |> shouldEqual (Some false) refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.ImportTargets |> shouldEqual None refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Head.Settings.OmitContent |> shouldEqual (Some ContentCopySettings.Omit) refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Tail.Head.Name |> shouldEqual (PackageName "xUnit") refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Tail.Head.Settings.CopyLocal |> shouldEqual None + refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Tail.Head.Settings.SpecificVersion |> shouldEqual None refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Tail.Head.Settings.ImportTargets |> shouldEqual (Some false) refFile.Groups.[Constants.MainDependencyGroup].NugetPackages.Tail.Tail.Head.Settings.OmitContent |> shouldEqual None