From 4611793f3c6c7d15f8020da69b7bb20ce8a223c2 Mon Sep 17 00:00:00 2001 From: Peter MacNaughton Date: Tue, 7 Apr 2015 12:03:34 -0600 Subject: [PATCH] Prepare NuGet package creation Add Package build task to build script Add nuspec file Update readme and license Ignore package output directory --- .gitignore | 2 ++ ReleaseNotes.md | 2 +- Rothko.nuspec | 18 ++++++++++++++++++ Rothko.sln | 4 +++- script/build.fsx | 28 ++++++++++++++++++++++++++-- 5 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 Rothko.nuspec diff --git a/.gitignore b/.gitignore index df6decd..d2fc613 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 18c0463..b34e11e 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,3 +1,3 @@ ### New in 0.0.1 -* Initial release +* Initial alpha release diff --git a/Rothko.nuspec b/Rothko.nuspec new file mode 100644 index 0000000..c712ad2 --- /dev/null +++ b/Rothko.nuspec @@ -0,0 +1,18 @@ + + + + @project@ + @build.number@ + @authors@ + @authors@ + @summary@ + https://github.com/haacked/rothko/blob/master/LICENSE.txt + https://github.com/haacked/rothko + https://cloud.githubusercontent.com/assets/19977/4635932/4483417a-53de-11e4-8aad-7f06b2d3c46a.png + false + @description@ + @releaseNotes@ + Copyright Phil Haack 2015 + dotnet abstractions + + \ No newline at end of file diff --git a/Rothko.sln b/Rothko.sln index 8cfe41f..a89fed0 100644 --- a/Rothko.sln +++ b/Rothko.sln @@ -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 @@ -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 @@ -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 diff --git a/script/build.fsx b/script/build.fsx index b9a78e0..59f9fd5 100644 --- a/script/build.fsx +++ b/script/build.fsx @@ -11,6 +11,7 @@ let projectSummary = projectDescription // TODO: write a summary // directories let buildDir = "./src/bin" +let packagingDir = "./packaging/" let testResultsDir = "./testresults" RestorePackages() @@ -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] @@ -45,6 +46,28 @@ 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" @@ -52,5 +75,6 @@ Target "Default" DoNothing ==> "BuildApp" ==> "UnitTests" ==> "Default" + ==> "Package" RunTargetOrDefault "Default" \ No newline at end of file