Skip to content

Commit 5f0e975

Browse files
committed
Merge pull request #33 from pmacn/feature/nuget-package
Prepare NuGet package creation
2 parents 092afba + 4611793 commit 5f0e975

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ local.properties
6565

6666
## TODO: If you have NuGet Package Restore enabled, uncomment this
6767
packages/
68+
# output folder for building NuGet packages
69+
packaging/
6870

6971
# Visual C++ cache files
7072
ipch/

ReleaseNotes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
### New in 0.0.1
22

3-
* Initial release
3+
* Initial alpha release

Rothko.nuspec

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3+
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
4+
<id>@project@</id>
5+
<version>@build.number@</version>
6+
<authors>@authors@</authors>
7+
<owners>@authors@</owners>
8+
<summary>@summary@</summary>
9+
<licenseUrl>https://github.com/haacked/rothko/blob/master/LICENSE.txt</licenseUrl>
10+
<projectUrl>https://github.com/haacked/rothko</projectUrl>
11+
<iconUrl>https://cloud.githubusercontent.com/assets/19977/4635932/4483417a-53de-11e4-8aad-7f06b2d3c46a.png</iconUrl>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13+
<description>@description@</description>
14+
<releaseNotes>@releaseNotes@</releaseNotes>
15+
<copyright>Copyright Phil Haack 2015</copyright>
16+
<tags>dotnet abstractions</tags>
17+
</metadata>
18+
</package>

Rothko.sln

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.21005.1
4+
VisualStudioVersion = 12.0.30723.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rothko", "src\Rothko.csproj", "{4A84E568-CA86-4510-8CD0-90D3EF9B65F9}"
77
EndProject
@@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{1F038D9F-9
1010
CodeAnalysisDictionary.xml = CodeAnalysisDictionary.xml
1111
LICENSE-MIT.txt = LICENSE-MIT.txt
1212
README.md = README.md
13+
ReleaseNotes.md = ReleaseNotes.md
1314
Rothko.ruleset = Rothko.ruleset
1415
EndProjectSection
1516
EndProject
@@ -19,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2DC1E33B
1920
ProjectSection(SolutionItems) = preProject
2021
script\build.cmd = script\build.cmd
2122
script\build.fsx = script\build.fsx
23+
Rothko.nuspec = Rothko.nuspec
2224
EndProjectSection
2325
EndProject
2426
Global

script/build.fsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ let projectSummary = projectDescription // TODO: write a summary
1111

1212
// directories
1313
let buildDir = "./src/bin"
14+
let packagingDir = "./packaging/"
1415
let testResultsDir = "./testresults"
1516

1617
RestorePackages()
@@ -20,13 +21,13 @@ let releaseNotes =
2021
|> ReleaseNotesHelper.parseReleaseNotes
2122

2223
Target "Clean" (fun _ ->
23-
CleanDirs [buildDir; testResultsDir]
24+
CleanDirs [buildDir; packagingDir; testResultsDir]
2425
)
2526

2627
open Fake.AssemblyInfoFile
2728

2829
Target "AssemblyInfo" (fun _ ->
29-
CreateCSharpAssemblyInfo ".\SolutionInfo.cs"
30+
CreateCSharpAssemblyInfo "./SolutionInfo.cs"
3031
[ Attribute.Product projectName
3132
Attribute.Version releaseNotes.AssemblyVersion
3233
Attribute.FileVersion releaseNotes.AssemblyVersion]
@@ -45,12 +46,35 @@ Target "UnitTests" (fun _ ->
4546
OutputDir = testResultsDir })
4647
)
4748

49+
Target "Package" (fun _ ->
50+
let net45Dir = packagingDir @@ "lib/net45/"
51+
CleanDirs [net45Dir]
52+
53+
CopyFile net45Dir (buildDir @@ "Release/rothko.dll")
54+
CopyFiles packagingDir ["LICENSE-MIT.txt"; "README.md"; "ReleaseNotes.md"]
55+
56+
NuGet (fun p ->
57+
{p with
58+
Authors = authors
59+
Project = projectName
60+
Description = projectDescription
61+
OutputPath = packagingDir
62+
Summary = projectSummary
63+
WorkingDir = packagingDir
64+
Version = releaseNotes.AssemblyVersion
65+
ReleaseNotes = toLines releaseNotes.Notes
66+
AccessKey = getBuildParamOrDefault "nugetkey" ""
67+
Publish = hasBuildParam "nugetkey" }) "Rothko.nuspec"
68+
)
69+
70+
4871
Target "Default" DoNothing
4972

5073
"Clean"
5174
==> "AssemblyInfo"
5275
==> "BuildApp"
5376
==> "UnitTests"
5477
==> "Default"
78+
==> "Package"
5579

5680
RunTargetOrDefault "Default"

0 commit comments

Comments
 (0)