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

Remove RIDS in CompareMsftToSbAssemblyVersions test #42022

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ internal class BaselineHelper
private const string SemanticVersionPlaceholderMatchingPattern = "*.*.*"; // wildcard pattern used to match on the version represented by the placeholder
private const string NonSemanticVersionPlaceholder = "x.y";
private const string NonSemanticVersionPlaceholderMatchingPattern = "*.*"; // wildcard pattern used to match on the version represented by the placeholder
private const string TargetRidPlaceholder = "banana-rid";
private const string TargetRidPlaceholderMatchingPattern = "*-*"; // wildcard pattern used to match on the rid represented by the placeholder
private const string PortableRidPlaceholder = "portable-rid";
private const string PortableRidPlaceholderMatchingPattern = "*-*"; // wildcard pattern used to match on the rid represented by the placeholder

public static void CompareEntries(string baselineFileName, IOrderedEnumerable<string> actualEntries)
{
Expand Down Expand Up @@ -91,7 +95,7 @@ public static string GetBaselineFilePath(string baselineFileName, string baselin
Path.Combine(GetAssetsDirectory(), baselineSubDir, baselineFileName);

public static string RemoveRids(string diff, bool isPortable = false) =>
isPortable ? diff.Replace(Config.PortableRid, "portable-rid") : diff.Replace(Config.TargetRid, "banana-rid");
isPortable ? diff.Replace(Config.PortableRid, PortableRidPlaceholder) : diff.Replace(Config.TargetRid, TargetRidPlaceholder);

public static string RemoveVersions(string source)
{
Expand Down Expand Up @@ -119,14 +123,16 @@ public static string RemoveVersions(string source)
}

/// <summary>
/// This returns a <see cref="Matcher"/> that can be used to match on a path whose versions have been removed via
/// <see cref="RemoveVersions(string)"/>.
/// This returns a <see cref="Matcher"/> that can be used to match on a path whose versions and RID have been removed via
/// <see cref="RemoveVersions(string)"/> and <see cref="RemoveRids(string, bool)"/>
/// </summary>
public static Matcher GetFileMatcherFromPath(string path)
{
path = path
.Replace(SemanticVersionPlaceholder, SemanticVersionPlaceholderMatchingPattern)
.Replace(NonSemanticVersionPlaceholder, NonSemanticVersionPlaceholderMatchingPattern);
.Replace(NonSemanticVersionPlaceholder, NonSemanticVersionPlaceholderMatchingPattern)
.Replace(TargetRidPlaceholder, TargetRidPlaceholderMatchingPattern)
.Replace(PortableRidPlaceholder, PortableRidPlaceholderMatchingPattern);
ellahathaway marked this conversation as resolved.
Show resolved Hide resolved
Matcher matcher = new();
matcher.AddInclude(path);
return matcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ private string FindMatchingFilePath(string rootDir, Matcher matcher, string repr
{
AssemblyName assemblyName = AssemblyName.GetAssemblyName(file);
string relativePath = Path.GetRelativePath(sbSdkPath, file);
string normalizedPath = BaselineHelper.RemoveVersions(relativePath);
string normalizedPath = BaselineHelper.RemoveRids(relativePath, isPortable: false);
normalizedPath = BaselineHelper.RemoveVersions(normalizedPath);

if(!exclusionsHelper.IsFileExcluded(normalizedPath, SourceBuildSdkType))
{
Expand Down
Loading