From 317244d14699c54480cc9dca60b9b40e39922427 Mon Sep 17 00:00:00 2001 From: Adam Chester Date: Sat, 19 Apr 2014 10:39:13 +0930 Subject: [PATCH 1/5] New command-line build and verify, by using `build.cmd` from a VS command line, in the root project folder, the following happens (by default): - the solution is built in Release and Verify configurations - in the new Verify configuration, code analysis, and msbuild 'treat warnings as errors' are enabled. CA ruleset is based on the 'Microsoft Managed Recommended Rules' from VS 2013. All enabled rules are set to error on violations. - Xunit tests are executed, reporting any errors This is based on the Albedo project (https://github.com/ploeh/Albedo). I removed the nuget and versioning-related tasks. They could be added back if needed. --- .gitignore | 1 + Build.config | 23 ++++++++ build.cmd | 1 + build.proj | 42 ++++++++++++++ src/Humanizer.Tests/AmbientCulture.cs | 4 ++ src/Humanizer.Tests/Humanizer.Tests.csproj | 10 ++++ src/Humanizer.ruleset | 67 ++++++++++++++++++++++ src/Humanizer.sln | 19 +++++- src/Humanizer/Humanizer.csproj | 12 ++++ 9 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 Build.config create mode 100644 build.cmd create mode 100644 build.proj create mode 100644 src/Humanizer.ruleset diff --git a/.gitignore b/.gitignore index 6d38a7388..f734e51d8 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ obj/ src/packages/* PackageBuild/* Build/* +Release/* src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.approve_public_api.received.txt *.tss src/TestResults/* diff --git a/Build.config b/Build.config new file mode 100644 index 000000000..680228da3 --- /dev/null +++ b/Build.config @@ -0,0 +1,23 @@ + + + + tools\xunit + + + Release + + + + + + + + + + + + + + + diff --git a/build.cmd b/build.cmd new file mode 100644 index 000000000..a2fb7b087 --- /dev/null +++ b/build.cmd @@ -0,0 +1 @@ +@msbuild build.proj /m /clp:Verbosity=minimal \ No newline at end of file diff --git a/build.proj b/build.proj new file mode 100644 index 000000000..50d2dfde8 --- /dev/null +++ b/build.proj @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Humanizer.Tests/AmbientCulture.cs b/src/Humanizer.Tests/AmbientCulture.cs index d8515f329..bbd7e0584 100644 --- a/src/Humanizer.Tests/AmbientCulture.cs +++ b/src/Humanizer.Tests/AmbientCulture.cs @@ -4,6 +4,8 @@ namespace Humanizer.Tests { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", + Justification = "This is a test only class, and doesn't need a 'proper' IDisposable implementation.")] public class AmbientCulture : IDisposable { private readonly CultureInfo _culture; @@ -20,6 +22,8 @@ public AmbientCulture(string cultureName) { } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", + Justification="This is a test only class, and doesn't need a 'proper' IDisposable implementation.")] public void Dispose() { Thread.CurrentThread.CurrentUICulture = _culture; diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index e152f0e11..5f9bac33d 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -49,6 +49,16 @@ true false + + bin\Verify\ + ..\Humanizer.ruleset + true + + + bin\Verify\Humanizer.Tests.XML + pdbonly + true + ..\packages\ApprovalTests.3.0.5\lib\net40\ApprovalTests.dll diff --git a/src/Humanizer.ruleset b/src/Humanizer.ruleset new file mode 100644 index 000000000..3af068ece --- /dev/null +++ b/src/Humanizer.ruleset @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Humanizer.sln b/src/Humanizer.sln index 3428859ae..5f58a7f0c 100644 --- a/src/Humanizer.sln +++ b/src/Humanizer.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30324.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Humanizer.Tests", "Humanizer.Tests\Humanizer.Tests.csproj", "{F886A8DA-3EFC-4A89-91DD-06FAF13DA172}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Humanizer", "Humanizer\Humanizer.csproj", "{511A7984-F455-4A6E-ADB9-9CAAC47EA079}" @@ -16,22 +18,37 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\release_notes.md = ..\release_notes.md EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{97AAE24D-0488-42AE-A585-86D882F23D5F}" + ProjectSection(SolutionItems) = preProject + ..\build.cmd = ..\build.cmd + ..\Build.config = ..\Build.config + ..\build.proj = ..\build.proj + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Verify|Any CPU = Verify|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F886A8DA-3EFC-4A89-91DD-06FAF13DA172}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F886A8DA-3EFC-4A89-91DD-06FAF13DA172}.Debug|Any CPU.Build.0 = Debug|Any CPU {F886A8DA-3EFC-4A89-91DD-06FAF13DA172}.Release|Any CPU.ActiveCfg = Release|Any CPU {F886A8DA-3EFC-4A89-91DD-06FAF13DA172}.Release|Any CPU.Build.0 = Release|Any CPU + {F886A8DA-3EFC-4A89-91DD-06FAF13DA172}.Verify|Any CPU.ActiveCfg = Verify|Any CPU + {F886A8DA-3EFC-4A89-91DD-06FAF13DA172}.Verify|Any CPU.Build.0 = Verify|Any CPU {511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Debug|Any CPU.Build.0 = Debug|Any CPU {511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Release|Any CPU.ActiveCfg = Release|Any CPU {511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Release|Any CPU.Build.0 = Release|Any CPU + {511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Verify|Any CPU.ActiveCfg = Verify|Any CPU + {511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Verify|Any CPU.Build.0 = Verify|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {97AAE24D-0488-42AE-A585-86D882F23D5F} = {4779A7C9-9ED8-4146-A158-FBE0B1BE09D9} + EndGlobalSection EndGlobal diff --git a/src/Humanizer/Humanizer.csproj b/src/Humanizer/Humanizer.csproj index 9cea5a4c0..d4118dc75 100644 --- a/src/Humanizer/Humanizer.csproj +++ b/src/Humanizer/Humanizer.csproj @@ -46,6 +46,18 @@ Humanizer.snk + + bin\Verify\ + false + bin\Verify\Humanizer.XML + true + ..\Humanizer.ruleset + true + + + pdbonly + true + From 4278a1868b6e165cfaf8ce46a7c86e8b87a6bab8 Mon Sep 17 00:00:00 2001 From: Adam Chester Date: Sun, 20 Apr 2014 10:35:49 +0930 Subject: [PATCH 2/5] fix casing of build.config file --- Build.config => build.config | 0 src/Humanizer.sln | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename Build.config => build.config (100%) diff --git a/Build.config b/build.config similarity index 100% rename from Build.config rename to build.config diff --git a/src/Humanizer.sln b/src/Humanizer.sln index 5f58a7f0c..fd7cd7e25 100644 --- a/src/Humanizer.sln +++ b/src/Humanizer.sln @@ -21,7 +21,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{97AAE24D-0488-42AE-A585-86D882F23D5F}" ProjectSection(SolutionItems) = preProject ..\build.cmd = ..\build.cmd - ..\Build.config = ..\Build.config + ..\build.config = ..\build.config ..\build.proj = ..\build.proj EndProjectSection EndProject From f2c46a540b7ab267b3908f923ec6558b83777933 Mon Sep 17 00:00:00 2001 From: Adam Chester Date: Sun, 20 Apr 2014 10:36:58 +0930 Subject: [PATCH 3/5] tests project: nowarn:CS1591 +warnAsError --- src/Humanizer.Tests/Humanizer.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index 5f9bac33d..b42fbc802 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -53,11 +53,11 @@ bin\Verify\ ..\Humanizer.ruleset true - - + 1591 bin\Verify\Humanizer.Tests.XML pdbonly true + true From 306150c8b1f241e835677bc83161c21bd92b17a8 Mon Sep 17 00:00:00 2001 From: Adam Chester Date: Sun, 20 Apr 2014 10:42:52 +0930 Subject: [PATCH 4/5] make build.cmd 'autonomous' (not reliant on the %PATH% to msbuild) --- build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cmd b/build.cmd index a2fb7b087..e5f3378f8 100644 --- a/build.cmd +++ b/build.cmd @@ -1 +1 @@ -@msbuild build.proj /m /clp:Verbosity=minimal \ No newline at end of file +@%WINDIR%\Microsoft.Net\Framework\v4.0.30319\msbuild build.proj /m /clp:Verbosity=minimal From b3ab7a8d903455c1144cc36dd5446f920b90497a Mon Sep 17 00:00:00 2001 From: Adam Chester Date: Sun, 20 Apr 2014 10:43:17 +0930 Subject: [PATCH 5/5] reverse the solution file format changes --- src/Humanizer.sln | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Humanizer.sln b/src/Humanizer.sln index fd7cd7e25..e5d98557f 100644 --- a/src/Humanizer.sln +++ b/src/Humanizer.sln @@ -1,8 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30324.0 -MinimumVisualStudioVersion = 10.0.40219.1 +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Humanizer.Tests", "Humanizer.Tests\Humanizer.Tests.csproj", "{F886A8DA-3EFC-4A89-91DD-06FAF13DA172}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Humanizer", "Humanizer\Humanizer.csproj", "{511A7984-F455-4A6E-ADB9-9CAAC47EA079}"