Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Refactor sourcegen references from Samples into Directory.* files
  • Loading branch information
jamescrosswell committed Jul 8, 2025
commit cbb85b22e92f28765bdb55f6bcf3d2aebd0fa6e6
6 changes: 6 additions & 0 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>
</ItemGroup>

<!-- Workaround for hang on compile issue. See https://github.com/xamarin/xamarin-macios/issues/17825#issuecomment-1478568270. -->
<PropertyGroup Condition="'$(Configuration)' == 'Release' And $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<MtouchUseLlvm>false</MtouchUseLlvm>
Expand Down
1 change: 1 addition & 0 deletions samples/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Import Project="$(MSBuildThisFileDirectory)..\src\Sentry.Bindings.Cocoa\buildTransitive\Sentry.Bindings.Cocoa.targets"
Condition="'$(OutputType)' == 'Exe' And ('$(TargetPlatformIdentifier)' == 'ios' Or '$(TargetPlatformIdentifier)' == 'maccatalyst')" />
<Import Project="$(MSBuildThisFileDirectory)..\src\Sentry\Platforms\Native\buildTransitive\Sentry.Native.targets" />
<Import Project="$(MSBuildThisFileDirectory)..\src\Sentry\buildTransitive\Sentry.SourceGenerators.targets" />
Copy link
Member

Choose a reason for hiding this comment

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

note: We deleted Sentry.SourceGenerators.targets in #4333.

It was redundant in the NuGet package, as only Sentry.props and Sentry.targets are automatically picked up in consuming projects (via PackageReference), and Sentry.SourceGenerators.targets was never Imported in any of these MSBuild files either.


<Target Name="GenerateSharedDsnConstant"
BeforeTargets="BeforeCompile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
<Using Include="Android.App.Activity" Alias="Activity" />

Expand Down Expand Up @@ -42,7 +39,4 @@
<PublishTrimmed>true</PublishTrimmed>
<AndroidLinkMode>full</AndroidLinkMode>
</PropertyGroup>

<!--In order to test our analyzers with this project, we manually reference our targets file. User do not need to do this-->
<Import Project="..\..\src\Sentry\buildTransitive\Sentry.SourceGenerators.targets" />
</Project>
6 changes: 0 additions & 6 deletions samples/Sentry.Samples.Ios/Sentry.Samples.Ios.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,5 @@
<ItemGroup>
<!-- <PackageReference Include="Sentry" Version="..." /> -->
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>
</ItemGroup>

<!--In order to test our analyzers with this project, we manually reference our targets file. User do not need to do this-->
<Import Project="..\..\src\Sentry\buildTransitive\Sentry.SourceGenerators.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,5 @@
<ItemGroup>
<!-- <PackageReference Include="Sentry" Version="..." /> -->
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
<ProjectReference Include="..\..\src\Sentry.SourceGenerators\Sentry.SourceGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>
</ItemGroup>

<!--In order to test our analyzers with this project, we manually reference our targets file. User do not need to do this-->
<Import Project="..\..\src\Sentry\buildTransitive\Sentry.SourceGenerators.targets" />
</Project>
3 changes: 0 additions & 3 deletions samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,4 @@
<!-- Check SDK users will be able to resolve the latest version of CommunityToolkit.Mvvm (our Integration targets 8.3.2 -->
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
</ItemGroup>

<!--In order to test our analyzers with this project, we manually reference our targets file. User do not need to do this-->
<Import Project="..\..\src\Sentry\buildTransitive\Sentry.SourceGenerators.targets" />
</Project>