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

Special case System.Net.http #2628

Merged
merged 3 commits into from
Aug 19, 2017
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
5 changes: 3 additions & 2 deletions src/Paket.Core/Installation/RestoreProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ let CreateInstallModel(alternativeProjectRoot, root, groupName, sources, caches,
let! (package, content) = ExtractPackage(alternativeProjectRoot, root, groupName, sources, caches, force, package, false)
let model =
InstallModel.CreateFromContent(
package.Name, package.Version,
package.Settings.FrameworkRestrictions |> Requirements.getExplicitRestriction,
package.Name,
package.Version,
Requirements.getExplicitRestriction package.Settings.FrameworkRestrictions,
content.Force())
return (groupName,package.Name), (package,model)
}
Expand Down
64 changes: 46 additions & 18 deletions src/Paket.Core/PaketConfigFiles/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,16 @@ module ProjectFile =
| "$(TargetFrameworkIdentifier) == 'true'" -> "true"
| _ -> condition

let frameworkReferences = libFolder.FolderContents.FrameworkReferences |> Seq.sortBy (fun (r) -> r.Name) |> Seq.toList
let libraries = libFolder.FolderContents.Libraries |> Seq.sortBy (fun (r) -> r.Path) |> Seq.toList
let frameworkReferences =
libFolder.FolderContents.FrameworkReferences
|> Seq.sortBy (fun r -> r.Name)
|> Seq.toList

let libraries =
libFolder.FolderContents.Libraries
|> Seq.sortBy (fun r -> r.Path)
|> Seq.toList

let assemblyTargets = ref libFolder.Targets
let duplicates = HashSet<_>()
for frameworkAssembly in frameworkReferences do
Expand All @@ -799,7 +807,8 @@ module ProjectFile =
[condition,createItemGroup libFolder.Targets frameworkReferences libraries,false]
else
let specialFrameworkAssemblies, rest =
frameworkReferences |> List.partition (fun fr -> duplicates.Contains fr.Name)
frameworkReferences
|> List.partition (fun fr -> duplicates.Contains fr.Name)

match PlatformMatching.getCondition referenceCondition allTargets !assemblyTargets with
| "" -> [condition,createItemGroup libFolder.Targets rest libraries,false]
Expand Down Expand Up @@ -1095,22 +1104,41 @@ module ProjectFile =

let usedFrameworkLibs = HashSet<TargetProfile*string>()

completeModel
|> Seq.filter (fun kv -> usedPackages.ContainsKey kv.Key)
|> Seq.sortBy (fun kv -> let group, packName = kv.Key in group.CompareString, packName.CompareString)
|> Seq.map (fun kv ->
deleteCustomModelNodes (snd kv.Value) project
let installSettings = snd usedPackages.[kv.Key]
let restrictionList =
installSettings.FrameworkRestrictions
|> getExplicitRestriction

let projectModel =
(snd kv.Value)
.ApplyFrameworkRestrictions(restrictionList)
.FilterExcludes(installSettings.Excludes)
.RemoveIfCompletelyEmpty()
let specialPackagesWithFrameworkConflictLibs =
[PackageName "System.Net.Http"] // see https://github.com/fsprojects/Paket/issues/2352
|> Set.ofList

let filteredModel =
completeModel
|> Map.filter (fun kv _ -> usedPackages.ContainsKey kv)

filteredModel
|> Seq.map (fun kv ->
deleteCustomModelNodes (snd kv.Value) project
let installSettings = snd usedPackages.[kv.Key]
let restrictionList =
installSettings.FrameworkRestrictions
|> getExplicitRestriction

let projectModel =
(snd kv.Value)
.ApplyFrameworkRestrictions(restrictionList)
.FilterExcludes(installSettings.Excludes)
.RemoveIfCompletelyEmpty()

let _, packageName = kv.Key
if specialPackagesWithFrameworkConflictLibs.Contains packageName then
for t in KnownTargetProfiles.AllProfiles do
if (projectModel.GetLibReferenceFiles t)
|> Seq.exists (fun t -> t.Name = packageName.ToString() + ".dll")
then
usedFrameworkLibs.Add(t,packageName.ToString()) |> ignore

kv,installSettings,restrictionList,projectModel)
|> Seq.sortBy (fun (kv,_,_,_) ->
let group, packName = kv.Key
group.CompareString, packName.CompareString)
|> Seq.map (fun (kv,installSettings,restrictionList,projectModel) ->
if directPackages.ContainsKey kv.Key then
let targetProfile = getTargetProfile project
if isTargetMatchingRestrictions(restrictionList,targetProfile) then
Expand Down
2 changes: 1 addition & 1 deletion src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<StartProgram>paket.exe</StartProgram>
<StartAction>Project</StartAction>
<StartArguments>update</StartArguments>
<StartWorkingDirectory>C:\temp\Library2</StartWorkingDirectory>
<StartWorkingDirectory>C:\temp\fixed</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
Expand Down