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

Added frameworkAssemblies to nuspec templating #721

Merged
merged 1 commit into from
Mar 31, 2015
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
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 =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I could've reused the existing NugetFrameworkReferences type and grouped framework assembly references on FrameworkVersion instead. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok to have both types. We also separate these in paket.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make the FrameworkVersion a string list

{ 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