Skip to content

Commit

Permalink
Switch to Roslyn component versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Oct 7, 2021
1 parent 39553f2 commit b3cefe4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Refit/Refit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
<None Include="targets\refit.targets" PackagePath="build\netstandard2.0" Pack="true" />

<None Include="..\InterfaceStubGenerator.Roslyn38\bin\$(Configuration)\netstandard2.0\InterfaceStubGeneratorV1.dll"
PackagePath="build\analyzers\roslyn38"
PackagePath="analyzers\dotnet\roslyn3.8\cs"
Pack="true"
Visible="false" />

<None Include="..\InterfaceStubGenerator.Roslyn40\bin\$(Configuration)\netstandard2.0\InterfaceStubGeneratorV2.dll"
PackagePath="build\analyzers\roslyn40"
PackagePath="analyzers\dotnet\roslyn4.0\cs"
Pack="true"
Visible="false" />
</ItemGroup>
Expand Down
14 changes: 0 additions & 14 deletions Refit/targets/refit.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,4 @@
<CompilerVisibleProperty Include="RefitInternalNamespace" />
</ItemGroup>

<Choose>
<!-- TODO: Remove the LangVersion restriction once the incremental source generator APIs stabilize (https://github.com/dotnet/roslyn/issues/55848) -->
<When Condition="$([MSBuild]::VersionGreaterThanOrEquals($(VisualStudioVersion), '17.0')) AND '$(DesignTimeBuild)' == 'True' AND '$(LangVersion)' == 'preview'">
<ItemGroup>
<Analyzer Include="$(MSBuildThisFileDirectory)../../build/analyzers/cs/roslyn40/*.dll" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Analyzer Include="$(MSBuildThisFileDirectory)../../build/analyzers/cs/roslyn38/*.dll" />
</ItemGroup>
</Otherwise>
</Choose>

</Project>
28 changes: 28 additions & 0 deletions Refit/targets/refit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@

</PropertyGroup>

<Target Name="_RefitGatherAnalyzers">
<ItemGroup>
<_RefitAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'Refit'" />
</ItemGroup>
</Target>

<Target Name="_RefitAnalyzerMultiTargeting"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_RefitGatherAnalyzers">

<ItemGroup>
<!-- Remove our analyzers targeting roslyn4.x -->
<Analyzer Remove="@(_RefitAnalyzer)"
Condition="$([System.String]::Copy('%(_RefitAnalyzer.Identity)').IndexOf('roslyn4')) &gt;= 0"/>
</ItemGroup>
</Target>

<Target Name="_RefitRemoveAnalyzers"
Condition="'$(DisableRefitSourceGenerator)' == 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_RefitGatherAnalyzers">

<!-- Remove all our analyzers -->
<ItemGroup>
<Analyzer Remove="@(_RefitAnalyzer)" />
</ItemGroup>
</Target>

<Target Name="_RefitMSBuildVersionCheck"
Condition=" '$([System.Version]::Parse($(_RefitMSBuildMinVersion)).CompareTo($([System.Version]::Parse($(MSBuildVersion)))))' &gt; '0' "
Expand Down

0 comments on commit b3cefe4

Please sign in to comment.