Skip to content

Commit

Permalink
Added frameworkAssemblies to nuspec templating
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Mar 31, 2015
1 parent 1db0c6c commit e23df9d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/app/FakeLib/NuGet/NugetHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ type NugetFrameworkReferences =
{ FrameworkVersion : string
References : NugetReferences }

type NugetFrameworkAssemblyReferences =
{ FrameworkVersion : string
AssemblyName : string }

type NugetSymbolPackage =
/// Do not build symbol packages
| None = 0
Expand Down Expand Up @@ -51,6 +55,7 @@ type NuGetParams =
DependenciesByFramework : NugetFrameworkDependencies list
References : NugetReferences
ReferencesByFramework : NugetFrameworkReferences list
FrameworkAssemblies : NugetFrameworkAssemblyReferences list
IncludeReferencedProjects : bool
PublishTrials : int
Publish : bool
Expand Down Expand Up @@ -78,6 +83,7 @@ let NuGetDefaults() =
DependenciesByFramework = []
References = []
ReferencesByFramework = []
FrameworkAssemblies = []
IncludeReferencedProjects = false
OutputPath = "./NuGet"
WorkingDir = "./NuGet"
Expand Down Expand Up @@ -153,9 +159,18 @@ let private createNuSpecFromTemplate parameters (templateNuSpec:FileInfo) =
parameters.ReferencesByFramework
|> Seq.map (fun x -> (x.FrameworkVersion, getReferencesTags x.References))
|> getFrameworkGroup

let referencesXml = sprintf "<references>%s</references>" (references + referencesByFramework)

let getFrameworkAssemblyTags references =
references
|> Seq.map (fun x -> sprintf "<frameworkAssembly assemblyName=\"%s\" targetFramework=\"%s\" />" x.AssemblyName x.FrameworkVersion)
|> toLines

let frameworkAssembliesXml =
if parameters.FrameworkAssemblies = [] then ""
else sprintf "<frameworkAssemblies>%s</frameworkAssemblies>" (parameters.FrameworkAssemblies |> getFrameworkAssemblyTags)

let getDependenciesTags dependencies =
dependencies
|> Seq.map (fun (package, version) -> sprintf "<dependency id=\"%s\" version=\"%s\" />" package version)
Expand Down Expand Up @@ -207,6 +222,7 @@ let private createNuSpecFromTemplate parameters (templateNuSpec:FileInfo) =
|> List.map (fun (placeholder, replacement) -> placeholder, xmlEncode replacement)
|> List.append [ "@dependencies@", dependenciesXml
"@references@", referencesXml
"@frameworkAssemblies@", frameworkAssembliesXml
"@files@", filesXml ]

processTemplates replacements [ specFile ]
Expand Down
3 changes: 3 additions & 0 deletions src/test/Test.FAKECore/PackageMgt/NugetSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class when_packing_with_nuspec_template
publishUrl: p.PublishUrl,
references: p.References,
referencesByFramework: p.ReferencesByFramework,
frameworkAssemblies: p.FrameworkAssemblies,
releaseNotes: p.ReleaseNotes,
symbolPackage: p.SymbolPackage,
tags: p.Tags,
Expand Down Expand Up @@ -101,6 +102,7 @@ public class when_packing_with_csproj_and_complete_nuspec_alongside
publishUrl: p.PublishUrl,
references: p.References,
referencesByFramework: p.ReferencesByFramework,
frameworkAssemblies: p.FrameworkAssemblies,
releaseNotes: p.ReleaseNotes,
symbolPackage: p.SymbolPackage,
tags: p.Tags,
Expand Down Expand Up @@ -167,6 +169,7 @@ public class when_packing_with_a_complete_nuspec_file
publishUrl: p.PublishUrl,
references: p.References,
referencesByFramework: p.ReferencesByFramework,
frameworkAssemblies: p.FrameworkAssemblies,
releaseNotes: p.ReleaseNotes,
symbolPackage: p.SymbolPackage,
tags: p.Tags,
Expand Down

0 comments on commit e23df9d

Please sign in to comment.