Skip to content

Commit

Permalink
Prepare NuGet package creation
Browse files Browse the repository at this point in the history
Add Package build task to build script
Add nuspec file
Update readme and license
Ignore package output directory
  • Loading branch information
Peter MacNaughton committed Apr 17, 2015
1 parent 092afba commit 4611793
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ local.properties

## TODO: If you have NuGet Package Restore enabled, uncomment this
packages/
# output folder for building NuGet packages
packaging/

# Visual C++ cache files
ipch/
Expand Down
2 changes: 1 addition & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### New in 0.0.1

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

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rothko", "src\Rothko.csproj", "{4A84E568-CA86-4510-8CD0-90D3EF9B65F9}"
EndProject
Expand All @@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{1F038D9F-9
CodeAnalysisDictionary.xml = CodeAnalysisDictionary.xml
LICENSE-MIT.txt = LICENSE-MIT.txt
README.md = README.md
ReleaseNotes.md = ReleaseNotes.md
Rothko.ruleset = Rothko.ruleset
EndProjectSection
EndProject
Expand All @@ -19,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2DC1E33B
ProjectSection(SolutionItems) = preProject
script\build.cmd = script\build.cmd
script\build.fsx = script\build.fsx
Rothko.nuspec = Rothko.nuspec
EndProjectSection
EndProject
Global
Expand Down
28 changes: 26 additions & 2 deletions script/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let projectSummary = projectDescription // TODO: write a summary

// directories
let buildDir = "./src/bin"
let packagingDir = "./packaging/"
let testResultsDir = "./testresults"

RestorePackages()
Expand All @@ -20,13 +21,13 @@ let releaseNotes =
|> ReleaseNotesHelper.parseReleaseNotes

Target "Clean" (fun _ ->
CleanDirs [buildDir; testResultsDir]
CleanDirs [buildDir; packagingDir; testResultsDir]
)

open Fake.AssemblyInfoFile

Target "AssemblyInfo" (fun _ ->
CreateCSharpAssemblyInfo ".\SolutionInfo.cs"
CreateCSharpAssemblyInfo "./SolutionInfo.cs"
[ Attribute.Product projectName
Attribute.Version releaseNotes.AssemblyVersion
Attribute.FileVersion releaseNotes.AssemblyVersion]
Expand All @@ -45,12 +46,35 @@ Target "UnitTests" (fun _ ->
OutputDir = testResultsDir })
)

Target "Package" (fun _ ->
let net45Dir = packagingDir @@ "lib/net45/"
CleanDirs [net45Dir]

CopyFile net45Dir (buildDir @@ "Release/rothko.dll")
CopyFiles packagingDir ["LICENSE-MIT.txt"; "README.md"; "ReleaseNotes.md"]

NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Description = projectDescription
OutputPath = packagingDir
Summary = projectSummary
WorkingDir = packagingDir
Version = releaseNotes.AssemblyVersion
ReleaseNotes = toLines releaseNotes.Notes
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" }) "Rothko.nuspec"
)


Target "Default" DoNothing

"Clean"
==> "AssemblyInfo"
==> "BuildApp"
==> "UnitTests"
==> "Default"
==> "Package"

RunTargetOrDefault "Default"

0 comments on commit 4611793

Please sign in to comment.