Skip to content

Commit

Permalink
Improve shared .props to manage analyzer projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Oct 1, 2023
1 parent 875e0c3 commit 2daca71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions build/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,13 @@
<ProjectDirectoryPathFromSourceRoot>$([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)..\', $(MSBuildProjectDirectory)))</ProjectDirectoryPathFromSourceRoot>
<IsPublishedProject>$(ProjectDirectoryPathFromSourceRoot.StartsWith('src\'))</IsPublishedProject>
<IsSourceGeneratorProject>false</IsSourceGeneratorProject>
<IsSourceGeneratorProject Condition="$(IsPublishedProject) AND ($(MSBuildProjectName.EndsWith('.SourceGenerators')) OR $(MSBuildProjectName.EndsWith('.CodeFixers')))">true</IsSourceGeneratorProject>
<IsSourceGeneratorProject Condition="$(IsPublishedProject) AND $(MSBuildProjectName.EndsWith('.SourceGenerators'))">true</IsSourceGeneratorProject>
<IsCodeFixersProject>false</IsCodeFixersProject>
<IsCodeFixersProject Condition="$(IsPublishedProject) AND $(MSBuildProjectName.EndsWith('.CodeFixers'))">true</IsCodeFixersProject>
<IsAnalyzersProject>false</IsAnalyzersProject>
<IsAnalyzersProject Condition="$(IsSourceGeneratorProject) OR $(IsCodeFixersProject)">true</IsAnalyzersProject>
<IsPackagedProject>false</IsPackagedProject>
<IsPackagedProject Condition="$(IsPublishedProject) AND !$(IsSourceGeneratorProject)">true</IsPackagedProject>
<IsPackagedProject Condition="$(IsPublishedProject) AND !$(IsAnalyzersProject)">true</IsPackagedProject>
<IsTestProject>$(ProjectDirectoryPathFromSourceRoot.StartsWith('tests\'))</IsTestProject>
<IsInternalsTestProject>false</IsInternalsTestProject>
<IsInternalsTestProject Condition="$(IsTestProject) AND $(MSBuildProjectName.EndsWith('.Internals'))">true</IsInternalsTestProject>
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
<!-- Additional properties for all source projects-->
<PropertyGroup>

<!-- Disable packing symbols for source generators -->
<PackSymbols Condition="$(IsSourceGeneratorProject)">false</PackSymbols>
<!-- Disable packing symbols for all analyzers -->
<PackSymbols Condition="$(IsAnalyzersProject)">false</PackSymbols>

<!-- Enable extended analyzer rules for all source generators -->
<EnforceExtendedAnalyzerRules Condition="$(IsSourceGeneratorProject)">true</EnforceExtendedAnalyzerRules>
<!-- Enable extended analyzer rules for all analyzers -->
<EnforceExtendedAnalyzerRules Condition="$(IsAnalyzersProject)">true</EnforceExtendedAnalyzerRules>

<!-- Check whether the project has a .targets file to bundle -->
<IsTargetsFileAvailableForPacking>false</IsTargetsFileAvailableForPacking>
Expand Down

0 comments on commit 2daca71

Please sign in to comment.