Skip to content

Commit 09935d7

Browse files
authored
Remove RIDS in CompareMsftToSbAssemblyVersions test (#42022)
1 parent c7dbe99 commit 09935d7

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/BaselineHelper.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ internal class BaselineHelper
2020
private const string SemanticVersionPlaceholderMatchingPattern = "*.*.*"; // wildcard pattern used to match on the version represented by the placeholder
2121
private const string NonSemanticVersionPlaceholder = "x.y";
2222
private const string NonSemanticVersionPlaceholderMatchingPattern = "*.*"; // wildcard pattern used to match on the version represented by the placeholder
23+
private const string TargetRidPlaceholder = "banana-rid";
24+
private const string TargetRidPlaceholderMatchingPattern = "*-*"; // wildcard pattern used to match on the rid represented by the placeholder
25+
private const string PortableRidPlaceholder = "portable-rid";
26+
private const string PortableRidPlaceholderMatchingPattern = "*-*"; // wildcard pattern used to match on the rid represented by the placeholder
2327

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

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

96100
public static string RemoveVersions(string source)
97101
{
@@ -119,14 +123,16 @@ public static string RemoveVersions(string source)
119123
}
120124

121125
/// <summary>
122-
/// This returns a <see cref="Matcher"/> that can be used to match on a path whose versions have been removed via
123-
/// <see cref="RemoveVersions(string)"/>.
126+
/// This returns a <see cref="Matcher"/> that can be used to match on a path whose versions and RID have been removed via
127+
/// <see cref="RemoveVersions(string)"/> and <see cref="RemoveRids(string, bool)"/>
124128
/// </summary>
125129
public static Matcher GetFileMatcherFromPath(string path)
126130
{
127131
path = path
128132
.Replace(SemanticVersionPlaceholder, SemanticVersionPlaceholderMatchingPattern)
129-
.Replace(NonSemanticVersionPlaceholder, NonSemanticVersionPlaceholderMatchingPattern);
133+
.Replace(NonSemanticVersionPlaceholder, NonSemanticVersionPlaceholderMatchingPattern)
134+
.Replace(TargetRidPlaceholder, TargetRidPlaceholderMatchingPattern)
135+
.Replace(PortableRidPlaceholder, PortableRidPlaceholderMatchingPattern);
130136
Matcher matcher = new();
131137
matcher.AddInclude(path);
132138
return matcher;

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/SdkContentTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ private string FindMatchingFilePath(string rootDir, Matcher matcher, string repr
185185
{
186186
AssemblyName assemblyName = AssemblyName.GetAssemblyName(file);
187187
string relativePath = Path.GetRelativePath(sbSdkPath, file);
188-
string normalizedPath = BaselineHelper.RemoveVersions(relativePath);
188+
string normalizedPath = BaselineHelper.RemoveRids(relativePath, isPortable: false);
189+
normalizedPath = BaselineHelper.RemoveVersions(normalizedPath);
189190

190191
if(!exclusionsHelper.IsFileExcluded(normalizedPath, SourceBuildSdkType))
191192
{

0 commit comments

Comments
 (0)