Skip to content

Move Rebuild to have a deny list approach#51694

Merged
jaredpar merged 9 commits intodotnet:mainfrom
jaredpar:rebuild
Mar 11, 2021
Merged

Move Rebuild to have a deny list approach#51694
jaredpar merged 9 commits intodotnet:mainfrom
jaredpar:rebuild

Conversation

@jaredpar
Copy link
Member

@jaredpar jaredpar commented Mar 5, 2021

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.

@jaredpar
Copy link
Member Author

jaredpar commented Mar 8, 2021

Close / reopen to see if I can fix the issue with GitHub now showing the builds correctly

@jaredpar jaredpar closed this Mar 8, 2021
@jaredpar jaredpar reopened this Mar 8, 2021
@jaredpar jaredpar marked this pull request as ready for review March 8, 2021 15:24
@jaredpar jaredpar requested a review from a team as a code owner March 8, 2021 15:24
@jaredpar
Copy link
Member Author

jaredpar commented Mar 8, 2021

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

@jaredpar
Copy link
Member Author

jaredpar commented Mar 8, 2021

@dotnet/roslyn-compiler PTAL

Copy link
Contributor

@cston cston Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

@jaredpar jaredpar Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@jaredpar jaredpar requested a review from a team as a code owner March 10, 2021 18:21
@jaredpar
Copy link
Member Author

@dotnet/roslyn-compiler merged with @RikkiGibson change and responded to feedback

@RikkiGibson RikkiGibson self-assigned this Mar 10, 2021
if (_cache.ContainsKey(mvid))
if (peInfo.IsReadyToRun)
{
_logger.LogWarning($@"Skipping ReadyToRun image ""{file.FullName}""");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this more appropriate as an info than a warning? The user doesn't really control if their nuget folder contains an r2r image.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that should've been an informational

return null;
}

internal static Guid? GetMvidForFile(PEReader peReader)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this could be a local function in GetPortableExecutableInfo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this could be a local function in GetPortableExecutableInfo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar feedback as to GetMvidForFile.


namespace BuildValidator
{
internal sealed record PortableExecutableInfo(string FilePath, Guid Mvid, bool IsReadyToRun);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming the file to 'PortableExecutableInfo.cs', moving 'Util.GetPortableExecutableInfo' to a 'PortableExecutableInfo.Create' method, then eliminating the 'Util' class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

const int ExitFailure = 1;

private static readonly Regex[] s_ignorePatterns = new Regex[]
internal record AssemblyInfo(string FilePath, Guid Mvid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider either making this type 'private' or to moving it to its own file

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approval

@jaredpar
Copy link
Member Author

Integration test is a flaky failure.

@jaredpar jaredpar merged commit 158b7e5 into dotnet:main Mar 11, 2021
@jaredpar jaredpar deleted the rebuild branch March 11, 2021 18:25
@allisonchou allisonchou added this to the Next milestone Mar 12, 2021
@allisonchou allisonchou modified the milestones: Next, 16.10.P2 Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants