Skip to content

Commit 150814e

Browse files
authored
Use SBRP version of M.CA for analyzers in the context of source build (#78668)
1 parent 5623c07 commit 150814e

File tree

1 file changed

+62
-44
lines changed

1 file changed

+62
-44
lines changed

eng/Versions.props

Lines changed: 62 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -96,56 +96,74 @@
9696
<!--
9797
Microsoft.CodeAnalysis.* versions used by the RoslynAnalyzers.
9898
-->
99-
<PropertyGroup>
100-
<!-- Microsoft.CodeAnalysis.* versions. Read this!
101-
This repo uses a wide variety of M.CA.* package versions. This is an atypical pattern in
102-
.NET's repositories but a necessary one for roslyn-analyzers.
99+
<Choose>
100+
<When Condition="'$(DotNetBuildSourceOnly)' != 'true'">
101+
<PropertyGroup>
102+
<!-- Microsoft.CodeAnalysis.* versions. Read this!
103+
This repo uses a wide variety of M.CA.* package versions. This is an atypical pattern in
104+
.NET's repositories but a necessary one for roslyn-analyzers.
103105
104-
Some facts:
105-
- These versions are chosen on purpose.
106-
- They often represent the base required surface area of Microsoft.CA to support for a given feature or analyzer.
107-
This means that the analyzer would be supported in the widest array of C# compilation scenarios.
108-
- Most of these dependencies only represent target surface area. In some cases, the M.CA libraries are
109-
redistributed (tools) or used within the build.
110-
- Some of these versions are used for testing to ensure that analyzers built against older surface area
111-
still work against new implementations.
112-
- Linux source-build only builds a single implementation of M.CA.*.
113-
- Linux source-build does have some ability to provide surface area packages via the source-build-reference-packages repo.
114-
However, because these reference packages do not provide implementations, they cannot be used in any case
115-
where the package contents would be redisted or executed. An SBRP may not be created for a version that is used both
116-
as a reference assembly and redisted.
106+
Some facts:
107+
- These versions are chosen on purpose.
108+
- They often represent the base required surface area of Microsoft.CA to support for a given feature or analyzer.
109+
This means that the analyzer would be supported in the widest array of C# compilation scenarios.
110+
- Most of these dependencies only represent target surface area. In some cases, the M.CA libraries are
111+
redistributed (tools) or used within the build.
112+
- Some of these versions are used for testing to ensure that analyzers built against older surface area
113+
still work against new implementations.
114+
- Linux source-build only builds a single implementation of M.CA.*.
115+
- Linux source-build does have some ability to provide surface area packages via the source-build-reference-packages repo.
116+
However, because these reference packages do not provide implementations, they cannot be used in any case
117+
where the package contents would be redisted or executed. An SBRP may not be created for a version that is used both
118+
as a reference assembly and redisted.
117119
118-
In this repo, the MicrosoftCodeAnalysis property should **not** be set globally in this file. Instead, it should
119-
be set for each project, based on the properties below. When the project is executable, it should be
120-
set only for non-source build or repo-source build. Product source build will set an incoming MicrosoftCodeAnalysis property
121-
that will denote the available implementation version.
120+
In this repo, the MicrosoftCodeAnalysis property should **not** be set globally in this file. Instead, it should
121+
be set for each project, based on the properties below. When the project is executable, it should be
122+
set only for non-source build or repo-source build. Product source build will set an incoming MicrosoftCodeAnalysis property
123+
that will denote the available implementation version.
122124
123-
Example of surface area usage:
125+
Example of surface area usage:
124126
125-
<MicrosoftCodeAnalysisVersion Condition="'$(MicrosoftCodeAnalysisVersion)' == ''">$(MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers)</MicrosoftCodeAnalysisVersion>
127+
<MicrosoftCodeAnalysisVersion>$(MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers)</MicrosoftCodeAnalysisVersion>
126128
127-
Example of executable usage:
129+
Example of executable usage:
128130
129-
<MicrosoftCodeAnalysisVersion Condition="'$(MicrosoftCodeAnalysisVersion)' == ''">$(MicrosoftCodeAnalysisVersionForExecution)</MicrosoftCodeAnalysisVersion>
130-
-->
131-
<!-- Microsoft.CodeAnalysis versions for different purposes. -->
132-
<!-- Surface area that various projects compile against. These should have source-build reference packages -->
133-
<MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>3.11.0</MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>
134-
<MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>1.2.1</MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>
135-
<MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>
136-
<MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>
137-
<MicrosoftCodeAnalysisVersionForResxSourceGenerators>4.0.1</MicrosoftCodeAnalysisVersionForResxSourceGenerators>
138-
<MicrosoftCodeAnalysisVersionForNetAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForNetAnalyzers>
139-
<MicrosoftCodeAnalysisVersionForTextAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForTextAnalyzers>
140-
<MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>
141-
<MicrosoftCodeAnalysisVersionForToolsAndUtilities>3.11.0</MicrosoftCodeAnalysisVersionForToolsAndUtilities>
142-
<MicrosoftCodeAnalysisVersionForMetrics>4.0.1</MicrosoftCodeAnalysisVersionForMetrics>
143-
<!-- Versions for tests and general utility execution. -->
144-
<!-- This version is for utility and executable assemblies. The version here should not overlap with any of the surface
145-
area versions. -->
146-
<MicrosoftCodeAnalysisVersionForTests>4.9.0-3.final</MicrosoftCodeAnalysisVersionForTests>
147-
<MicrosoftCodeAnalysisVersionForExecution>4.6.0-1.final</MicrosoftCodeAnalysisVersionForExecution>
148-
</PropertyGroup>
131+
<MicrosoftCodeAnalysisVersion>$(MicrosoftCodeAnalysisVersionForExecution)</MicrosoftCodeAnalysisVersion>
132+
-->
133+
<!-- Microsoft.CodeAnalysis versions for different purposes. -->
134+
<!-- Surface area that various projects compile against. These should have source-build reference packages -->
135+
<MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>3.11.0</MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>
136+
<MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>1.2.1</MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>
137+
<MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>
138+
<MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>
139+
<MicrosoftCodeAnalysisVersionForResxSourceGenerators>4.0.1</MicrosoftCodeAnalysisVersionForResxSourceGenerators>
140+
<MicrosoftCodeAnalysisVersionForTextAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForTextAnalyzers>
141+
<MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>
142+
<MicrosoftCodeAnalysisVersionForToolsAndUtilities>3.11.0</MicrosoftCodeAnalysisVersionForToolsAndUtilities>
143+
<MicrosoftCodeAnalysisVersionForMetrics>4.0.1</MicrosoftCodeAnalysisVersionForMetrics>
144+
<!-- Versions for tests and general utility execution. -->
145+
<!-- This version is for utility and executable assemblies. The version here should not overlap with any of the surface
146+
area versions. -->
147+
<MicrosoftCodeAnalysisVersionForTests>4.9.0-3.final</MicrosoftCodeAnalysisVersionForTests>
148+
<MicrosoftCodeAnalysisVersionForExecution>4.6.0-1.final</MicrosoftCodeAnalysisVersionForExecution>
149+
</PropertyGroup>
150+
</When>
151+
<Otherwise>
152+
<PropertyGroup>
153+
<MicrosoftCodeAnalysisVersionFromSbrp>4.0.1</MicrosoftCodeAnalysisVersionFromSbrp>
154+
<MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>
155+
<MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>
156+
<MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>
157+
<MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>
158+
<MicrosoftCodeAnalysisVersionForResxSourceGenerators>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForResxSourceGenerators>
159+
<MicrosoftCodeAnalysisVersionForTextAnalyzers>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForTextAnalyzers>
160+
<MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>
161+
<MicrosoftCodeAnalysisVersionForToolsAndUtilities>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForToolsAndUtilities>
162+
<MicrosoftCodeAnalysisVersionForMetrics>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForMetrics>
163+
<MicrosoftCodeAnalysisVersionForTests>$(MicrosoftCodeAnalysisVersionFromSbrp)</MicrosoftCodeAnalysisVersionForTests>
164+
</PropertyGroup>
165+
</Otherwise>
166+
</Choose>
149167
<PropertyGroup>
150168
<UsingToolVSSDK Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</UsingToolVSSDK>
151169
<UsingToolPdbConverter>false</UsingToolPdbConverter>

0 commit comments

Comments
 (0)