<commit_before><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <UsingTask TaskName="GetPackageVersion" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />

  <ItemGroup>
    <PackagesNuSpecFiles Include="$(SourceDir)nuget\*.nuspec" />
  </ItemGroup>

  <PropertyGroup>
    <PackagesOutDir Condition="'$(PackagesOutDir)' == ''">$(OutDir)Packages\</PackagesOutDir>
    <PackagesBasePath Condition="'$(PackagesBasePath)' == ''">$(OutDir)</PackagesBasePath>
  </PropertyGroup>

  <UsingTask TaskName="NuGetPack" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
  
  <Target Name="BuildPackages"
    DependsOnTargets="GetNuGetPackageVersions"
    Condition="'$(SkipBuildPackages)' != 'true'">
    
    <!-- Create package output directory -->
    <MakeDir Directories="$(PackagesOutDir)" />

    <!-- Make package -->
    <NugetPack
      Condition="'@(PackagesNuSpecFiles)'!=''"
      Nuspecs="%(PackagesNuSpecFiles.FullPath)"
      OutputDirectory="$(PackagesOutDir)"
      BaseDirectory="$(PackagesBasePath)"
      PackageVersion="%(PackagesNuSpecFiles.PackageVersion)"
      ExcludeEmptyDirectories="true"/>

    <Message
      Condition="'@(PackagesNuSpecFiles)'!=''"
      Importance="High"
      Text="%(PackagesNuSpecFiles.Filename) NuGet Package -> $(PackagesOutDir)%(PackagesNuSpecFiles.Filename).%(PackagesNuSpecFiles.PackageVersion).nupkg" />

    <ItemGroup>
      <PackagesForPublishing Include="$(PackagesOutDir)*.nupkg" />
    </ItemGroup>

    <!-- push all packages to a server if one has been specified -->
    <Exec
      Condition="'@(PackagesForPublishing)' != '' and '$(PublishPackageSource)' != ''"
      Command="$(NuGetExe) push &quot;%(PackagesForPublishing.Identity)&quot; -s $(PublishPackageSource)" />

  </Target>

  <Target
    Name="GetNuGetPackageVersions"
    Condition="'@(PackagesNuSpecFiles)'!=''"
    Outputs="%(PackagesNuSpecFiles.Identity)"
    DependsOnTargets="$(GetNuGetPackageVersionsDependsOn)">

    <PropertyGroup>
      <SelectedPackageVersion>$(BuildNumberMajor)-$(BuildNumberMinor)</SelectedPackageVersion>
    </PropertyGroup>

    <GetPackageVersion
      Condition="Exists('$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll')"
      RevisionNumber="$(SelectedPackageVersion)"
      NuSpecFile="%(PackagesNuSpecFiles.Identity)">
      <Output PropertyName="_TempPackageVersion" TaskParameter="PackageVersion" />
    </GetPackageVersion>
    
    <ItemGroup>
      <PackagesNuSpecFiles Condition="'%(PackagesNuSpecFiles.Identity)' == '%(Identity)'">
        <PackageVersion>$(_TempPackageVersion)</PackageVersion>
      </PackagesNuSpecFiles>
    </ItemGroup>

    <PropertyGroup>
      <_TempPackageVersion />
    </PropertyGroup>
  </Target>

  <PropertyGroup>
    <LocalPublishPropsFile Condition="'$(LocalPublishPropsFile)'==''">$(PackagesDir)/localpublish.props</LocalPublishPropsFile>
    <NugetPackageBuildTargets Condition="'$(NugetPackageBuildTargets)'==''">BuildPackages</NugetPackageBuildTargets>
  </PropertyGroup>

  <Import Condition="Exists('$(LocalPublishPropsFile)')"  Project="$(LocalPublishPropsFile)"/>
  
  <!-- Publish the packages locally -->
  <Target Name="LocalPackagePublish" Condition="'@(LocalPackages)'!=''"
          Inputs="%(LocalPackages.Identity)/%(LocalPackages.PackageName).%(LocalPackages.PackageVersion).nupkg;%(LocalPackages.InstallLocation)/%(LocalPackages.PackageName).%(LocalPackages.PackageVersion)" 
          Outputs="%(LocalPackages.InstallLocation)/%(LocalPackages.PackageName).%(LocalPackages.PackageVersion)/MODIFIED.txt"
          AfterTargets="$(NugetPackageBuildTargets)">
    
    <!-- Generate the packages.config -->
    <ItemGroup>
      <LocalPackageConfigLine Include="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;" />
      <LocalPackageConfigLine Include="&lt;packages&gt;" />
      <LocalPackageConfigLine Include="&lt;package id=&quot;%(LocalPackages.PackageName)&quot; version=&quot;%(LocalPackages.PackageVersion)&quot; /&gt;"/>
      <LocalPackageConfigLine Include="&lt;/packages&gt;" /><commit_msg>packages.targets knows how to pass through nuspec properties and override package version<commit_after><?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <UsingTask TaskName="GetPackageVersion" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />

  <ItemGroup>
    <PackagesNuSpecFiles Include="$(SourceDir)nuget\*.nuspec" />
  </ItemGroup>

  <PropertyGroup>
    <PackagesOutDir Condition="'$(PackagesOutDir)' == ''">$(OutDir)Packages\</PackagesOutDir>
    <PackagesBasePath Condition="'$(PackagesBasePath)' == ''">$(OutDir)</PackagesBasePath>
  </PropertyGroup>

  <UsingTask TaskName="NuGetPack" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
  
  <Target Name="BuildPackages"
    DependsOnTargets="AddNuGetPackageVersionMetadataToNuspecs"
    Condition="'$(SkipBuildPackages)' != 'true'">
    
    <!-- Create package output directory -->
    <MakeDir Directories="$(PackagesOutDir)" />

    <!-- Make package -->
    <NugetPack
      Condition="'@(PackagesNuSpecFiles)'!=''"
      Nuspecs="%(PackagesNuSpecFiles.FullPath)"
      OutputDirectory="$(PackagesOutDir)"
      BaseDirectory="$(PackagesBasePath)"
      PackageVersion="%(PackagesNuSpecFiles.PackageVersion)"
      ExcludeEmptyDirectories="true"
      NuspecProperties="@(NuspecProperties)"/>

    <Message
      Condition="'@(PackagesNuSpecFiles)'!=''"
      Importance="High"
      Text="%(PackagesNuSpecFiles.Filename) NuGet Package -> $(PackagesOutDir)%(PackagesNuSpecFiles.Filename).%(PackagesNuSpecFiles.PackageVersion).nupkg" />

    <ItemGroup>
      <PackagesForPublishing Include="$(PackagesOutDir)*.nupkg" />
    </ItemGroup>

    <!-- push all packages to a server if one has been specified -->
    <Exec
      Condition="'@(PackagesForPublishing)' != '' and '$(PublishPackageSource)' != ''"
      Command="$(NuGetExe) push &quot;%(PackagesForPublishing.Identity)&quot; -s $(PublishPackageSource)" />

  </Target>

  <Target
    Name="AddNuGetPackageVersionMetadataToNuspecs"
    Condition="'@(PackagesNuSpecFiles)'!=''"
    Outputs="%(PackagesNuSpecFiles.Identity)"
    DependsOnTargets="$(GetNuGetPackageVersionsDependsOn)">

    <PropertyGroup>
      <SelectedPackageVersion>$(BuildNumberMajor)-$(BuildNumberMinor)</SelectedPackageVersion>
    </PropertyGroup>

    <GetPackageVersion
      Condition="Exists('$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll') and $(DoNotGeneratePackageVersion) != 'true'"
      RevisionNumber="$(SelectedPackageVersion)"
      NuSpecFile="%(PackagesNuSpecFiles.Identity)">
      <Output PropertyName="_TempPackageVersion" TaskParameter="PackageVersion" />
    </GetPackageVersion>
    
    <!-- Assign the package version that was automatically generated from the nuspecs -->
    <ItemGroup
      Condition="$(DoNotGeneratePackageVersion) != 'true'">
      <PackagesNuSpecFiles Condition="'%(PackagesNuSpecFiles.Identity)' == '%(Identity)'">
        <PackageVersion>$(_TempPackageVersion)</PackageVersion>
      </PackagesNuSpecFiles>
    </ItemGroup>

    <!-- Assign the package version that was provided by the user -->
    <ItemGroup
      Condition="$(DoNotGeneratePackageVersion) == 'true' and $(PackageVersion) != ''">
      <PackagesNuSpecFiles Condition="'%(PackagesNuSpecFiles.Identity)' == '%(Identity)'">
        <PackageVersion>$(PackageVersion)</PackageVersion>
      </PackagesNuSpecFiles>
    </ItemGroup>

    <Error
      Condition="$(DoNotGeneratePackageVersion) == 'true' and $(PackageVersion) == ''"
      Text="When DoNotGeneratePackageVersion is set to 'true' the user has to provide a PackageVersion property that applies to all nuget packages"
      />

    <PropertyGroup>
      <_TempPackageVersion />
    </PropertyGroup>
  </Target>

  <PropertyGroup>
    <LocalPublishPropsFile Condition="'$(LocalPublishPropsFile)'==''">$(PackagesDir)/localpublish.props</LocalPublishPropsFile>
    <NugetPackageBuildTargets Condition="'$(NugetPackageBuildTargets)'==''">BuildPackages</NugetPackageBuildTargets>
  </PropertyGroup>

  <Import Condition="Exists('$(LocalPublishPropsFile)')"  Project="$(LocalPublishPropsFile)"/>
  
  <!-- Publish the packages locally -->
  <Target Name="LocalPackagePublish" Condition="'@(LocalPackages)'!=''"
          Inputs="%(LocalPackages.Identity)/%(LocalPackages.PackageName).%(LocalPackages.PackageVersion).nupkg;%(LocalPackages.InstallLocation)/%(LocalPackages.PackageName).%(LocalPackages.PackageVersion)" 
          Outputs="%(LocalPackages.InstallLocation)/%(LocalPackages.PackageName).%(LocalPackages.PackageVersion)/MODIFIED.txt"
          AfterTargets="$(NugetPackageBuildTargets)">
    
    <!-- Generate the packages.config -->
    <ItemGroup>
      <LocalPackageConfigLine Include="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;" />
      <LocalPackageConfigLine Include="&lt;packages&gt;" />
      <LocalPackageConfigLine Include="&lt;package id=&quot;%(LocalPackages.PackageName)&quot; version=&quot;%(LocalPackages.PackageVersion)&quot; /&gt;"/>
      <LocalPackageConfigLine Include="&lt;/packages&gt;" />
{'fraction_non_alphanumeric': 0.15972446453557207, 'fraction_numerical': 0.002798407060596276, 'mean_word_length': 5.207080828323313, 'pattern_counts': {'":': 0, '<': 128, '<?xml version=': 4, '>': 130, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '3226673', 'n_tokens_mistral': 2883, 'n_tokens_neox': 2600, 'n_words': 352}