Move Rebuild to have a deny list approach#51694
Conversation
|
Close / reopen to see if I can fix the issue with GitHub now showing the builds correctly |
|
For some reason GitHub is not displaying the latest test run results for this PR. Tried close / reopen to fix this but to no avail. Will keep this comment updated to point to the latest test run https://dev.azure.com/dnceng/public/_build/results?buildId=1027178&view=results |
|
@dotnet/roslyn-compiler PTAL |
src/Tools/BuildValidator/Program.cs
Outdated
There was a problem hiding this comment.
excludes.Any(x => filePath.IndexOf(x, FileNameEqualityComparer.StringComparison) >= 0) [](start = 24, length = 86)
Could this be expensive if there are many excludes and many assemblies in the search paths? Perhaps create a HashSet<string> for the excludes in this method. #Closed
There was a problem hiding this comment.
How would a HashSet<string> help here? In this case it's a full file path that we have to check for a substring match. Not sure how we can cache that. The returned file paths should already be unique given the way the file system is walked here. #Closed
There was a problem hiding this comment.
Ah, I missed the fact we're matching substrings here.
In reply to: 589655092 [](ancestors = 589655092)
Rather than listing all of the assemblies that we support rebuilding this moves us to listing the ones that don't support it. That makes it much more explicit what our "work remaining" is as well as automatically adding in new assemblies added to the project.
|
@dotnet/roslyn-compiler merged with @RikkiGibson change and responded to feedback |
| if (_cache.ContainsKey(mvid)) | ||
| if (peInfo.IsReadyToRun) | ||
| { | ||
| _logger.LogWarning($@"Skipping ReadyToRun image ""{file.FullName}"""); |
There was a problem hiding this comment.
Is this more appropriate as an info than a warning? The user doesn't really control if their nuget folder contains an r2r image.
There was a problem hiding this comment.
Yeah that should've been an informational
src/Tools/BuildValidator/Util.cs
Outdated
| return null; | ||
| } | ||
|
|
||
| internal static Guid? GetMvidForFile(PEReader peReader) |
There was a problem hiding this comment.
Feels like this could be a local function in GetPortableExecutableInfo
There was a problem hiding this comment.
I would prefer to leave it this way for now. These tools usually end up grabbing MVID as a separate operation which is why I kept it as a top level method here.
| } | ||
| } | ||
|
|
||
| internal static bool IsReadyToRunImage(PEReader peReader) |
There was a problem hiding this comment.
Feels like this could be a local function in GetPortableExecutableInfo
There was a problem hiding this comment.
Similar feedback as to GetMvidForFile.
src/Tools/BuildValidator/Util.cs
Outdated
|
|
||
| namespace BuildValidator | ||
| { | ||
| internal sealed record PortableExecutableInfo(string FilePath, Guid Mvid, bool IsReadyToRun); |
There was a problem hiding this comment.
Consider renaming the file to 'PortableExecutableInfo.cs', moving 'Util.GetPortableExecutableInfo' to a 'PortableExecutableInfo.Create' method, then eliminating the 'Util' class.
There was a problem hiding this comment.
I think that having a type per file with records is going to de-value them a bit. A record is meant to be a simple concise declaration. Having them be per file means that we pretty much lose that as we have to include the copyright, namespace, using, etc ... Basically bringing more and more boiler plate back into the feature that was meant to avoid it.
Prefer we think about an approach where we can keep the simplicity here. Possibly just having a file for all the simple records as long as they remain ... simple. Push them out to separate files once they hit some levele of complexity.
src/Tools/BuildValidator/Program.cs
Outdated
| const int ExitFailure = 1; | ||
|
|
||
| private static readonly Regex[] s_ignorePatterns = new Regex[] | ||
| internal record AssemblyInfo(string FilePath, Guid Mvid) |
There was a problem hiding this comment.
Consider either making this type 'private' or to moving it to its own file
|
Integration test is a flaky failure. |
Rather than listing all of the assemblies that we support rebuilding
this moves us to listing the ones that don't support it. That makes it
much more explicit what our "work remaining" is as well as automatically
adding in new assemblies added to the project.