Skip to content

Commit 7413053

Browse files
committed
Don't report warnings for packages that are not installed for current target framework - fixes #1693
1 parent b1da96a commit 7413053

File tree

18 files changed

+29
-174
lines changed

18 files changed

+29
-174
lines changed

RELEASE_NOTES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#### 3.2.0-alpha001 - 23.06.2016
1+
#### 3.2.0-alpha002 - 23.06.2016
2+
* BUGFIX: Don't report warnings for packages that are not installed for current target framework - https://github.com/fsprojects/Paket/issues/1693
23
* BUGFIX: Runtime deps are copied based on TargetFramework - https://github.com/fsprojects/Paket/issues/1751
34
* BUGFIX: Do not take over control over manual nodes - https://github.com/fsprojects/Paket/issues/1746
45
* BUGFIX: Better error message when log file is missing - https://github.com/fsprojects/Paket/issues/1743

integrationtests/Paket.IntegrationTests/InstallSpecs.fs

-6
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,6 @@ let ``#1458 should not install conflicting deps from different groups``() =
361361
with
362362
| exn when exn.Message.Contains "Package Nancy is referenced in different versions" -> ()
363363

364-
365-
[<Test>]
366-
let ``#1442 warn if install finds no libs``() =
367-
let result = paket "install" "i001442-warn-if-empty"
368-
result |> shouldContainText "contains libraries, but not for the selected TargetFramework"
369-
370364
[<Test>]
371365
let ``#1442 should not warn on SonarLint``() =
372366
let result = paket "install" "i001442-dont-warn"

integrationtests/scenarios/i001442-warn-if-empty/before/MyClassLibrary/MyClassLibrary.sln

-27
This file was deleted.

integrationtests/scenarios/i001442-warn-if-empty/before/MyClassLibrary/MyClassLibrary/Class1.cs

-12
This file was deleted.

integrationtests/scenarios/i001442-warn-if-empty/before/MyClassLibrary/MyClassLibrary/MyClassLibrary.csprojtemplate

-65
This file was deleted.

integrationtests/scenarios/i001442-warn-if-empty/before/MyClassLibrary/MyClassLibrary/Properties/AssemblyInfo.cs

-36
This file was deleted.

integrationtests/scenarios/i001442-warn-if-empty/before/MyClassLibrary/MyClassLibrary/paket.references

-1
This file was deleted.

integrationtests/scenarios/i001442-warn-if-empty/before/paket.dependencies

-3
This file was deleted.

nupkgs/NUnit.3.2.0.nupkg

-1000 KB
Binary file not shown.
1.25 MB
Binary file not shown.

src/Paket.Bootstrapper/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
[assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")]
77
[assembly: AssemblyVersionAttribute("3.2.0")]
88
[assembly: AssemblyFileVersionAttribute("3.2.0")]
9-
[assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha001")]
9+
[assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha002")]
1010
namespace System {
1111
internal static class AssemblyVersionInformation {
1212
internal const string Version = "3.2.0";
13-
internal const string InformationalVersion = "3.2.0-alpha001";
13+
internal const string InformationalVersion = "3.2.0-alpha002";
1414
}
1515
}

src/Paket.Core/AssemblyInfo.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ open System.Reflection
77
[<assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")>]
88
[<assembly: AssemblyVersionAttribute("3.2.0")>]
99
[<assembly: AssemblyFileVersionAttribute("3.2.0")>]
10-
[<assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha001")>]
10+
[<assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha002")>]
1111
do ()
1212

1313
module internal AssemblyVersionInformation =
1414
let [<Literal>] Version = "3.2.0"
15-
let [<Literal>] InformationalVersion = "3.2.0-alpha001"
15+
let [<Literal>] InformationalVersion = "3.2.0-alpha002"

src/Paket.Core/ProjectFile.fs

+12-10
Original file line numberDiff line numberDiff line change
@@ -882,23 +882,25 @@ module ProjectFile =
882882
|> Seq.map (fun kv ->
883883
deleteCustomModelNodes (snd kv.Value) project
884884
let installSettings = snd usedPackages.[kv.Key]
885+
let restrictionList = installSettings.FrameworkRestrictions |> getRestrictionList
885886
let projectModel =
886887
(snd kv.Value)
887-
.ApplyFrameworkRestrictions(installSettings.FrameworkRestrictions |> getRestrictionList)
888+
.ApplyFrameworkRestrictions(restrictionList)
888889
.FilterExcludes(installSettings.Excludes)
889890
.RemoveIfCompletelyEmpty()
890891

891892
match getTargetFramework project with
892893
| Some targetFramework ->
893-
if projectModel.GetLibReferences targetFramework |> Seq.isEmpty then
894-
let libReferences =
895-
projectModel.GetLibReferencesLazy |> force
896-
|> Seq.filter (fun l -> match l with | Reference.Library _ -> true | _ -> false)
897-
898-
if not (Seq.isEmpty libReferences) then
899-
traceWarnfn "Package %O contains libraries, but not for the selected TargetFramework %O in project %s."
900-
(snd kv.Key) targetFramework project.FileName
901-
| None -> ()
894+
if isTargetMatchingRestrictions(restrictionList,SinglePlatform targetFramework) then
895+
if projectModel.GetLibReferences targetFramework |> Seq.isEmpty then
896+
let libReferences =
897+
projectModel.GetLibReferencesLazy |> force
898+
|> Seq.filter (fun l -> match l with | Reference.Library _ -> true | _ -> false)
899+
900+
if not (Seq.isEmpty libReferences) then
901+
traceWarnfn "Package %O contains libraries, but not for the selected TargetFramework %O in project %s."
902+
(snd kv.Key) targetFramework project.FileName
903+
| _ -> ()
902904

903905
let copyLocal = defaultArg installSettings.CopyLocal true
904906
let importTargets = defaultArg installSettings.ImportTargets true

src/Paket.Core/Requirements.fs

+1
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ let filterRestrictions (list1:FrameworkRestrictions) (list2:FrameworkRestriction
378378
/// Get if a target should be considered with the specified restrictions
379379
let isTargetMatchingRestrictions =
380380
memoize <| fun (restrictions:FrameworkRestriction list, target) ->
381+
if List.isEmpty restrictions then true else
381382
match target with
382383
| SinglePlatform (Runtimes _ ) -> true
383384
| SinglePlatform pf ->

src/Paket.PowerShell/AssemblyInfo.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ open System.Reflection
77
[<assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")>]
88
[<assembly: AssemblyVersionAttribute("3.2.0")>]
99
[<assembly: AssemblyFileVersionAttribute("3.2.0")>]
10-
[<assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha001")>]
10+
[<assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha002")>]
1111
do ()
1212

1313
module internal AssemblyVersionInformation =
1414
let [<Literal>] Version = "3.2.0"
15-
let [<Literal>] InformationalVersion = "3.2.0-alpha001"
15+
let [<Literal>] InformationalVersion = "3.2.0-alpha002"

src/Paket/AssemblyInfo.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ open System.Reflection
77
[<assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")>]
88
[<assembly: AssemblyVersionAttribute("3.2.0")>]
99
[<assembly: AssemblyFileVersionAttribute("3.2.0")>]
10-
[<assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha001")>]
10+
[<assembly: AssemblyInformationalVersionAttribute("3.2.0-alpha002")>]
1111
do ()
1212

1313
module internal AssemblyVersionInformation =
1414
let [<Literal>] Version = "3.2.0"
15-
let [<Literal>] InformationalVersion = "3.2.0-alpha001"
15+
let [<Literal>] InformationalVersion = "3.2.0-alpha002"

src/Paket/Paket.fsproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<StartArguments>update -f</StartArguments>
5353
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001117-aws\temp</StartWorkingDirectory>
5454
<StartArguments>update</StartArguments>
55-
<StartWorkingDirectory>D:\code\paket3dotnetcoreissue</StartWorkingDirectory>
55+
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001442-warn-Rx\temp</StartWorkingDirectory>
5656
</PropertyGroup>
5757
<PropertyGroup>
5858
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>

src/Paket/PlatformTask.fs

+5-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ type CopyRuntimeDependencies() =
8181
try
8282
let g = lockFile.Groups.[groupName]
8383
let p = g.Resolution.[packageName]
84-
match filterRestrictions g.Options.Settings.FrameworkRestrictions p.Settings.FrameworkRestrictions with
85-
| FrameworkRestrictionList restrictions ->
86-
isTargetMatchingRestrictions(restrictions,restriction)
87-
| _ -> true
84+
let restrictions =
85+
filterRestrictions g.Options.Settings.FrameworkRestrictions p.Settings.FrameworkRestrictions
86+
|> getRestrictionList
87+
88+
isTargetMatchingRestrictions(restrictions,restriction)
8889
with
8990
| _ -> true)
9091
else

0 commit comments

Comments
 (0)