Skip to content

Commit

Permalink
Merge pull request #9525 from dotnet-maestro-bot/merge/vs17.9-to-main
Browse files Browse the repository at this point in the history
[automated] Merge branch 'vs17.9' => 'main'
  • Loading branch information
AR-May committed Dec 13, 2023
2 parents 46d6273 + b2016b8 commit f3ccb76
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 144 deletions.
2 changes: 2 additions & 0 deletions .vsts-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ stages:
value: 'int.main'
- name: VisualStudio.DropName
value: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
- name: NUGET_PACKAGES
value:

steps:
- task: NuGetToolInstaller@0
Expand Down
5 changes: 2 additions & 3 deletions src/Build/Evaluation/IntrinsicFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Microsoft.Build.Shared;
using Microsoft.Build.Shared.FileSystem;
using Microsoft.Build.Utilities;
using Microsoft.NET.StringTools;
using Microsoft.Win32;

// Needed for DoesTaskHostExistForParameters
Expand Down Expand Up @@ -399,11 +398,11 @@ internal static string ConvertFromBase64(string toDecode)
}

/// <summary>
/// Hash the string independent of bitness, target framework and default codepage of the environment.
/// Hash the string independent of bitness and target framework.
/// </summary>
internal static int StableStringHash(string toHash)
{
return FowlerNollVo1aHash.ComputeHash32(toHash);
return CommunicationsUtilities.GetHashCode(toHash);
}

/// <summary>
Expand Down
40 changes: 34 additions & 6 deletions src/Build/Logging/BinaryLogger/BuildEventArgsWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Framework.Profiler;
using Microsoft.Build.Shared;
using Microsoft.Build.Utilities;
using Microsoft.NET.StringTools;

#nullable disable

Expand Down Expand Up @@ -1261,9 +1259,9 @@ private void Write(IExtendedBuildEventArgs extendedData)

internal readonly struct HashKey : IEquatable<HashKey>
{
private readonly long value;
private readonly ulong value;

private HashKey(long i)
private HashKey(ulong i)
{
value = i;
}
Expand All @@ -1276,13 +1274,13 @@ public HashKey(string text)
}
else
{
value = FowlerNollVo1aHash.ComputeHash64Fast(text);
value = FnvHash64.GetHashCode(text);
}
}

public static HashKey Combine(HashKey left, HashKey right)
{
return new HashKey(FowlerNollVo1aHash.Combine64(left.value, right.value));
return new HashKey(FnvHash64.Combine(left.value, right.value));
}

public HashKey Add(HashKey other) => Combine(this, other);
Expand Down Expand Up @@ -1312,5 +1310,35 @@ public override string ToString()
return value.ToString();
}
}

internal static class FnvHash64
{
public const ulong Offset = 14695981039346656037;
public const ulong Prime = 1099511628211;

public static ulong GetHashCode(string text)
{
ulong hash = Offset;

unchecked
{
for (int i = 0; i < text.Length; i++)
{
char ch = text[i];
hash = (hash ^ ch) * Prime;
}
}

return hash;
}

public static ulong Combine(ulong left, ulong right)
{
unchecked
{
return (left ^ right) * Prime;
}
}
}
}
}
14 changes: 14 additions & 0 deletions src/MSBuild/MSBuild/Microsoft.Build.CommonTypes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ elementFormDefault="qualified">
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="VersionOverride">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="PackageReference_VersionOverride" _locComment="" -->When using Central Package Management (CPM), overrides the centrally defined version for this package. If the project is not using CPM, this element has no effect.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
<xs:attribute name="Include" type="xs:string">
Expand Down Expand Up @@ -265,6 +272,13 @@ elementFormDefault="qualified">
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VersionOverride" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="PackageReference_Attribute_VersionOverride" _locComment="" -->When using Central Package Management (CPM), overrides the centrally defined version for this package. If the project is not using CPM, this attribute has no effect.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down
135 changes: 0 additions & 135 deletions src/StringTools/FowlerNollVo1aHash.cs

This file was deleted.

0 comments on commit f3ccb76

Please sign in to comment.