From e23df9d0e2e0ef147415ff59bbddb850404187ad Mon Sep 17 00:00:00 2001 From: Kristian Hellang Date: Tue, 31 Mar 2015 15:21:16 +0200 Subject: [PATCH] Added frameworkAssemblies to nuspec templating --- src/app/FakeLib/NuGet/NugetHelper.fs | 18 +++++++++++++++++- .../Test.FAKECore/PackageMgt/NugetSpecs.cs | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/app/FakeLib/NuGet/NugetHelper.fs b/src/app/FakeLib/NuGet/NugetHelper.fs index 98b031240ca..88b9be7e5bb 100644 --- a/src/app/FakeLib/NuGet/NugetHelper.fs +++ b/src/app/FakeLib/NuGet/NugetHelper.fs @@ -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 @@ -51,6 +55,7 @@ type NuGetParams = DependenciesByFramework : NugetFrameworkDependencies list References : NugetReferences ReferencesByFramework : NugetFrameworkReferences list + FrameworkAssemblies : NugetFrameworkAssemblyReferences list IncludeReferencedProjects : bool PublishTrials : int Publish : bool @@ -78,6 +83,7 @@ let NuGetDefaults() = DependenciesByFramework = [] References = [] ReferencesByFramework = [] + FrameworkAssemblies = [] IncludeReferencedProjects = false OutputPath = "./NuGet" WorkingDir = "./NuGet" @@ -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 "%s" (references + referencesByFramework) + let getFrameworkAssemblyTags references = + references + |> Seq.map (fun x -> sprintf "" x.AssemblyName x.FrameworkVersion) + |> toLines + + let frameworkAssembliesXml = + if parameters.FrameworkAssemblies = [] then "" + else sprintf "%s" (parameters.FrameworkAssemblies |> getFrameworkAssemblyTags) + let getDependenciesTags dependencies = dependencies |> Seq.map (fun (package, version) -> sprintf "" package version) @@ -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 ] diff --git a/src/test/Test.FAKECore/PackageMgt/NugetSpecs.cs b/src/test/Test.FAKECore/PackageMgt/NugetSpecs.cs index fa89fc11e68..67dd9fa2d9c 100644 --- a/src/test/Test.FAKECore/PackageMgt/NugetSpecs.cs +++ b/src/test/Test.FAKECore/PackageMgt/NugetSpecs.cs @@ -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, @@ -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, @@ -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,