Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command-line build and verify #233

Merged
merged 5 commits into from
Apr 20, 2014
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ obj/
src/packages/*
PackageBuild/*
Build/*
Release/*
src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.approve_public_api.received.txt
*.tss
src/TestResults/*
Expand Down
1 change: 1 addition & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@%WINDIR%\Microsoft.Net\Framework\v4.0.30319\msbuild build.proj /m /clp:Verbosity=minimal
23 changes: 23 additions & 0 deletions build.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<XUnitPath>tools\xunit</XUnitPath>
</PropertyGroup>
<PropertyGroup>
<ReleaseFolder>Release</ReleaseFolder>
</PropertyGroup>
<ItemGroup>
<BuildOutput Include="Src\Humanizer\bin\Release\Humanizer.dll" />
<BuildOutput Include="Src\Humanizer\bin\Release\Humanizer.XML" />
</ItemGroup>
<ItemGroup>
<ProjectToBuild Include="Src\*.sln" />
</ItemGroup>
<!-- Expand build output files AFTER the build has run.
Note that the Build Task MUST BE defined by the file that includes this file. -->
<Target Name="GetTestAssemblies" DependsOnTargets="Build">
<ItemGroup>
<TestAssemblies Include="**\bin\Release\*.Tests.dll" />
</ItemGroup>
</Target>
</Project>
42 changes: 42 additions & 0 deletions build.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build;CopyToReleaseFolder" ToolsVersion="4.0">
<!--Project configuration-->
<Import Project="Build.config" />

<UsingTask TaskName="xunit" AssemblyFile="$(XUnitPath)\xunit.runner.msbuild.dll" />

<!--Clean-->
<Target Name="CleanAll" DependsOnTargets="CleanDebug;CleanVerify;CleanRelease" />
<Target Name="CleanDebug">
<MSBuild Projects="@(ProjectToBuild)" Targets="Clean" Properties="Configuration=Debug" />
</Target>
<Target Name="CleanVerify">
<MSBuild Projects="@(ProjectToBuild)" Targets="Clean" Properties="Configuration=Verify" />
</Target>
<Target Name="CleanRelease">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to run Release too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do'h. Never mind.

<MSBuild Projects="@(ProjectToBuild)" Targets="Clean" Properties="Configuration=Release" />
</Target>

<!--Compile-->
<Target Name="Build" DependsOnTargets="CleanAll">
<MSBuild Projects="@(ProjectToBuild)" Properties="Configuration=Verify" />
<MSBuild Projects="@(ProjectToBuild)" Properties="Configuration=Release" />
</Target>

<!--Test. Note that the GetTestAssemblies Task MUST BE defined in the Build.config file. -->
<Target Name="Test" DependsOnTargets="GetTestAssemblies">
<xunit Assemblies="@(TestAssemblies)" />
</Target>

<!--Release-->
<Target Name="DeleteReleaseFolder">
<RemoveDir Directories="$(ReleaseFolder)" />
</Target>
<Target Name="MakeReleaseFolder" DependsOnTargets="DeleteReleaseFolder">
<MakeDir Directories="$(ReleaseFolder)" Condition="!Exists($(ReleaseFolder))" />
</Target>
<Target Name="CopyToReleaseFolder" DependsOnTargets="Test">
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(ReleaseFolder)" />
</Target>

</Project>
4 changes: 4 additions & 0 deletions src/Humanizer.Tests/AmbientCulture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Verify|AnyCPU'">
<OutputPath>bin\Verify\</OutputPath>
<CodeAnalysisRuleSet>..\Humanizer.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
<NoWarn>1591</NoWarn>
<DocumentationFile>bin\Verify\Humanizer.Tests.XML</DocumentationFile>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="ApprovalTests">
<HintPath>..\packages\ApprovalTests.3.0.5\lib\net40\ApprovalTests.dll</HintPath>
Expand Down
67 changes: 67 additions & 0 deletions src/Humanizer.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Humanizer" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. You should include this rule set in any custom rule set you create for your projects." ToolsVersion="12.0">
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1001" Action="Error" />
<Rule Id="CA1009" Action="Error" />
<Rule Id="CA1016" Action="Error" />
<Rule Id="CA1033" Action="Error" />
<Rule Id="CA1049" Action="Error" />
<Rule Id="CA1060" Action="Error" />
<Rule Id="CA1061" Action="Error" />
<Rule Id="CA1063" Action="Error" />
<Rule Id="CA1065" Action="Error" />
<Rule Id="CA1301" Action="Error" />
<Rule Id="CA1400" Action="Error" />
<Rule Id="CA1401" Action="Error" />
<Rule Id="CA1403" Action="Error" />
<Rule Id="CA1404" Action="Error" />
<Rule Id="CA1405" Action="Error" />
<Rule Id="CA1410" Action="Error" />
<Rule Id="CA1415" Action="Error" />
<Rule Id="CA1821" Action="Error" />
<Rule Id="CA1900" Action="Error" />
<Rule Id="CA1901" Action="Error" />
<Rule Id="CA2002" Action="Error" />
<Rule Id="CA2100" Action="Error" />
<Rule Id="CA2101" Action="Error" />
<Rule Id="CA2108" Action="Error" />
<Rule Id="CA2111" Action="Error" />
<Rule Id="CA2112" Action="Error" />
<Rule Id="CA2114" Action="Error" />
<Rule Id="CA2116" Action="Error" />
<Rule Id="CA2117" Action="Error" />
<Rule Id="CA2122" Action="Error" />
<Rule Id="CA2123" Action="Error" />
<Rule Id="CA2124" Action="Error" />
<Rule Id="CA2126" Action="Error" />
<Rule Id="CA2131" Action="Error" />
<Rule Id="CA2132" Action="Error" />
<Rule Id="CA2133" Action="Error" />
<Rule Id="CA2134" Action="Error" />
<Rule Id="CA2137" Action="Error" />
<Rule Id="CA2138" Action="Error" />
<Rule Id="CA2140" Action="Error" />
<Rule Id="CA2141" Action="Error" />
<Rule Id="CA2146" Action="Error" />
<Rule Id="CA2147" Action="Error" />
<Rule Id="CA2149" Action="Error" />
<Rule Id="CA2200" Action="Error" />
<Rule Id="CA2202" Action="Error" />
<Rule Id="CA2207" Action="Error" />
<Rule Id="CA2212" Action="Error" />
<Rule Id="CA2213" Action="Error" />
<Rule Id="CA2214" Action="Error" />
<Rule Id="CA2216" Action="Error" />
<Rule Id="CA2220" Action="Error" />
<Rule Id="CA2229" Action="Error" />
<Rule Id="CA2231" Action="Error" />
<Rule Id="CA2232" Action="Error" />
<Rule Id="CA2235" Action="Error" />
<Rule Id="CA2236" Action="Error" />
<Rule Id="CA2237" Action="Error" />
<Rule Id="CA2238" Action="Error" />
<Rule Id="CA2240" Action="Error" />
<Rule Id="CA2241" Action="Error" />
<Rule Id="CA2242" Action="Error" />
</Rules>
</RuleSet>
15 changes: 15 additions & 0 deletions src/Humanizer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,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
12 changes: 12 additions & 0 deletions src/Humanizer/Humanizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
<PropertyGroup>
<AssemblyOriginatorKeyFile>Humanizer.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Verify|AnyCPU'">
<OutputPath>bin\Verify\</OutputPath>
<Optimize>false</Optimize>
<DocumentationFile>bin\Verify\Humanizer.XML</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>..\Humanizer.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
<NoWarn>
</NoWarn>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Compile Include="Localisation\NumberToWords\BrazilianPortugueseNumberToWordsConverter.cs" />
<Compile Include="GrammaticalCase.cs" />
Expand Down