<commit_before><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="GetTdsNuGetPackageFolder" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
    <ParameterGroup>
      <PackagesFolderPath ParameterType="System.String" Required="true" />
      <TdsNuGetFolder ParameterType="System.String" Output="true" />
    </ParameterGroup>
    <Task>
      <Using Namespace="System" />
      <Using Namespace="System.IO" />
      <Using Namespace="System.Text.RegularExpressions" />
      <Code Type="Fragment" Language="cs">
        <![CDATA[
        var hhogTDSNuGetNamePattern = "HedgehogDevelopment.TDS.*" ;
        var hhogTDSPackageFolders = Directory.EnumerateDirectories(PackagesFolderPath, hhogTDSNuGetNamePattern);
        foreach(var folder in hhogTDSPackageFolders)
        {
            var tasksDllFolder = folder + "/build";
            var tasksFileExists = File.Exists(tasksDllFolder + "/HedgehogDevelopment.SitecoreProject.Tasks.dll");
            if (tasksFileExists)
            {
                TdsNuGetFolder = tasksDllFolder;
                return true;
            }
        }
        TdsNuGetFolder = "";
        ]]>
      </Code>
    </Task>
  </UsingTask>
  <!-- From https://gist.github.com/thoemmi/3483648 -->
  <UsingTask TaskName="ExistsInPath" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
    <ParameterGroup>
      <FileName ParameterType="System.String" Required="true" />
      <Exists ParameterType="System.Boolean" Output="true" />
    </ParameterGroup>
    <Task>
      <!--<Reference Include="" />-->
      <Using Namespace="System" />
      <Using Namespace="System.IO" />
      <Using Namespace="System.Text.RegularExpressions" />
      <Code Type="Fragment" Language="cs"><![CDATA[
        var values = Environment.GetEnvironmentVariable("PATH");
        foreach (var path in values.Split(';')) {
            var fullPath = Path.Combine(path, FileName);
            if (File.Exists(fullPath)) {
                Exists = true;
                return true;
            }
        }
        Exists = false;
        ]]></Code>
    </Task>
  </UsingTask>
  <UsingTask AssemblyFile="Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll" TaskName="Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.Tasks.Filters.CullFilesFromProject"/>
  <Target Name="BeforeSitecoreBuild" Condition="'$(CustomGitDeltaDeploy)' == 'True'">
    <GetTdsNuGetPackageFolder PackagesFolderPath="$(SolutionDir)/packages/">
      <Output TaskParameter="TdsNuGetFolder" PropertyName="TdsNuGetPackageDllFolder" />
    </GetTdsNuGetPackageFolder>

    <Message Condition="$(TdsNuGetPackageDllFolder) == ''"
             Text="Solution doesn't use the HedgehogDevelopment.TDS NuGet package. You need to manually copy the 'packages/build/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll' to your MSBuild directory (C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0).'" />
    <Message Condition="$(TdsNuGetPackageDllFolder) != ''"
             Text="Solution uses the HedgehogDevelopment.TDS NuGet package. Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.DLL will load from there." />

    <Copy Condition="Exists('$(TdsNuGetPackageDllFolder)/HedgehogDevelopment.SitecoreProject.Tasks.dll') and !Exists('$(TdsNuGetPackageDllFolder)/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll')"
          SourceFiles="$(SolutionDir)/packages/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.1.0.2/build/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll"
          DestinationFolder="$(TdsNuGetPackageDllFolder)/" />
  </Target>
  <Target Name="GitDiff" Condition="'$(CustomGitDeltaDeploy)' == 'True'">
    <Message Importance="" Text="Discovering changed items files since the last local deployment of this project." />
    <!-- Check that Git exists in the local PATH variable on the machine -->
    <ExistsInPath FileName="git.exe">
      <Output TaskParameter="Exists" PropertyName="GitExists" />
    </ExistsInPath>
    <Message  Condition="!$(GitExists)"
              Importance="High" Text="Warn: Git.exe not found in PATH. We cannot determine cullable items from calls to git.exe." />

    <!-- If not supplied to the build already, retrieve the git commit ID of the last successful deployment of this project (from the LastDeploymentGitCommitId.txt file) and store it in the LastDeploymentGitCommitID property. -->
    <ReadLinesFromFile Condition="$(LastDeploymentGitCommitID) == '' and Exists('$(MSBuildProjectDirectory)/Report/LastDeploymentGitCommitId.txt')"
                       File="$(MSBuildProjectDirectory)/Report/LastDeploymentGitCommitId.txt" >
      <Output TaskParameter="Lines" PropertyName="LastDeploymentGitCommitID" />
    </ReadLinesFromFile>
    <Message Condition="'$(LastDeploymentGitCommitID)' != ''" 
             Importance="normal" <commit_msg>Fixed hard coded path to GitDeltaDeploy.DLL to be copied pre-build.<commit_after><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="GetTdsNuGetPackageFolder" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
    <ParameterGroup>
      <PackagesFolderPath ParameterType="System.String" Required="true" />
      <TdsNuGetFolder ParameterType="System.String" Output="true" />
    </ParameterGroup>
    <Task>
      <Using Namespace="System" />
      <Using Namespace="System.IO" />
      <Using Namespace="System.Text.RegularExpressions" />
      <Code Type="Fragment" Language="cs">
        <![CDATA[
        var hhogTDSNuGetNamePattern = "HedgehogDevelopment.TDS.*" ;
        var hhogTDSPackageFolders = Directory.EnumerateDirectories(PackagesFolderPath, hhogTDSNuGetNamePattern);
        foreach(var folder in hhogTDSPackageFolders)
        {
            var tasksDllFolder = folder + "/build";
            var tasksFileExists = File.Exists(tasksDllFolder + "/HedgehogDevelopment.SitecoreProject.Tasks.dll");
            if (tasksFileExists)
            {
                TdsNuGetFolder = tasksDllFolder;
                return true;
            }
        }
        TdsNuGetFolder = "";
        ]]>
      </Code>
    </Task>
  </UsingTask>
  <!-- From https://gist.github.com/thoemmi/3483648 -->
  <UsingTask TaskName="ExistsInPath" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
    <ParameterGroup>
      <FileName ParameterType="System.String" Required="true" />
      <Exists ParameterType="System.Boolean" Output="true" />
    </ParameterGroup>
    <Task>
      <!--<Reference Include="" />-->
      <Using Namespace="System" />
      <Using Namespace="System.IO" />
      <Using Namespace="System.Text.RegularExpressions" />
      <Code Type="Fragment" Language="cs"><![CDATA[
        var values = Environment.GetEnvironmentVariable("PATH");
        foreach (var path in values.Split(';')) {
            var fullPath = Path.Combine(path, FileName);
            if (File.Exists(fullPath)) {
                Exists = true;
                return true;
            }
        }
        Exists = false;
        ]]></Code>
    </Task>
  </UsingTask>
  <UsingTask AssemblyFile="Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll" TaskName="Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.Tasks.Filters.CullFilesFromProject"/>
  <Target Name="BeforeSitecoreBuild" Condition="'$(CustomGitDeltaDeploy)' == 'True'">
    <GetTdsNuGetPackageFolder PackagesFolderPath="$(SolutionDir)/packages/">
      <Output TaskParameter="TdsNuGetFolder" PropertyName="TdsNuGetPackageDllFolder" />
    </GetTdsNuGetPackageFolder>

    <Message Condition="$(TdsNuGetPackageDllFolder) == ''"
             Text="Solution doesn't use the HedgehogDevelopment.TDS NuGet package. You need to manually copy the 'packages/build/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll' to your MSBuild directory (C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0).'" />
    <Message Condition="$(TdsNuGetPackageDllFolder) != ''"
             Text="Solution uses the HedgehogDevelopment.TDS NuGet package. Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.DLL will load from there." />

    <Copy Condition="Exists('$(TdsNuGetPackageDllFolder)/HedgehogDevelopment.SitecoreProject.Tasks.dll') and !Exists('$(TdsNuGetPackageDllFolder)/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll')"
          SourceFiles="$(MSBuildThisFileDirectory)/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.dll"
          DestinationFolder="$(TdsNuGetPackageDllFolder)/" />
  </Target>
  <Target Name="GitDiff" Condition="'$(CustomGitDeltaDeploy)' == 'True'">
    <Message Importance="" Text="Discovering changed items files since the last local deployment of this project." />
    <!-- Check that Git exists in the local PATH variable on the machine -->
    <ExistsInPath FileName="git.exe">
      <Output TaskParameter="Exists" PropertyName="GitExists" />
    </ExistsInPath>
    <Message  Condition="!$(GitExists)"
              Importance="High" Text="Warn: Git.exe not found in PATH. We cannot determine cullable items from calls to git.exe." />

    <!-- If not supplied to the build already, retrieve the git commit ID of the last successful deployment of this project (from the LastDeploymentGitCommitId.txt file) and store it in the LastDeploymentGitCommitID property. -->
    <ReadLinesFromFile Condition="$(LastDeploymentGitCommitID) == '' and Exists('$(MSBuildProjectDirectory)/Report/LastDeploymentGitCommitId.txt')"
                       File="$(MSBuildProjectDirectory)/Report/LastDeploymentGitCommitId.txt" >
      <Output TaskParameter="Lines" PropertyName="LastDeploymentGitCommitID" />
    </ReadLinesFromFile>
    <Message Condition="'$(LastDeploymentGitCommitID)' != ''" 
             Importance="normal" 
{'fraction_non_alphanumeric': 0.1301632077372557, 'fraction_numerical': 0.005138021358049567, 'mean_word_length': 3.66056338028169, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 2, '>': 109, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '375990', 'n_tokens_mistral': 3047, 'n_tokens_neox': 2785, 'n_words': 531}