Skip to content

Commit

Permalink
Remove old framework references - fixes #274
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 21, 2014
1 parent fafb2ae commit 64f8d3e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.9.0-alpha004 - 21.10.2014
* Remove old framework references - https://github.com/fsprojects/Paket/issues/274

#### 0.9.0-alpha003 - 21.10.2014
* Use more profiles - https://github.com/fsprojects/Paket/issues/281

Expand Down
19 changes: 16 additions & 3 deletions src/Paket.Core/InstallModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ type Reference =
Some(fi.Name.Replace(fi.Extension, ""))
| _ -> None

member this.FrameworkReferenceName =
match this with
| FrameworkAssemblyReference name -> Some name
| _ -> None

member this.ReferenceName =
match this with
| FrameworkAssemblyReference name -> name
| Reference.Library lib ->
let fi = new FileInfo(normalizePath lib)
fi.Name.Replace(fi.Extension, "")


type InstallFiles =
{ References : Reference Set
ContentFiles : string Set }
Expand Down Expand Up @@ -252,14 +265,14 @@ type InstallModel =
.UseLastGroupFallBackAsDefaultFallBack()

member this.BuildModel() = this.BuildUnfilteredModel().DeleteIfGroupFallback()
member this.GetLibraryNames =

member this.GetReferenceNames =
lazy ([ for g in this.Groups do
for f in g.Value.Frameworks do
yield! f.Value.References
yield! g.Value.Fallbacks.References
yield! this.DefaultFallback.References]
|> List.choose (fun lib -> lib.LibName)
|> List.map (fun lib -> lib.ReferenceName)
|> Set.ofList)

static member CreateFromLibs(packageName, packageVersion, libs, nuspec : Nuspec) =
Expand Down
5 changes: 3 additions & 2 deletions src/Paket.Core/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ type ProjectFile =
this.DeleteIfEmpty("//ns:ItemGroup")

member this.HasCustomNodes(model:InstallModel) =
let libs = model.GetLibraryNames.Force()
let libs = model.GetReferenceNames.Force()

let hasCustom = ref false
for node in this.Document.SelectNodes("//ns:Reference", this.Namespaces) do
if Set.contains (node.Attributes.["Include"].InnerText.Split(',').[0]) libs then
Expand All @@ -142,7 +143,7 @@ type ProjectFile =
member this.DeleteCustomNodes(model:InstallModel) =
let nodesToDelete = List<_>()

let libs = model.GetLibraryNames.Force()
let libs = model.GetReferenceNames.Force()
for node in this.Document.SelectNodes("//ns:Reference", this.Namespaces) do
if Set.contains (node.Attributes.["Include"].InnerText.Split(',').[0]) libs then
nodesToDelete.Add node
Expand Down

0 comments on commit 64f8d3e

Please sign in to comment.