<commit_before>﻿<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
    <MSBuildCommunityTasksPath>$(SolutionDir)build</MSBuildCommunityTasksPath>
  </PropertyGroup>

  <Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.targets"/>

  <PropertyGroup>
    <CommonAssemblyInfoFile>$(SolutionDir)src\CommonAssemblyInfo.cs</CommonAssemblyInfoFile>
  </PropertyGroup>

  <PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
    <MonoExe>mono --runtime=v4.0.30319</MonoExe>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)' == ''">
    <Configuration>Release</Configuration>
  </PropertyGroup>

  <PropertyGroup>
    <VersionString Condition="'$(Configuration)' == 'Release'">unknown</VersionString>
    <VersionString Condition="'$(Configuration)' != 'Release'">v0.0.0</VersionString>
    <GitCommitHash>unknown</GitCommitHash>
    <MasterBranchName>master-test-147</MasterBranchName>
    <DevelopBranchName>jira/lrb/clients-147</DevelopBranchName>
  </PropertyGroup>

  <Target Name="CleanCommonAssemblyInfo">
    <Delete Files="$(CommonAssemblyInfoFile)" />
  </Target>

  <Target Name="PopulateVersionInformation">

    <GitDescribe LocalPath="$(SolutionDir)" Condition="'$(VersionString)' == 'unknown'">
      <Output TaskParameter="CommitHash" PropertyName="GitCommitHash" />
      <Output TaskParameter="Tag" PropertyName="VersionString" />
    </GitDescribe>

    <Message Text="Parsing VersionString: $(VersionString)" />

    <!--
      NB: these regexes are Mono and Windows compatible. "\." to represent literal period
          does not work on Mono 3.10
    -->
    <RegexReplace Input="$(VersionString)" Expression="v([0-9])[.][0-9][.][0-9](-[a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VMajor" TaskParameter="Output" />
    </RegexReplace>
    <RegexReplace Input="$(VersionString)" Expression="v[0-9][.]([0-9])[.][0-9](-[a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VMinor" TaskParameter="Output" />
    </RegexReplace>
    <RegexReplace Input="$(VersionString)" Expression="v[0-9][.][0-9][.]([0-9])(-[a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VPatch" TaskParameter="Output" />
    </RegexReplace>
    <RegexReplace Input="$(VersionString)" Expression="v[0-9][.][0-9][.][0-9]-([a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VPreRelease" TaskParameter="Output" />
    </RegexReplace>
  </Target>

  <Target Name="PublishValidateOnDevelopBranch">
    <!-- Validate that we are on develop branch -->
    <GitBranch LocalPath="$(SolutionDir)">
      <Output TaskParameter="Branch" PropertyName="GitBranch" />
    </GitBranch>
    <Error Condition="'$(GitBranch)' != '$(DevelopBranchName)'"
           Text="Please ensure all features have been merged into $(DevelopBranchName) and that you are on the $(DevelopBranchName) branch." />
  </Target>

  <Target Name="PublishValidateVersionString">
    <Error Condition="'$(VersionString)' == '' Or '$(VersionString)' == 'unknown'"
           Text="Must set VersionString property on command line!" />
  </Target>

  <Target Name="PublishValidation" DependsOnTargets="PublishValidateVersionString;PublishValidateOnDevelopBranch;PopulateVersionInformation">
    <!-- TODO: check for NuGet token, GH token, etc -->
    <!-- Validate parsed VersionString -->
    <RegexMatch Input="$(VMajor)" Expression="^[1-9]$">
      <Output PropertyName="VMajorValidated" TaskParameter="Output" />
    </RegexMatch>
    <Error Condition="'$(VMajorValidated)' == '' Or (!($(VMajorValidated) &gt; 0))"
           Text="VersionString must be in vX.Y.Z-PreRelStr where X &gt; 0 and -PreRelStr is optional" />
    <RegexMatch Input="$(VMinor)" Expression="^[0-9]$">
      <Output PropertyName="VMinorValidated" TaskParameter="Output" />
    </RegexMatch>
    <Error Condition="'$(VMinorValidated)' == '' Or (!($(VMajorValidated) &gt;= 0))"
           Text="VersionString must be in vX.Y.Z-PreRelStr where X &gt; 0 and -PreRelStr is optional" />
    <RegexMatch Input="$(VPatch)" Expression="^[0-9]$">
      <Output PropertyName="VPatchValidated" TaskParameter="Output" />
    </RegexMatch>
    <Error Condition="'$(VPatchValidated)' == '' Or (!($(VMajorValidated) &gt;= 0))"
           Text="VersionString must be in vX.Y.Z-PreRelStr where X &gt; 0 and -PreRelStr is optional" />

    <PropertyGroup Condition="'$(VPreRelease)' == ''">
      <NuGetVersion>$(VMajor).$(VMinor).$(VPatch)</NuGetVersion>
    </PropertyGroup>
    <PropertyGroup Condition="'$(VPreRelease)' != ''">
      <NuGetVersion>$(VMajor).$(VMinor).$(VPatch)-$(VPreRelease)</NuGetVersion>
    </PropertyGroup>
  </Target>

  <Target Name="PublishMergeMasterAndTag" DependsOnTargets="PublishValidateOnDevelopBranch">
    <Message Text="Checking out '$(MasterBranchName)' branch" />
    <GitClient Command="checkout" Arguments="$(MasterBranchName)" LocalPath="$(SolutionDir)" />
    <Message Text="Cleaning '$(MasterBranchName)' branch" />
    <GitClient Command="clean" Arguments="-fxd" LocalPath="$(SolutionDir)" />
    <Message Text="Merging '$(DevelopBranchName)' into '$(MasterBranchName)' NOTE: this will fail if the merge can't be done via fast-forward!" />
    <GitClient Command="merge" Arguments="--no-ff --commit --ff-only $(DevelopBranchName)" LocalPath="$(SolutionDir)" />
    <GitClient Command="tag" Arguments="--message &quot;riak-dotnet-client $(NuGetVersion)&quot; &quot;$(NuGetVersion)&quot;" LocalPath="$(SolutionDir)" />
  </Target>
<commit_msg>Ensure the tag starts with a "v"<commit_after>﻿<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
    <MSBuildCommunityTasksPath>$(SolutionDir)build</MSBuildCommunityTasksPath>
  </PropertyGroup>

  <Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.targets"/>

  <PropertyGroup>
    <CommonAssemblyInfoFile>$(SolutionDir)src\CommonAssemblyInfo.cs</CommonAssemblyInfoFile>
  </PropertyGroup>

  <PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
    <MonoExe>mono --runtime=v4.0.30319</MonoExe>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)' == ''">
    <Configuration>Release</Configuration>
  </PropertyGroup>

  <PropertyGroup>
    <VersionString Condition="'$(Configuration)' == 'Release'">unknown</VersionString>
    <VersionString Condition="'$(Configuration)' != 'Release'">v0.0.0</VersionString>
    <GitCommitHash>unknown</GitCommitHash>
    <MasterBranchName>master-test-147</MasterBranchName>
    <DevelopBranchName>jira/lrb/clients-147</DevelopBranchName>
  </PropertyGroup>

  <Target Name="CleanCommonAssemblyInfo">
    <Delete Files="$(CommonAssemblyInfoFile)" />
  </Target>

  <Target Name="PopulateVersionInformation">

    <GitDescribe LocalPath="$(SolutionDir)" Condition="'$(VersionString)' == 'unknown'">
      <Output TaskParameter="CommitHash" PropertyName="GitCommitHash" />
      <Output TaskParameter="Tag" PropertyName="VersionString" />
    </GitDescribe>

    <GitDescribe LocalPath="$(SolutionDir)" Condition="'$(Configuration)' == 'Release' And '$(VersionString)' != 'unknown'">
      <Output TaskParameter="CommitHash" PropertyName="GitCommitHash" />
    </GitDescribe>

    <Message Text="Parsing VersionString: $(VersionString)" />

    <!--
      NB: these regexes are Mono and Windows compatible. "\." to represent literal period
          does not work on Mono 3.10
    -->
    <RegexReplace Input="$(VersionString)" Expression="v([0-9])[.][0-9][.][0-9](-[a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VMajor" TaskParameter="Output" />
    </RegexReplace>
    <RegexReplace Input="$(VersionString)" Expression="v[0-9][.]([0-9])[.][0-9](-[a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VMinor" TaskParameter="Output" />
    </RegexReplace>
    <RegexReplace Input="$(VersionString)" Expression="v[0-9][.][0-9][.]([0-9])(-[a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VPatch" TaskParameter="Output" />
    </RegexReplace>
    <RegexReplace Input="$(VersionString)" Expression="v[0-9][.][0-9][.][0-9]-([a-z0-9]+)?" Replacement="$1" Count="1">
      <Output PropertyName="VPreRelease" TaskParameter="Output" />
    </RegexReplace>
  </Target>

  <Target Name="PublishValidateOnDevelopBranch">
    <!-- Validate that we are on develop branch -->
    <GitBranch LocalPath="$(SolutionDir)">
      <Output TaskParameter="Branch" PropertyName="GitBranch" />
    </GitBranch>
    <Error Condition="'$(GitBranch)' != '$(DevelopBranchName)'"
           Text="Please ensure all features have been merged into $(DevelopBranchName) and that you are on the $(DevelopBranchName) branch." />
  </Target>

  <Target Name="PublishValidateVersionString">
    <Error Condition="'$(VersionString)' == '' Or '$(VersionString)' == 'unknown'"
           Text="Must set VersionString property on command line!" />
  </Target>

  <Target Name="PublishValidation" DependsOnTargets="PublishValidateVersionString;PublishValidateOnDevelopBranch;PopulateVersionInformation">
    <!-- TODO: check for NuGet token, GH token, etc -->
    <!-- Validate parsed VersionString -->
    <RegexMatch Input="$(VMajor)" Expression="^[1-9]$">
      <Output PropertyName="VMajorValidated" TaskParameter="Output" />
    </RegexMatch>
    <Error Condition="'$(VMajorValidated)' == '' Or (!($(VMajorValidated) &gt; 0))"
           Text="VersionString must be in vX.Y.Z-PreRelStr where X &gt; 0 and -PreRelStr is optional" />
    <RegexMatch Input="$(VMinor)" Expression="^[0-9]$">
      <Output PropertyName="VMinorValidated" TaskParameter="Output" />
    </RegexMatch>
    <Error Condition="'$(VMinorValidated)' == '' Or (!($(VMajorValidated) &gt;= 0))"
           Text="VersionString must be in vX.Y.Z-PreRelStr where X &gt; 0 and -PreRelStr is optional" />
    <RegexMatch Input="$(VPatch)" Expression="^[0-9]$">
      <Output PropertyName="VPatchValidated" TaskParameter="Output" />
    </RegexMatch>
    <Error Condition="'$(VPatchValidated)' == '' Or (!($(VMajorValidated) &gt;= 0))"
           Text="VersionString must be in vX.Y.Z-PreRelStr where X &gt; 0 and -PreRelStr is optional" />

    <PropertyGroup Condition="'$(VPreRelease)' == ''">
      <NuGetVersion>$(VMajor).$(VMinor).$(VPatch)</NuGetVersion>
    </PropertyGroup>
    <PropertyGroup Condition="'$(VPreRelease)' != ''">
      <NuGetVersion>$(VMajor).$(VMinor).$(VPatch)-$(VPreRelease)</NuGetVersion>
    </PropertyGroup>
    <PropertyGroup>
      <GitTagVersion>v$(NuGetVersion)</GitTagVersion>
    </PropertyGroup>
  </Target>

  <Target Name="PublishMergeMasterAndTag" DependsOnTargets="PublishValidateOnDevelopBranch">
    <Message Text="Checking out '$(MasterBranchName)' branch" />
    <GitClient Command="checkout" Arguments="$(MasterBranchName)" LocalPath="$(SolutionDir)" />
    <Message Text="Cleaning '$(MasterBranchName)' branch" />
    <GitClient Command="clean" Arguments="-fxd" LocalPath="$(SolutionDir)" />
    <Message Text="Merging '$(DevelopBranchName)' into '$(MasterBranchName)' NOTE: this will fail if the merge can't be done via fast-forward!" />
    <GitClient Command="merge" Arguments="--no-ff --commit --ff-only $(DevelopBranchName)" LocalPath="$(SolutionDir)" />
    <GitClient Command="tag" Arguments="--message &quot;riak-dotnet-client $(NuGetVersion)&quot; &quot;$(GitTagVersion)&quot;" LocalPath="$(SolutionDir)" />
  </Target>

{'fraction_non_alphanumeric': 0.1846284501061571, 'fraction_numerical': 0.013248407643312102, 'mean_word_length': 4.950480040424456, 'pattern_counts': {'":': 0, '<': 208, '<?xml version=': 2, '>': 208, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5730412', 'n_tokens_mistral': 3744, 'n_tokens_neox': 3470, 'n_words': 662}