Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change caching logic to be more suitable for FAKE and in particular the Ionide tooling #3598

Merged
merged 4 commits into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integrationtests/Paket.IntegrationTests/AddGithubSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ open Paket.Domain
[<Test>]
let ``#3014 paket github add clitool``() =
let scenario = "i003014-add-github"
prepare scenario
paket "github add forki/FsUnit" scenario |> ignore
use __ = prepare scenario
directPaket "github add forki/FsUnit" scenario |> ignore<string>

let depsFile = DependenciesFile.ReadFromFile(Path.Combine(scenarioTempPath scenario,"paket.dependencies"))
let requirement = depsFile.GetGroup(Constants.MainDependencyGroup).RemoteFiles |> List.exactlyOne
Expand Down
6 changes: 3 additions & 3 deletions integrationtests/Paket.IntegrationTests/AddSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open Paket.Domain
[<Test>]
let ``#320 paket add clitool``() =
let scenario = "i000320-add-clitool"
paket "add dotnet-fable --version 1.3.7 -t clitool --no-resolve" scenario |> ignore
use __ = paket "add dotnet-fable --version 1.3.7 -t clitool --no-resolve" scenario |> fst

let depsFile = DependenciesFile.ReadFromFile(Path.Combine(scenarioTempPath scenario,"paket.dependencies"))
let requirement = depsFile.GetGroup(Constants.MainDependencyGroup).Packages |> List.exactlyOne
Expand All @@ -24,7 +24,7 @@ let ``#320 paket add clitool``() =
[<Test>]
let ``#321 paket add nuget is the default``() =
let scenario = "i000321-add-nuget"
paket "add Argu --version 1.2.3 --no-resolve" scenario |> ignore
use __ = paket "add Argu --version 1.2.3 --no-resolve" scenario |> fst

let depsFile = DependenciesFile.ReadFromFile(Path.Combine(scenarioTempPath scenario,"paket.dependencies"))
let requirement = depsFile.GetGroup(Constants.MainDependencyGroup).Packages |> List.exactlyOne
Expand All @@ -35,7 +35,7 @@ let ``#321 paket add nuget is the default``() =
[<Test>]
let ``#310 paket add nuget should not resolve inconsistent dependency graph``() =
try
paket "add nuget Castle.Windsor version 3.3.0" "i000310-add-should-not-create-invalid-resolution" |> ignore
use __ = paket "add nuget Castle.Windsor version 3.3.0" "i000310-add-should-not-create-invalid-resolution" |> fst
failwith "resolver error expected"
with
| exn when exn.Message.Contains("There was a version conflict during package resolution") -> ()
48 changes: 32 additions & 16 deletions integrationtests/Paket.IntegrationTests/BasicResolverSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,64 +22,74 @@ open Paket.Domain

[<Test>]
let ``#49 windsor should resolve correctly``() =
let lockFile = update "i000049-resolve-windsor-correctly"
let cleanup, lockFile = update "i000049-resolve-windsor-correctly"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Castle.Windsor"].Version
|> shouldEqual (SemVer.Parse "3.2.1")

[<Test>]
let ``#51 should resolve with pessimistic strategy correctly``() =
// TODO: change back to i000051-resolve-pessimistic
let lockFile = update "i000051"
let cleanup, lockFile = update "i000051"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Castle.Windsor-log4net"].Version
|> shouldEqual (SemVer.Parse "3.2.0.1")

[<Test>]
let ``#55 should resolve with pessimistic strategy correctly``() =
let lockFile = update "i000055-resolve-with-pessimistic-strategy"
let cleanup, lockFile = update "i000055-resolve-with-pessimistic-strategy"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Castle.Windsor"].Version
|> shouldEqual (SemVer.Parse "3.2.1")

[<Test>]
let ``#71 should ignore trailing zero during resolve``() =
let lockFile = update "i000071-ignore-trailing-zero-during-resolve"
let cleanup, lockFile = update "i000071-ignore-trailing-zero-during-resolve"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Newtonsoft.Json"].Version
|> shouldEqual (SemVer.Parse "6.0.5.0")

[<Test>]
let ``#108 should resolve jquery case-insensitive``() =
let lockFile = update "i000108-case-insensitive-nuget-packages"
let cleanup, lockFile = update "i000108-case-insensitive-nuget-packages"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "jQuery"].Version
|> shouldEqual (SemVer.Parse "1.9.0")

[<Test>]
let ``#144 should resolve nunit from fsunit``() =
let lockFile = update "i000144-resolve-nunit"
let cleanup, lockFile = update "i000144-resolve-nunit"
use __ = cleanup
let v = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "NUnit"].Version
v |> shouldBeGreaterThan (SemVer.Parse "2.6")
v |> shouldBeSmallerThan (SemVer.Parse "3")

[<Test>]
let ``#156 should resolve prerelease of logary``() =
let lockFile = update "i000156-resolve-prerelease-logary"
let cleanup, lockFile = update "i000156-resolve-prerelease-logary"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "FSharp.Actor-logary"].Version
|> shouldEqual (SemVer.Parse "2.0.0-alpha5")

[<Test>]
let ``#173 should resolve primary dependency optimistic``() =
let lockFile = update "i000173-resolve-primary-dependency-optimistic"
let cleanup, lockFile = update "i000173-resolve-primary-dependency-optimistic"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "FSharp.Formatting"].Version
|> shouldBeGreaterThan (SemVer.Parse "2.12.0")

[<Test>]
let ``#220 should respect the == operator``() =
let lockFile = update "i000220-use-exactly-this-constraint"
let cleanup, lockFile = update "i000220-use-exactly-this-constraint"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Microsoft.AspNet.Razor"].Version
|> shouldEqual (SemVer.Parse "2.0.30506.0")


[<Test>]
let ``#299 should restore package ending in lib``() =
let lockFile = update "i000299-restore-package-that-ends-in-lib"
let cleanup, lockFile = update "i000299-restore-package-that-ends-in-lib"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "FunScript.TypeScript.Binding.lib"].Version
|> shouldBeGreaterThan (SemVer.Parse "0")

Expand All @@ -88,7 +98,8 @@ let ``#299 should restore package ending in lib``() =

[<Test>]
let ``#359 should restore package with nuget in name``() =
let lockFile = update "i000359-packagename-contains-nuget"
let cleanup, lockFile = update "i000359-packagename-contains-nuget"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Nuget.CommandLine"].Version
|> shouldBeGreaterThan (SemVer.Parse "0")

Expand All @@ -97,31 +108,36 @@ let ``#359 should restore package with nuget in name``() =

[<Test>]
let ``#1177 should resolve with pessimistic strategy correctly``() =
let lockFile = update "i001177-resolve-with-pessimistic-strategy"
let cleanup, lockFile = update "i001177-resolve-with-pessimistic-strategy"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Castle.Core"].Version
|> shouldEqual (SemVer.Parse "3.2.0")

[<Test>]
let ``#1189 should allow # in path``() =
let lockFile = update "i001189-allow-#-in-path"
let cleanup, lockFile = update "i001189-allow-#-in-path"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "FAKE"].Version
|> shouldBeGreaterThan (SemVer.Parse "4.7.2")

[<Test>]
let ``#1254 should install unlisted transitive dependencies``() =
let lockFile = update "i001254-unlisted"
let cleanup, lockFile = update "i001254-unlisted"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "WebActivator"].Version
|> shouldEqual (SemVer.Parse "1.5.3")

[<Test>]
let ``#1450 should resolve with twiddle wakka``() =
let lockFile = update "i001450-twiddle-wakka"
let cleanup, lockFile = update "i001450-twiddle-wakka"
use __ = cleanup
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "EnterpriseLibrary.SemanticLogging"].Version
|> shouldBeSmallerThan (SemVer.Parse "3")

[<Test>]
let ``#2640 shouldn't try GetDetails if package only exists locally``() =
updateEx true "i002640" |> ignore
use __ = updateEx true "i002640" |> fst
ignore __

#if INTERACTIVE
;;
Expand Down
18 changes: 9 additions & 9 deletions integrationtests/Paket.IntegrationTests/BindingRedirect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ open Paket

[<Test>]
let ``install should redirect required assemblies only``() =
paket "install --redirects --createnewbindingfiles" "i001187-binding-redirect" |> ignore
use __ = paket "install --redirects --createnewbindingfiles" "i001187-binding-redirect" |> fst

let path = Path.Combine(scenarioTempPath "i001187-binding-redirect")
let config1Path = Path.Combine(path, "Project1", "app.config")
Expand Down Expand Up @@ -74,22 +74,22 @@ let ``install should redirect required assemblies only``() =
[<Test>]
let ``#1195 should report broken app.config``() =
try
paket "install --redirects" "i001195-broken-appconfig" |> ignore
use __ = paket "install --redirects" "i001195-broken-appconfig" |> fst
failwith "paket should fail"
with
| exn when exn.Message.Contains("Project1") && exn.Message.Contains("app.config") -> ()

[<Test>]
let ``#2408 should report wrong app.config parsing``() =
try
paket "install --redirects" "i002408-indenting-appconfig" |> ignore
use __ = paket "install --redirects" "i002408-indenting-appconfig" |> fst
failwith "paket should fail"
with
| exn when exn.Message.Contains("Project1") && exn.Message.Contains("app.config") -> ()

[<Test>]
let ``#1218 install should replace paket's binding redirects with required only``() =
paket "install --redirects --createnewbindingfiles" "i001218-binding-redirect" |> ignore
use __ = paket "install --redirects --createnewbindingfiles" "i001218-binding-redirect" |> fst

let path = Path.Combine(scenarioTempPath "i001218-binding-redirect")
let config1Path = Path.Combine(path, "Project1", "app.config")
Expand Down Expand Up @@ -167,7 +167,7 @@ let ``#1218 install should replace paket's binding redirects with required only`

[<Test>]
let ``#1270 force redirects``() =
paket "install --createnewbindingfiles" "i001270-force-redirects" |> ignore
use __ = paket "install --createnewbindingfiles" "i001270-force-redirects" |> fst
let path = Path.Combine(scenarioTempPath "i001270-force-redirects")
let configPath = Path.Combine(path, "MyClassLibrary", "MyClassLibrary", "app.config")

Expand All @@ -185,7 +185,7 @@ let ``#1270 force redirects``() =

[<Test>]
let ``#1270 redirects from references``() =
paket "install --createnewbindingfiles" "i001270-force-redirects" |> ignore
use __ = paket "install --createnewbindingfiles" "i001270-force-redirects" |> fst
let path = Path.Combine(scenarioTempPath "i001270-force-redirects")
let configPath = Path.Combine(path, "MyClassLibrary", "MyClassLibrary2", "app.config")

Expand All @@ -203,7 +203,7 @@ let ``#1270 redirects from references``() =

[<Test>]
let ``#1574 redirects GAC``() =
paket "install --clean-redirects" "i001574-redirect-gac" |> ignore
use __ = paket "install --clean-redirects" "i001574-redirect-gac" |> fst
let path = Path.Combine(scenarioTempPath "i001574-redirect-gac")
let configPath = Path.Combine(path, "BindingRedirectPaketBug", "App.config")
let originalConfigPath = Path.Combine(path, "BindingRedirectPaketBug", "App.config.expected")
Expand All @@ -217,7 +217,7 @@ let ``#1574 redirects GAC``() =
[<Test>]
let ``#1621 generates binding redirect when references project with another target profile``() =
let scenario = "i001621-different-framework"
install scenario |> ignore
use __ = install scenario |> fst
let ``NUnit`` = """<assemblyIdentity name="nunit.framework" publicKeyToken="2638cd05610744eb" culture="neutral" />"""
let ``NUnit correct version`` = "newVersion=\"3.0.5813.39031\""

Expand All @@ -232,7 +232,7 @@ let ``#1621 generates binding redirect when references project with another targ
[<Test>]
let ``#1783 generates binding redirect when assembly with different version of main group``() =
let scenario = "i001783-different-versions"
install scenario |> ignore
use __ = install scenario |> fst
let ``FSharp.Core`` = """<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />"""
let ``Newtonsoft.Json`` = """<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />"""

Expand Down
28 changes: 16 additions & 12 deletions integrationtests/Paket.IntegrationTests/ConvertFromNuGetSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open Paket.Requirements

[<Test>]
let ``#1217 should convert simple C# project``() =
paket "convert-from-nuget" "i001217-convert-simple-project" |> ignore
use __ = paket "convert-from-nuget" "i001217-convert-simple-project" |> fst
let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001217-convert-simple-project","paket.lock"))
let v = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Newtonsoft.Json"].Version
v.Major |> shouldEqual 7u
Expand All @@ -27,7 +27,7 @@ let ``#1217 should convert simple C# project``() =

[<Test>]
let ``#1225 should convert simple C# project with non-matching framework restrictions``() =
paket "convert-from-nuget" "i001225-convert-simple-project-non-matching-restrictions" |> ignore
use __ = paket "convert-from-nuget" "i001225-convert-simple-project-non-matching-restrictions" |> fst
let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001225-convert-simple-project-non-matching-restrictions","paket.lock"))
let v = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Newtonsoft.Json"].Version
v.Major |> shouldEqual 7u
Expand Down Expand Up @@ -58,15 +58,15 @@ let ``#1217 should replace packages.config files in project``() =
originalProjectFile.Document.OuterXml.Contains("packages.config") |> shouldEqual true
originalProjectFile.Document.OuterXml.Contains("paket.references") |> shouldEqual false

paket "convert-from-nuget" "i001217-convert-simple-project" |> ignore
use __ = paket "convert-from-nuget" "i001217-convert-simple-project" |> fst
let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001217-convert-simple-project","paket.lock"))
let projectFile = ProjectFile.loadFromFile(Path.Combine(scenarioTempPath "i001217-convert-simple-project", "ClassLibrary1", "ClassLibrary1.csproj"))
projectFile.Document.OuterXml.Contains("packages.config") |> shouldEqual false
projectFile.Document.OuterXml.Contains("paket.references") |> shouldEqual true

[<Test>]
let ``#1591 should convert denormalized versions``() =
paket "convert-from-nuget" "i001591-convert-denormalized" |> ignore
use __ = paket "convert-from-nuget" "i001591-convert-denormalized" |> fst
let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001591-convert-denormalized","paket.lock"))
let v = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "EntityFramework"].Version
v.Major |> shouldEqual 6u
Expand All @@ -79,7 +79,7 @@ let ``#1591 should convert denormalized versions``() =
[<Test>]
let ``#1922 should remove references to moved analyzers``() =
let scenario = "i001922-convert-nuget-with-analyzers"
paket "convert-from-nuget" scenario |> ignore
use __ = paket "convert-from-nuget" scenario |> fst
let projectFile = ProjectFile.loadFromFile(Path.Combine(scenarioTempPath scenario, "ConvertFromNugetWithAnalyzers", "ConvertFromNugetWithAnalyzers.csproj"))
let projectXml = projectFile.Document.OuterXml
StringAssert.DoesNotContain(@"<Analyzer Include=""..\packages\StyleCop.Analyzers.1.0.0\analyzers\dotnet\cs\Newtonsoft.Json.dll""", projectXml)
Expand All @@ -91,7 +91,7 @@ let ``#1922 should remove references to moved analyzers``() =
StringAssert.Contains(@"<Analyzer Include=""..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.dll"">", projectXml)

let testPaketDependenciesFileInSolution scenario expectedFiles =
paket "convert-from-nuget" scenario |> ignore
use __ = paket "convert-from-nuget" scenario |> fst

let expectedLines =
[ yield "Project\\(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\"\\) = \"\\.paket\", \"\\.paket\", \"{[^}]+}\""
Expand Down Expand Up @@ -121,7 +121,7 @@ let ``#2512 should put paket.dependencies inside the .paket folder that already
[<Test>]
let ``#2528 sdk-2: convert-from-nuget should add explicit FSharp.Core``() =
let scenario = "i002528-1"
paket "convert-from-nuget" scenario |> ignore
use __ = paket "convert-from-nuget" scenario |> fst
let dependenciesFile = File.ReadAllLines(Path.Combine(scenarioTempPath scenario,"paket.dependencies"))
dependenciesFile
|> shouldContain "nuget FSharp.Core"
Expand All @@ -132,7 +132,7 @@ let ``#2528 sdk-2: convert-from-nuget should add explicit FSharp.Core``() =
[<Test>]
let ``#2528 sdk-2: convert-from-nuget should not add FSharp.Core for csharp``() =
let scenario = "i002528-2"
paket "convert-from-nuget" scenario |> ignore
use __ = paket "convert-from-nuget" scenario |> fst
let dependenciesFile = File.ReadAllLines(Path.Combine(scenarioTempPath scenario,"paket.dependencies"))
dependenciesFile
|> shouldNotContain "nuget FSharp.Core"
Expand All @@ -143,27 +143,31 @@ let ``#2528 sdk-2: convert-from-nuget should not add FSharp.Core for csharp``()
[<Test>]
let ``#2528 sdk-2: install should not warn without FSharp.Core for csharp``() =
let scenario = "i002528-3"
let messages = paket "install" scenario
let cleanup, messages = paket "install" scenario
use __ = cleanup
messages
|> shouldNotContainText "does not reference FSharp.Core"

[<Test>]
let ``#2528 sdk-2: install should not warn with FSharp.Core``() =
let scenario = "i002528-4"
let messages = paket "install" scenario
let cleanup, messages = paket "install" scenario
use __ = cleanup
messages
|> shouldNotContainText "does not reference FSharp.Core"

[<Test>]
let ``#2528 sdk-2: install should warn without FSharp.Core: not in dep, not in ref``() =
let scenario = "i002528-5"
let messages = paket "install" scenario
let cleanup, messages = paket "install" scenario
use __ = cleanup
messages
|> shouldContainText "does not reference FSharp.Core"

[<Test>]
let ``#2528 sdk-2: install should warn without FSharp.Core: in dep but not in ref``() =
let scenario = "i002528-6"
let messages = paket "install" scenario
let cleanup, messages = paket "install" scenario
use __ = cleanup
messages
|> shouldContainText "does not reference FSharp.Core"
Loading