@@ -600,6 +600,13 @@ type Dependencies(dependenciesFileName: string) =
600
600
|> Seq.map ( fun kv -> kv.Key.ToString())
601
601
|> Seq.toList
602
602
603
+ member __.GetConditions (): string list =
604
+ let dependenciesFile = DependenciesFile.ReadFromFile dependenciesFileName
605
+ dependenciesFile.Groups
606
+ |> Seq.choose ( fun kv -> kv.Value.Options.Settings.ReferenceCondition)
607
+ |> Seq.distinct
608
+ |> Seq.toList
609
+
603
610
/// Returns the direct dependencies for the given package.
604
611
member this.GetDirectDependenciesForPackage ( groupName , packageName : string ): ( string * string * string ) list =
605
612
let resolvedPackages = this.GetLockFile() .GetGroupedResolution()
@@ -854,7 +861,7 @@ type Dependencies(dependenciesFileName: string) =
854
861
use fileStream = File.Open ( nuspecFile, FileMode.Create)
855
862
doc.Save fileStream
856
863
857
- static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list ) =
864
+ static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list , conditions : string list ) =
858
865
let attr ( name : string ) ( node : XmlNode ) =
859
866
match node.Attributes.[ name] with
860
867
| null -> None
@@ -880,8 +887,14 @@ type Dependencies(dependenciesFileName: string) =
880
887
|> List.map ( fun proj -> proj.NameWithoutExtension)
881
888
|> Set.ofList
882
889
let depsFile = deps.GetDependenciesFile()
890
+ let groupMatchesConditions groupName =
891
+ let group = depsFile.GetGroup( groupName)
892
+ match group.Options.Settings.ReferenceCondition with
893
+ | None -> true
894
+ | Some condition -> conditions |> List.contains condition
883
895
let allFrameworkRestrictions =
884
896
locked.GetPackageHull referencesFile
897
+ |> Seq.filter ( fun kvp -> fst kvp.Key |> groupMatchesConditions)
885
898
|> Seq.map( fun kvp -> snd kvp.Key, fst kvp.Key, kvp.Value.Settings.FrameworkRestrictions.GetExplicitRestriction())
886
899
887
900
@@ -898,6 +911,7 @@ type Dependencies(dependenciesFileName: string) =
898
911
899
912
let projectReferencedDeps =
900
913
referencesFile.Groups
914
+ |> Seq.filter ( fun ( KeyValue ( group , _ )) -> group |> groupMatchesConditions)
901
915
|> Seq.collect ( fun ( KeyValue ( group , packages )) -> packages.NugetPackages |> Seq.map ( fun p -> group, p))
902
916
903
917
let groupsForProjectReferencedDeps =
0 commit comments