Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[automated] Merge branch 'vs17.9' => 'main' #9525

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.