@@ -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()
@@ -855,6 +862,9 @@ type Dependencies(dependenciesFileName: string) =
855
862
doc.Save fileStream
856
863
857
864
static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list ) =
865
+ Dependencies.FixNuspecs ( projectFile, referencesFile, nuspecFileList, [])
866
+
867
+ static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list , conditions : string list ) =
858
868
let attr ( name : string ) ( node : XmlNode ) =
859
869
match node.Attributes.[ name] with
860
870
| null -> None
@@ -880,8 +890,14 @@ type Dependencies(dependenciesFileName: string) =
880
890
|> List.map ( fun proj -> proj.NameWithoutExtension)
881
891
|> Set.ofList
882
892
let depsFile = deps.GetDependenciesFile()
893
+ let groupMatchesConditions groupName =
894
+ let group = depsFile.GetGroup( groupName)
895
+ match group.Options.Settings.ReferenceCondition with
896
+ | None -> true
897
+ | Some condition -> conditions |> List.contains condition
883
898
let allFrameworkRestrictions =
884
899
locked.GetPackageHull referencesFile
900
+ |> Seq.filter ( fun kvp -> fst kvp.Key |> groupMatchesConditions)
885
901
|> Seq.map( fun kvp -> snd kvp.Key, fst kvp.Key, kvp.Value.Settings.FrameworkRestrictions.GetExplicitRestriction())
886
902
887
903
@@ -898,6 +914,7 @@ type Dependencies(dependenciesFileName: string) =
898
914
899
915
let projectReferencedDeps =
900
916
referencesFile.Groups
917
+ |> Seq.filter ( fun ( KeyValue ( group , _ )) -> group |> groupMatchesConditions)
901
918
|> Seq.collect ( fun ( KeyValue ( group , packages )) -> packages.NugetPackages |> Seq.map ( fun p -> group, p))
902
919
903
920
let groupsForProjectReferencedDeps =
0 commit comments