Skip to content

Add dotnet/roslyn-analyzers repo #1849

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

Merged
merged 1 commit into from
Nov 12, 2020
Merged

Conversation

omajid
Copy link
Member

@omajid omajid commented Oct 30, 2020

This repo doesn't build out of the box on Linux, so I have added various build scripts and hacks to get that working.

create mode 100644 src/Text.Analyzers/Setup/AnalyzerReleases.Unshipped.md

diff --git a/FxCopAnalyzers.sln b/FxCopAnalyzers.sln
deleted file mode 100644
Copy link
Member Author

Choose a reason for hiding this comment

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

Is there some other way to selectively disable a .sln file?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can specify one in the build command... but I think we can defer this improvement.

EndProject
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Roslyn.Diagnostics.VisualBasic.Analyzers", "src\Roslyn.Diagnostics.Analyzers\VisualBasic\Roslyn.Diagnostics.VisualBasic.Analyzers.vbproj", "{70BBA457-2CC1-4929-8FEE-359EBB7C398A}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Diagnostics.Analyzers.UnitTests", "src\Roslyn.Diagnostics.Analyzers\UnitTests\Roslyn.Diagnostics.Analyzers.UnitTests.csproj", "{D90E7402-70E7-4A95-A292-47EA163D6309}"
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 have removed all Unit Test projects. Not sure if we should remove fewer or more projects.

+done
+
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+"$scriptroot/eng/common/build.sh" --restore --build $@
Copy link
Member Author

Choose a reason for hiding this comment

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

This script is basically a port of Build.cmd which really just calls eng/common/build.ps1 --restore --build.

<_CscToolPath Condition="!HasTrailingSlash('$(_CscToolPath)')">$(_CscToolPath)\</_CscToolPath>
</PropertyGroup>

- <Exec Command='"$(_CscToolPath)csi.exe" "$(RepoRoot)eng\GenerateAnalyzerNuspec.csx" "$(NuspecFile)" "$(AssetsDir)\" "$(MSBuildProjectDirectory)" "$(Configuration)" "$(TargetFrameworksForPackage)" "@(_NuspecMetadata)" "@(AnalyzerNupkgFile)" "@(AnalyzerNupkgFolder)" "@(AnalyzerNupkgAssembly)" "@(AnalyzerNupkgDependency)" "@(AnalyzerNupkgLibrary)" "$(_GeneratedRulesetsDir)" "$(_GeneratedEditorconfigsDir)" "@(AnalyzerLegacyRuleset)" "$(ArtifactsBinDir)\" "$(AnalyzerDocumentationFileDir)" "$(AnalyzerDocumentationFileName)" "$(AnalyzerSarifFileDir)" "$(AnalyzerSarifFileName)" "$(AnalyzerConfigurationFileDir)" "$(AnalyzerConfigurationFileName)" "$(_GeneratedGlobalAnalyzerConfigsDir)"' />
Copy link
Member Author

Choose a reason for hiding this comment

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

csi.exe is not available in the .NET 5 SDK that we are using for building. I ended up "porting" the .csx file to the .cs file. Where porting is just adding imports and wrapping the file contents in a public static void Main(string[] Args).

+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net5.0</TargetFramework>
+ </PropertyGroup>
Copy link
Member Author

Choose a reason for hiding this comment

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

Is there anything I need to do to make sure I am not accidentally using prebuilts here?

Copy link
Member

Choose a reason for hiding this comment

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

In general, even the Microsoft build wants to be able to build a basic app without downloading everything (simple "offline" scenarios) so a clean/basic proj like this should be ok. Looking at the annotated prebuilt report for the project.assets.json of this proj is the way to tell from the end results.

Restore would conclude that there is a cyclic dependency between Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.Analyzers.
-->
- <PackageId>*$(MSBuildProjectFullPath)*</PackageId>
+ <PackageId>*$(MSBuildProjectFullPath.Replace('/', '\\'))*</PackageId>
Copy link
Member Author

@omajid omajid Oct 30, 2020

Choose a reason for hiding this comment

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

As the comment in the original file says, they want to use the file path as the package name.

But when the "package name" (really the full file path with forward slashes on Linux) is put in the assets.json file, it ends up confusing the version parsing logic which thinks "*/home/foo/bar/baz*/4.5.0" has an invalid version along the lines of /home/foo/bar/baz*/4.5.0.

Changing the slashes back to Windows-style slashes makes this work.

Copy link
Member

Choose a reason for hiding this comment

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

Bizarre... can you add this to the code comment? (I imagine this can be upstreamed for compat, and would be nice to have explanation inline. If they don't want to find some other way.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

\ No newline at end of file
+</Project>
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Setup/AnalyzerReleases.Shipped.md b/src/Microsoft.CodeAnalysis.Analyzers/Setup/AnalyzerReleases.Shipped.md
new file mode 100644
Copy link
Member Author

Choose a reason for hiding this comment

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

A standalone build of roslyn-analyzers was failing for me with messages like:

/home/omajid/devel/dotnet/roslyn-analyzers/src/Directory.Build.targets(45,5): error : Create a new empty file named 'AnalyzerReleases.Shipped.md' in the project directory [/home/omajid/devel/dotnet/roslyn-analyzers/src/Roslyn.Diagnostics.Analyzers/Setup/Roslyn.Diagnostics.Analyzers.Setup.csproj]

So I did what it asked 🤷

<RepositoryReference Include="arcade" />
<RepositoryReference Include="command-line-api" />
<RepositoryReference Include="xliff-tasks" />
-->
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 need to figure out the build dependencies of this. I am not sure how to do that.

Copy link
Member

Choose a reason for hiding this comment

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

Basically, look at the prebuilt report and add any dependencies that would be resolved by other repos. (For non-nupkg dependencies you have to just know, but those are limited to a few repos.)

Comment on lines 53 to 54
<!-- DOes this need a coherent parent dependency? -->
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.0-rc1.20428.12">
Copy link
Member

Choose a reason for hiding this comment

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

Always, if possible--sdk has the dependency on roslyn-analyzers:

https://github.com/dotnet/sdk/blob/394fae2553937858c8f05a6158613dcc7f821fba/eng/Version.Details.xml#L176-L179

    <Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.0-rc1.20428.12">
      <Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
      <Sha>e856dc126950463c13226c7437fc7e9fb41442dc</Sha>
    </Dependency>

So here, we can do CoherentParentDependency="Microsoft.NET.Sdk" to link it up.

create mode 100644 src/Text.Analyzers/Setup/AnalyzerReleases.Unshipped.md

diff --git a/FxCopAnalyzers.sln b/FxCopAnalyzers.sln
deleted file mode 100644
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can specify one in the build command... but I think we can defer this improvement.

+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net5.0</TargetFramework>
+ </PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

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

In general, even the Microsoft build wants to be able to build a basic app without downloading everything (simple "offline" scenarios) so a clean/basic proj like this should be ok. Looking at the annotated prebuilt report for the project.assets.json of this proj is the way to tell from the end results.

Restore would conclude that there is a cyclic dependency between Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.Analyzers.
-->
- <PackageId>*$(MSBuildProjectFullPath)*</PackageId>
+ <PackageId>*$(MSBuildProjectFullPath.Replace('/', '\\'))*</PackageId>
Copy link
Member

Choose a reason for hiding this comment

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

Bizarre... can you add this to the code comment? (I imagine this can be upstreamed for compat, and would be nice to have explanation inline. If they don't want to find some other way.)

<RepositoryReference Include="arcade" />
<RepositoryReference Include="command-line-api" />
<RepositoryReference Include="xliff-tasks" />
-->
Copy link
Member

Choose a reason for hiding this comment

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

Basically, look at the prebuilt report and add any dependencies that would be resolved by other repos. (For non-nupkg dependencies you have to just know, but those are limited to a few repos.)

@omajid omajid force-pushed the add-roslyn-analyzers branch 2 times, most recently from 984c3c6 to e0d0e80 Compare November 2, 2020 19:34
Comment on lines 562 to 563
+ <DotNetExecutible Condition="'$(OS)' == 'Windows_NT'">$(DotNetRoot)\dotnet.exe</DotNetExecutible>
+ <DotNetExecutible Condition="'$(DotNetExecutible)' == ''">$(DotNetRoot)/dotnet</DotNetExecutible>
Copy link
Member

Choose a reason for hiding this comment

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

(Nit) DotNetExecutible => DotNetExecutable

But come to think of it, this might be provided already by $(DOTNET_HOST_PATH)... can confirm in the binlog.

No need to reset CI just for this though.

@omajid omajid force-pushed the add-roslyn-analyzers branch 4 times, most recently from cfcf7a4 to 4aea905 Compare November 4, 2020 14:57
Copy link
Member

@dagood dagood left a comment

Choose a reason for hiding this comment

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

LGTM when CI goes green--and heads up that it isn't running yet because there's a merge conflict (probably with the 5.0 GA PR).

@omajid
Copy link
Member Author

omajid commented Nov 4, 2020

Thanks, but the CI wont be going green right now: this is dragging too many new prebuilts.

It looks like roslyn-analzyers depends on multiple versions of roslyn. For example, from a previous CI run:

/tb/tarball_874550/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.Common.1.2.1 [/tb/tarball_874550/repos/known-good.proj]
/tb/tarball_874550/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.Common.2.9.0 [/tb/tarball_874550/repos/known-good.proj]
/tb/tarball_874550/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.Common.3.3.1 [/tb/tarball_874550/repos/known-good.proj]

Full log here.

I will post a longer rant^Wdescription when I have rebased this to master.

@omajid omajid force-pushed the add-roslyn-analyzers branch 3 times, most recently from 7729a74 to 9367c1a Compare November 5, 2020 23:35
@omajid
Copy link
Member Author

omajid commented Nov 5, 2020

I am a bit stumped. Here's the new prebuilts after switching things from netstandard1.3 to netstandard2.0:

/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.3.3.1 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                              
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.Analyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                    
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.BannedApiAnalyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                           
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.Common.3.3.1 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                       
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.CSharp.3.3.1 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                       
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.CSharp.CodeStyle.3.8.0-2.20427.18 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                  
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.CSharp.Workspaces.3.3.1 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                            
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.FxCopAnalyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                               
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.PublicApiAnalyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                           
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.VersionCheckAnalyzer.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                         
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.VisualBasic.3.3.1 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                  
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.VisualBasic.Workspaces.3.3.1 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                       
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.Workspaces.Common.3.3.1 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                            
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeQuality.Analyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                     
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.NetCore.Analyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                         
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.NetFramework.Analyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]                                                                                    
/home/omajid/devel/dotnet/source-build/repos/Directory.Build.targets(553,5): warning : Roslyn.Diagnostics.Analyzers.3.3.0 [/home/omajid/devel/dotnet/source-build/repos/known-good.proj]

One issue is that this repo produces packages like Roslyn.Diagnostics.Analzysers version 3.3.1, but the repo depends on an older version of itself (Roslyn.Diagnostics.Analyzers version 3.3.0). Any ideas how to break these dependencies? Any way to build Roslyn.Diagnostics.Analyzers from this repo first and then use that to build everything else?

We also need packages (such as Microsoft.CodeAnalysis.3.3.1 and Microsoft.CodeAnalysis.Common) that are produced by roslyn (I think).

@dagood
Copy link
Member

dagood commented Nov 6, 2020

One issue is that this repo produces packages like Roslyn.Diagnostics.Analzysers version 3.3.1, but the repo depends on an older version of itself (Roslyn.Diagnostics.Analyzers version 3.3.0).

This seems reasonable--I saw this question on gitter before here and mentioned there:

I suppose they're dogfooding... since they're analyzers I think we should be able to just get rid of them (since it should only be important when you're making changes to the code, not just compiling it)

Otherwise we've got to bootstrap via previously-source-built, like Roslyn itself, I guess.

So for your PR, I'd say don't worry about 3.3.0, we have to wait for an internal build with your changes so we can produce a previously-source-built tarball with 3.3.1, then we can force roslyn-analyzers to use 3.3.1 (to build 3.3.1 for downstream).

The dependency on dotnet/roslyn packages makes sense--it'd want to use the newest versions of the Roslyn APIs to poke around the code and analyze it.

About why they're showing up as prebuilts--dotnet/roslyn-analyzers might be missing the eng/Version.props -> *.csproj prop linkage that would let source-built override what they use with the source-built version of the package. A hard-coded version might be continuing to pull stuff down from online feeds.

@omajid
Copy link
Member Author

omajid commented Nov 6, 2020

A hard-coded version might be continuing to pull stuff down from online feeds.

There's some of that, for sure.

But it also appears like some rolsyn packages are not being built? Microsoft.CodeAnalysis 3.8.0 should have been build as part of roslyn repo, but it's not present. This appears to be a super-package; maybe I can patch roslyn-analzyers to use individual nuget packages?

@dagood
Copy link
Member

dagood commented Nov 6, 2020

But it also appears like some rolsyn packages are not being built? Microsoft.CodeAnalysis 3.8.0 should have been build as part of roslyn repo, but it's not present. This appears to be a super-package; maybe I can patch roslyn-analzyers to use individual nuget packages?

Hmm. It: https://github.com/dotnet/roslyn/blob/4c195c3ac1974edcefa76774d7a59a2350ec55fa/src/NuGet/Microsoft.CodeAnalysis.Package.csproj
appears to be deliberately disabled: https://github.com/dotnet/roslyn/blob/4c195c3ac1974edcefa76774d7a59a2350ec55fa/src/NuGet/Directory.Build.props#L4

But I don't know why. 😕

It seems to me like it'd be reasonable to try patching <ExcludeFromSourceBuild>false</ExcludeFromSourceBuild> into that proj to get rid of the exclusion and try to build it.

@crummel @dseefeld any ideas?

@omajid
Copy link
Member Author

omajid commented Nov 9, 2020

Microsoft.CodeAnalysis is also shipped with the Microsoft-built SDK:

$ tar tf ~/downloads/dotnet-sdk-5.0.100-linux-x64.tar.gz | grep Microsoft.CodeAnalysis.dll
./sdk/5.0.100/Sdks/Microsoft.NET.Sdk.Razor/tools/Microsoft.CodeAnalysis.dll
./sdk/5.0.100/Roslyn/bincore/Microsoft.CodeAnalysis.dll

I can't see the version of the bincore dll, but the Razor/tools version seems to be 3.7.0 (instead of 3.8.0) 😞

$ exiftool ./sdk/5.0.100/Sdks/Microsoft.NET.Sdk.Razor/tools/Microsoft.CodeAnalysis.dll | grep -i version
ExifTool Version Number         : 12.00
Linker Version                  : 48.0
OS Version                      : 4.0
Image Version                   : 0.0
Subsystem Version               : 4.0
File Version Number             : 3.700.20.37502
Product Version Number          : 0.0.0.0
File Version                    : 3.700.20.37502
Product Version                 : 3.7.0-6.20375.2+34202cc2f3e869fd70a26d8237f4552cf9e192cf
Assembly Version                : 3.7.0.0

@dagood
Copy link
Member

dagood commented Nov 9, 2020

Opened #1869 to track down if that's an issue or not. (It doesn't seem (directly) related to this PR to me.)

@omajid omajid force-pushed the add-roslyn-analyzers branch 2 times, most recently from df56774 to fee6e79 Compare November 9, 2020 17:41
@omajid
Copy link
Member Author

omajid commented Nov 9, 2020

The last commit brings the prebuilts down to:

source-build/repos/Directory.Build.targets(553,5): warning : 9 new packages used not in baseline! See report at source-build/artifacts/prebuilt-report/baseline-comparison.xml for more information. Package IDs are: [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.Analyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.BannedApiAnalyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.FxCopAnalyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.PublicApiAnalyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.VersionCheckAnalyzer.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeQuality.Analyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.NetCore.Analyzers.3.3.0 [source-build/repos/known-good.proj]                                                                                         
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.NetFramework.Analyzers.3.3.0 [source-build/repos/known-good.proj]                                                                                    
source-build/repos/Directory.Build.targets(553,5): warning : Roslyn.Diagnostics.Analyzers.3.3.0 [source-build/repos/known-good.proj]

The versions are the dogfood versions.

Microsoft.CodeAnalysis.FxCopAnalyzers, Microsoft.CodeAnalysis.FxCopAnalyzers, Microsoft.NetCore.Analyzers, and Microsoft.NetFramework.Analyzers are built by FxCopAnalyzers.sln. These are not part of the shipped SDK. I (accidentally) removed the FxCopAnalyzsers.sln early on; I am going to re-enable it now and see how things change.

Comment on lines 22 to 25
- <MicrosoftCodeAnalysisVersion>3.8.0</MicrosoftCodeAnalysisVersion>
+ <!-- Source build doesn't produce the Microsoft.CodeAnalysis super-assembly ; use individual packages instead
+ <MicrosoftCodeAnalysisVersion>3.3.1</MicrosoftCodeAnalysisVersion>
+ -->
Copy link
Member

Choose a reason for hiding this comment

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

"Metapackage" was the common term for this kind of package that has no content, only dependencies, when I was working with them in dotnet/runtime. And actually, since it doesn't have an assembly I'd expect it to be easy to add back. Filed #1870 for this.

@omajid
Copy link
Member Author

omajid commented Nov 9, 2020

Microsoft.CodeAnalysis.FxCopAnalyzer has a dependency (seen through artifacts/obj/Microsoft.CodeAnalysis.FxCopAnalyzers.Setup/project.assets.json) on Microsoft.VisualStudio.Shell.* packages, which are all proprietary.

It sounds like we need to break the build chain via SBRP at some point? How do we identify if it's at Microsoft.CodeAnalysis.FxCopAnalyzers+Microsoft.CodeAnalysis.FxCopAnalyzers+Microsoft.NetCore.Analyzers + Microsoft.NetFramework.Analyzers or at Microsoft.VisualStudio.*?

source-build/repos/Directory.Build.targets(553,5): warning : 35 new packages used not in baseline! See report at source-build/artifacts/prebuilt-report/baseline-comparison.xml for more information. Package IDs are: [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.Analyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.BannedApiAnalyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.FxCopAnalyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.PublicApiAnalyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeAnalysis.VersionCheckAnalyzer.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.CodeQuality.Analyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.NetCore.Analyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.NetFramework.Analyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.CoreUtility.15.6.27740 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.CoreUtility.16.0.428 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.ImageCatalog.16.0.28727 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Imaging.16.0.28729 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.26930 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.OLE.Interop.7.10.6071 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.SDK.EmbedInteropTypes.15.0.27 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.15.0.16.0.28729 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Framework.16.0.28729 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.7.10.6072 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.26929 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.15.0.26929 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.15.6.27413 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Text.Data.16.0.428 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.TextManager.Interop.7.10.6071 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Threading.16.0.102 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Utilities.16.0.28729 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Microsoft.VisualStudio.Validation.15.3.15 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Roslyn.Diagnostics.Analyzers.3.3.0 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : StreamJsonRpc.1.5.43 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : System.Net.Http.4.3.3 [source-build/repos/known-good.proj]
source-build/repos/Directory.Build.targets(553,5): warning : Prebuilt usages are different from the baseline. If detected changes are acceptable, update baseline with: [source-build/repos/known-good.proj]

@omajid omajid force-pushed the add-roslyn-analyzers branch from fee6e79 to ca8a857 Compare November 9, 2020 21:08
@dagood
Copy link
Member

dagood commented Nov 9, 2020

Hmm, I would think that since FxCopAnalyzers doesn't end up in the SDK, we can stop building it, which is typically preferable. For anything else, there could be a problem where even though it's not in the SDK, it's executed during some repo build--but since this is an analyzer, we should be able to remove usages without affecting the build output.

(If we did need to execute this analyzer, we probably couldn't replace its dependencies with SBRP-built libraries anyway since they need to actually be runnable. I think in that case we'd be better off removing the dependency from the source and making whatever source removals we need so we can make sure it won't accidentally try to use an unavailable library.)

@omajid omajid force-pushed the add-roslyn-analyzers branch 3 times, most recently from 20a8874 to c643b38 Compare November 11, 2020 14:34
@omajid
Copy link
Member Author

omajid commented Nov 11, 2020

Okay, I have reverted my changes to build FxCop and friends. And I have rebased this on top of #1872.

CI says we are now back to:

/src/repos/Directory.Build.targets(553,5): warning : Prebuilt usages are different from the baseline. If detected changes are acceptable, update baseline with: [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): warning : cp '/src/artifacts/prebuilt-report/generated-new-baseline.xml' '/src/tools-local/prebuilt-baseline-online.xml' [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : 9 new packages used not in baseline! See report at /src/artifacts/prebuilt-report/baseline-comparison.xml for more information. Package IDs are: [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.Analyzers.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.BannedApiAnalyzers.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.FxCopAnalyzers.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.PublicApiAnalyzers.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.CodeAnalysis.VersionCheckAnalyzer.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.CodeQuality.Analyzers.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.NetCore.Analyzers.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Microsoft.NetFramework.Analyzers.3.3.0 [/src/repos/known-good.proj]
/src/repos/Directory.Build.targets(553,5): error : Roslyn.Diagnostics.Analyzers.3.3.0 [/src/repos/known-good.proj]

What are the next steps here?

Should I wait and rebase on top of dotnet/roslyn-analyzers#4419 (and any followups)? Or is this PR okay to go for now?

@dagood
Copy link
Member

dagood commented Nov 11, 2020

The steps are:

  1. Grab Logs centos71_Offline - Prebuilt Reports.
  2. Open it and copy the generated-new-baseline.xml content to tools-local/...baseline... (source-build = "online", tarball = "offline") to add entries that let this PR pass.
  3. Merge PR (on us).
  4. After the internal rolling build runs, we'll take the previously-source-built tar.gz it produces (prev-sb), upload it, and submit a PR to update the repo's prev-sb reference.
  5. In that PR we can remove these baseline entries again since prev-sb provides them.

No need to wait for upstream, the requested changes look nonfunctional to me so far, and we'll have to resolve the patch conflicts later either way. Can fix them up later to make it a more obvious patch removal but we shouldn't wait on that--we need these prebuilts gone. 😄

@omajid omajid force-pushed the add-roslyn-analyzers branch from c643b38 to ff98cac Compare November 11, 2020 19:27
This repo doesn't build out of the box on Linux, so I have added various
build scripts and hacks to get that working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants