Skip to content
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
5 changes: 3 additions & 2 deletions docs/content/template-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ A `paket.template` file using `type project` may look like this:

```text
type project
licenseUrl http://opensource.org/licenses/MIT
licenseExpression MIT
```

This template file will be used to create a `.nupkg`
Expand Down Expand Up @@ -113,7 +113,8 @@ field of the same name in the `.nupkg`.
* `language`
* `projectUrl`
* `iconUrl`
* `licenseUrl`
* `licenseExpression`: More info on what you can specify: <https://docs.microsoft.com/de-de/nuget/reference/nuspec#license>
* `licenseUrl` (deprecated by NuGet)
* `repositoryType`
* `repositoryUrl`
* `copyright`
Expand Down
7 changes: 7 additions & 0 deletions src/Paket.Core/Packaging/NupkgWriter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ module internal NupkgWriter =
(!!?) "title" optional.Title
!! "authors" (core.Authors |> String.concat ", ")
if optional.Owners <> [] then !! "owners" (String.Join(", ",optional.Owners))
match optional.LicenseExpression with
| Some licenseExpression ->
let el = XElement(ns + "license")
el.SetAttributeValue(XName.Get "type", "expression")
el.SetValue(licenseExpression)
metadataNode.Add el
| _ -> ()
(!!?) "licenseUrl" optional.LicenseUrl
match optional.RepositoryType, optional.RepositoryUrl with
| Some t, Some url ->
Expand Down
1 change: 1 addition & 0 deletions src/Paket.Core/PaketConfigFiles/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2090,6 +2090,7 @@ type ProjectFile with
Language = prop "Langauge"
ProjectUrl = prop "ProjectUrl"
IconUrl = prop "IconUrl"
LicenseExpression = prop "LicenseExpression"
LicenseUrl = prop "LicenseUrl"
Copyright = prop "Copyright"
RepositoryType = prop "RepositoryType"
Expand Down
3 changes: 3 additions & 0 deletions src/Paket.Core/PaketConfigFiles/TemplateFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ type OptionalPackagingInfo =
Language : string option
ProjectUrl : string option
IconUrl : string option
LicenseExpression : string option
LicenseUrl : string option
RepositoryUrl : string option
RepositoryType : string option
Expand Down Expand Up @@ -172,6 +173,7 @@ type OptionalPackagingInfo =
Summary = None
Language = None
ProjectUrl = None
LicenseExpression = None
LicenseUrl = None
RepositoryUrl = None
RepositoryType = None
Expand Down Expand Up @@ -537,6 +539,7 @@ module internal TemplateFile =
IconUrl = get "iconUrl"
RepositoryType = get "repositoryType"
RepositoryUrl = get "repositoryUrl"
LicenseExpression = get "licenseExpression"
LicenseUrl = get "licenseUrl"
Copyright = get "copyright"
RequireLicenseAcceptance = requireLicenseAcceptance
Expand Down
4 changes: 2 additions & 2 deletions tests/Paket.Tests/Packaging/NuspecWriterSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ let ``should not serialize all properties``() =
<title>A title</title>
<authors>Michael, Steffen</authors>
<owners>Steffen, Alex</owners>
<licenseUrl>http://www.somewhere.com/license.html</licenseUrl>
<license type="expression">MIT</license>
<projectUrl>http://www.somewhere.com</projectUrl>
<iconUrl>http://www.somewhere.com/Icon</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
Expand Down Expand Up @@ -397,7 +397,7 @@ second line</releaseNotes>
Summary = Some "summary"
Language = Some "en-US"
ProjectUrl = Some "http://www.somewhere.com"
LicenseUrl = Some "http://www.somewhere.com/license.html"
LicenseExpression = Some "MIT"
IconUrl = Some "http://www.somewhere.com/Icon"
Copyright = Some "Paket owners 2015"
RequireLicenseAcceptance = true
Expand Down
6 changes: 3 additions & 3 deletions tests/Paket.Tests/Packaging/TemplateFileParsing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ projectUrl
https://github.com/fsprojects/Chessie
iconUrl
https://raw.githubusercontent.com/fsprojects/Chessie/master/docs/files/img/logo.png
licenseUrl
https://github.com/fsprojects/Chessie/blob/master/LICENSE.txt
licenseExpression
Unlicense
requireLicenseAcceptance
false
copyright
Expand Down Expand Up @@ -199,7 +199,7 @@ let ``Optional fields are read`` (fileContent : string) =
sut.Copyright |> shouldEqual (Some "Copyright 2015")
sut.Summary |> shouldEqual (Some "Railway-oriented programming for .NET")
sut.IconUrl |> shouldEqual (Some "https://raw.githubusercontent.com/fsprojects/Chessie/master/docs/files/img/logo.png")
sut.LicenseUrl |> shouldEqual (Some "https://github.com/fsprojects/Chessie/blob/master/LICENSE.txt")
sut.LicenseExpression |> shouldEqual (Some "Unlicense")
sut.ProjectUrl |> shouldEqual (Some "https://github.com/fsprojects/Chessie")
sut.Tags |> shouldEqual ["rop";"fsharp";"F#"]
sut.Owners |> shouldEqual ["Steffen Forkmann";"Max Malook";"Tomasz Heimowski"]
Expand Down