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

Stop injecting NoWarns into repo's Directory.Build.props #3117

Closed
Tracked by #3664
MichaelSimons opened this issue Nov 14, 2022 · 6 comments · Fixed by dotnet/installer#17712
Closed
Tracked by #3664

Stop injecting NoWarns into repo's Directory.Build.props #3117

MichaelSimons opened this issue Nov 14, 2022 · 6 comments · Fixed by dotnet/installer#17712
Assignees
Labels
area-build Improvements in source-build's own build process

Comments

@MichaelSimons
Copy link
Member

The source-build infrastructure injects some NoWarns into the repo's Directory.Build.props. This is to handle some scenarios that come up in source build because of the way dependencies flow in source build. This approach is not compatible with the VMR in which source-build is built inside the context of a git repo. Checked in files should not be manipulated in place as this break dev UX. An alternative approach will be necessary going forward. Likely, the most reasonable approach is to make these changes within the repos that require them. This is most feasible in the .NET 9.0 timeframe. For the 8.0 timeframe, an alternative approach may be needed.

Sample manipulated Directory.Build.props:

[root@eec4fefb31f6 tarball]# git diff src/arcade/Directory.Build.props
diff --git a/src/arcade/Directory.Build.props b/src/arcade/Directory.Build.props
index 6bab8b78e..d11fb2749 100644
--- a/src/arcade/Directory.Build.props
+++ b/src/arcade/Directory.Build.props
@@ -27,4 +27,7 @@
     <MsbuildTaskMicrosoftCodeAnalysisCSharpVersion>$(MicrosoftCodeAnalysisCSharpVersion)</MsbuildTaskMicrosoftCodeAnalysisCSharpVersion>
   </PropertyGroup>

+  <PropertyGroup>
+    <NoWarn>$(NoWarn);NU5104;NU1603;</NoWarn>
+  </PropertyGroup>
 </Project>
@NikolaMilosavljevic
Copy link
Member

The plan seems to be to create patches for all the affected repos and drive the backport to those repo. Any source-build specific change should be conditioned for full product source-build.

@MichaelSimons does this sound like a plan?

@MichaelSimons
Copy link
Member Author

Things have changes a fair bit since this infrastructure to support source-build wide no-warn which are typically nuget related.

  1. Repo specific PVP feature - Repos are able to control with dependencies they take. This likely impacted the number of instances we see NU5104;NU1603 in.
  2. VMR - with the vmr we can now add these nowarns to the specific repos they are required for (once edits are supported).

Given these, I think an attempt should be made to remove these nowarns all up and only add them back in the specific cases where they are needed. If that doesn't work and we need a solution to apply a nowarn across the system, I would like to see a common shared solution, for example is it possible to add a directory.build.props in the VMR src directory that would define this common nowarn property?

@NikolaMilosavljevic
Copy link
Member

After reviewing the current state, patches wouldn't make any sense - we make nowarn changes in all repos. I will work on consolidating this.

@NikolaMilosavljevic
Copy link
Member

Main nuget-related nowarns are not needed at the moment. The original issue implies that this only reproes in some scenarios: #2766

Additionally, there are 3 repo-specific nowarns:

We cannot have high confidence for removal of any nowarns without being able to test stage 2 builds, which aren't working in main.

Alternative approach is to preserve all current nowarns, but move them to a checked in location. We already have a shared Directory.Build.props file in src root: https://github.com/dotnet/dotnet/blob/main/src/Directory.Build.props If we were to copy this one as part of inner clone, we could provide additional nowarns for repo source-build. This will solve the shared nowarns, but it will likely be possible to also implement repo-specific ones, by conditioning them. This model should work even after we stop creating the inner clone.

@MichaelSimons
Copy link
Member Author

I forgot about the repo specific nowarns. Would be nice to cleanup the nowarns repo and system that are no longer needed. I would have confidence if valdiated in a .NET 8.0 environment.

If we were to copy this one as part of inner clone, we could provide additional nowarns for repo source-build. This will solve the shared nowarns, but it will likely be possible to also implement repo-specific ones, by conditioning them. This model should work even after we stop creating the inner clone.

That could work. Curious if we will encounter any issues with repo's defining their nowarns without concatenating. e.g. $(nowarn);nnn

@MichaelSimons MichaelSimons moved this from Post 8.0 / Pre 9.0 to In Progress in .NET Source Build Nov 3, 2023
@NikolaMilosavljevic
Copy link
Member

I have validated that we can simply remove nuget-specific, vstest and runtime nowarns. The only remaining one is in nuget.client. I propose that we create a patch for that one and a backport to their repo. We'd condition this nowarn for product source-build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-build Improvements in source-build's own build process
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants