<commit_before><?xml version="1.0" encoding="utf-8"?>
<!--
   Copyright 2014 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

	<PropertyGroup Condition="'$(GenerateAssemblyInfo)' == 'true'">
		<CompileDependsOn>
			SemanticGit:GetHead;
			SemanticGit:GenerateAssemblyInfo;
			$(CompileDependsOn);
		</CompileDependsOn>

		<!-- Path to the generated assembly info. -->
		<AssemblyInfoFile Condition="'$(AssemblyInfoFile)' == ''">$(IntermediateOutputPath)AssemblyInfo.g$(DefaultLanguageSourceExtension)</AssemblyInfoFile>
		<!-- Used to generate the [Guid] attribute, which expects a GUID without the { }, as it's used in the ProjectGuid -->
		<ProjectGuidString>$([System.Guid]::Parse($(ProjectGuid)).ToString())</ProjectGuidString>
	</PropertyGroup>

	<Target Name="SemanticGit:GenerateAssemblyInfo" 
			DependsOnTargets="SemanticGit:EnsurePathExists;SemanticGit:GenerateAssemblyInfoCS;SemanticGit:GenerateAssemblyInfoVB"
			Condition="'$(GenerateAssemblyInfo)' == 'true'">

		<Error Condition="'$(Language)' != 'C#' AND '$(Language)' != 'VB'"
			   Text="Only C# and VB languages are supported for semantic assembly info generation from Git." />

		<ItemGroup>
			<Compile Include="$(AssemblyInfoFile)" />
		</ItemGroup>

		<Message Text="AssemblyInfo: 
	AssemblyVersion=$(AssemblyVersion)
	AssemblyFileVersion=$(AssemblyFileVersion)
	AssemblyInformationalVersion=$(AssemblyInformationalVersion)" Importance="normal" />
		
	</Target>

	<Target Name="SemanticGit:EnsurePathExists">
		<ItemGroup>
			<_AssemblyInfoFile Include="$(AssemblyInfoFile)" />
		</ItemGroup>

		<MakeDir Directories="%(_AssemblyInfoFile.RootDir)%(_AssemblyInfoFile.Directory)"
				 Condition="!Exists('%(_AssemblyInfoFile.RootDir)%(_AssemblyInfoFile.Directory)')" />
	</Target>
	
	<Target Name="SemanticGit:FormatVersion" DependsOnTargets="SemanticGit:GetVersion">
		<PropertyGroup>
			<PackageVersion>$(PackageVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)').Replace('-PRE', '$(_PreRelease)').Replace('COMMIT', '$(_Commit)'))</PackageVersion>
			<AssemblyVersion>$(AssemblyVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)'))</AssemblyVersion>
			<AssemblyFileVersion>$(AssemblyFileVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)'))</AssemblyFileVersion>
			<AssemblyInformationalVersion>$(AssemblyInformationalVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)').Replace('-PRE', '$(_PreRelease)').Replace('COMMIT', '$(_Commit)'))</AssemblyInformationalVersion>
		</PropertyGroup>
	</Target>

	<Target Name="SemanticGit:GenerateAssemblyInfoCS"
			Inputs="@(_HeadInput)"
			Outputs="$(AssemblyInfoFile)"
			DependsOnTargets="SemanticGit:FormatVersion"
			Condition="'$(Language)' == 'C#'">

		<WriteLinesToFile File='$(AssemblyInfoFile)'
						  Lines='
[assembly: System.Reflection.AssemblyVersion(ThisAssembly.Version)]
[assembly: System.Reflection.AssemblyFileVersion(ThisAssembly.FileVersion)]
[assembly: System.Reflection.AssemblyInformationalVersion(ThisAssembly.InformationalVersion)]

/// &lt;summary&gt;Provides access to the current assembly information.&lt;/summary&gt;
partial class ThisAssembly
{
	/// &lt;summary&gt;Assembly version: $(AssemblyVersion)&lt;/summary&gt;
	public const string Version = "$(AssemblyVersion)"%3b

	/// &lt;summary&gt;Assembly file version: $(AssemblyFileVersion)&lt;/summary&gt;
	public const string FileVersion = "$(AssemblyFileVersion)"%3b
	
	/// &lt;summary&gt;Assembly informational version: $(AssemblyInformationalVersion)&lt;/summary&gt;
	public const string InformationalVersion = "$(AssemblyInformationalVersion)"%3b
	
	/// &lt;summary&gt;Git commit of the assembly source: $(_Commit)&lt;/summary&gt;
	public const string Commit = "$(_Commit)"%3b
	
	/// &lt;summary&gt;Assembly unique identifier: $(ProjectGuidString)&lt;/summary&gt;
	public const string Guid = "$(ProjectGuidString)"%3b						  
}'
						  Overwrite='true' />

		<ItemGroup>
			<FileWrites Include="$(AssemblyInfoFile)" />
		</ItemGroup>

	</Target>

	<Target Name="SemanticGit:GenerateAssemblyInfoVB"
			Inputs="@(_HeadInput)"
			Outputs="$(AssemblyInfoFile)"
			DependsOnTargets="SemanticGit:FormatVersion"
			Condition="'$(Language)' == 'VB'">


		<WriteLinesToFile File='$(AssemblyInfoFile)'
						  Lines='
&lt;Assembly: System.Reflection.AssemblyVersion(ThisAssembly.Version)&gt;
&lt;Assembly: System.Reflection.AssemblyFileVersion(ThisAssembly.FileVersion)&gt;
&lt;Assembly: System.Reflection.AssemblyInformationalVersion(ThisAssembly.InformationalVersion)&gt;

Partial Class ThisAssembly
    Public Const Version = "$(AssemblyVersion)"
    Public Const FileVersion = "$(AssemblyFileVersion)"
    Public Const InformationalVersion = "$(AssemblyInformationalVersion)"
    Public Const Commit = "$(_Commit)"
    Public Const Guid = "$(ProjectGuidString)"
End Class
'
						  Overwrite='true' />

		<ItemGroup>
			<FileWrites Include="$(AssemblyInfoFile)" />
		</ItemGroup><commit_msg>Add support for explicitly calling FormatVersion target to get a formatted version string<commit_after><?xml version="1.0" encoding="utf-8"?>
<!--
   Copyright 2014 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

	<!-- Publicly consumable target to format a string with the determined version values from Git SemVer labels
         Receives a VersionFormat property and returns a formatted value.
         The format can contain any of MAJOR, MINOR, PATCH, COMMIT or '-PRE' strings, which will be replaced with their 
         semver segments.
	 -->
	<Target Name="SemanticGit:FormatVersion" DependsOnTargets="SemanticGit:GetVersion" Returns="$(_FormattedVersion)">
		<PropertyGroup>
			<_FormattedVersion>$(VersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)').Replace('-PRE', '$(_PreRelease)').Replace('COMMIT', '$(_Commit)'))</_FormattedVersion>
		</PropertyGroup>
	</Target>
	

	<PropertyGroup Condition="'$(GenerateAssemblyInfo)' == 'true'">
		<CompileDependsOn>
			SemanticGit:GetHead;
			SemanticGit:GenerateAssemblyInfo;
			$(CompileDependsOn);
		</CompileDependsOn>

		<!-- Path to the generated assembly info. -->
		<AssemblyInfoFile Condition="'$(AssemblyInfoFile)' == ''">$(IntermediateOutputPath)AssemblyInfo.g$(DefaultLanguageSourceExtension)</AssemblyInfoFile>
		<!-- Used to generate the [Guid] attribute, which expects a GUID without the { }, as it's used in the ProjectGuid -->
		<ProjectGuidString>$([System.Guid]::Parse($(ProjectGuid)).ToString())</ProjectGuidString>
	</PropertyGroup>

	<Target Name="SemanticGit:GenerateAssemblyInfo" 
			DependsOnTargets="SemanticGit:EnsurePathExists;SemanticGit:GenerateAssemblyInfoCS;SemanticGit:GenerateAssemblyInfoVB"
			Condition="'$(GenerateAssemblyInfo)' == 'true'">

		<Error Condition="'$(Language)' != 'C#' AND '$(Language)' != 'VB'"
			   Text="Only C# and VB languages are supported for semantic assembly info generation from Git." />

		<ItemGroup>
			<Compile Include="$(AssemblyInfoFile)" />
		</ItemGroup>

		<Message Text="AssemblyInfo: 
	AssemblyVersion=$(AssemblyVersion)
	AssemblyFileVersion=$(AssemblyFileVersion)
	AssemblyInformationalVersion=$(AssemblyInformationalVersion)" Importance="normal" />
		
	</Target>

	<Target Name="SemanticGit:EnsurePathExists">
		<ItemGroup>
			<_AssemblyInfoFile Include="$(AssemblyInfoFile)" />
		</ItemGroup>

		<MakeDir Directories="%(_AssemblyInfoFile.RootDir)%(_AssemblyInfoFile.Directory)"
				 Condition="!Exists('%(_AssemblyInfoFile.RootDir)%(_AssemblyInfoFile.Directory)')" />
	</Target>

	<Target Name="SemanticGit:ApplyVersionFormats" DependsOnTargets="SemanticGit:GetVersion">
		<PropertyGroup>
			<PackageVersion>$(PackageVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)').Replace('-PRE', '$(_PreRelease)').Replace('COMMIT', '$(_Commit)'))</PackageVersion>
			<AssemblyVersion>$(AssemblyVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)'))</AssemblyVersion>
			<AssemblyFileVersion>$(AssemblyFileVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)'))</AssemblyFileVersion>
			<AssemblyInformationalVersion>$(AssemblyInformationalVersionFormat.Replace('MAJOR', '$(_Major)').Replace('MINOR', '$(_Minor)').Replace('PATCH', '$(_Patch)').Replace('-PRE', '$(_PreRelease)').Replace('COMMIT', '$(_Commit)'))</AssemblyInformationalVersion>
		</PropertyGroup>
	</Target>

	<Target Name="SemanticGit:GenerateAssemblyInfoCS"
			Inputs="@(_HeadInput)"
			Outputs="$(AssemblyInfoFile)"
			DependsOnTargets="SemanticGit:ApplyVersionFormats"
			Condition="'$(Language)' == 'C#'">

		<WriteLinesToFile File='$(AssemblyInfoFile)'
						  Lines='
[assembly: System.Reflection.AssemblyVersion(ThisAssembly.Version)]
[assembly: System.Reflection.AssemblyFileVersion(ThisAssembly.FileVersion)]
[assembly: System.Reflection.AssemblyInformationalVersion(ThisAssembly.InformationalVersion)]

/// &lt;summary&gt;Provides access to the current assembly information.&lt;/summary&gt;
partial class ThisAssembly
{
	/// &lt;summary&gt;Assembly version: $(AssemblyVersion)&lt;/summary&gt;
	public const string Version = "$(AssemblyVersion)"%3b

	/// &lt;summary&gt;Assembly file version: $(AssemblyFileVersion)&lt;/summary&gt;
	public const string FileVersion = "$(AssemblyFileVersion)"%3b
	
	/// &lt;summary&gt;Assembly informational version: $(AssemblyInformationalVersion)&lt;/summary&gt;
	public const string InformationalVersion = "$(AssemblyInformationalVersion)"%3b
	
	/// &lt;summary&gt;Git commit of the assembly source: $(_Commit)&lt;/summary&gt;
	public const string Commit = "$(_Commit)"%3b
	
	/// &lt;summary&gt;Assembly unique identifier: $(ProjectGuidString)&lt;/summary&gt;
	public const string Guid = "$(ProjectGuidString)"%3b						  
}'
						  Overwrite='true' />

		<ItemGroup>
			<FileWrites Include="$(AssemblyInfoFile)" />
		</ItemGroup>

	</Target>

	<Target Name="SemanticGit:GenerateAssemblyInfoVB"
			Inputs="@(_HeadInput)"
			Outputs="$(AssemblyInfoFile)"
			DependsOnTargets="SemanticGit:ApplyVersionFormats"
			Condition="'$(Language)' == 'VB'">


		<WriteLinesToFile File='$(AssemblyInfoFile)'
						  Lines='
&lt;Assembly: System.Reflection.AssemblyVersion(ThisAssembly.Version)&gt;
&lt;Assembly: System.Reflection.AssemblyFileVersion(ThisAssembly.FileVersion)&gt;
&lt;Assembly: System.Reflection.AssemblyInformationalVersion(ThisAssembly.InformationalVersion)&gt;

Partial Class ThisAssembly
    Public Const Version = "$(AssemblyVersion)"
    Public Const FileVersion = "$(AssemblyFileVersion)"
    Public Const InformationalVersion = "$(AssemblyInformationalVersion)"
    Public Const Commit = "$(_Commit)"
    Public Const Guid = "$(ProjectGuidString)"
End Class
'
						  Overwrite='true' />

		<ItemGroup>
			<FileWrites Include="$(AssemblyInfoFile)" />
		</ItemGroup>
{'fraction_non_alphanumeric': 0.15306456899377252, 'fraction_numerical': 0.003605375286791216, 'mean_word_length': 6.370169082125604, 'pattern_counts': {'":': 0, '<': 110, '<?xml version=': 2, '>': 110, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5263209', 'n_tokens_mistral': 3793, 'n_tokens_neox': 3394, 'n_words': 712}