Skip to content
Merged
17 changes: 6 additions & 11 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@
</PropertyGroup>

<!--
Note: The following platform-specific properties need to be set in both Directory.Build.props and DirectoryBuild.targets.
Note: The following platform-specific properties need to be set in both Directory.Build.props and Directory.Build.targets.
TODO: Figure out how to consolidate to a single location.
- Directory.Build.props will get imported at the beginning of the project files, so sets properties that are
prerequisites for the build and can be overriden in the project files.
- Directory.Build.targets will get imported at the end of the project files, so can be used to run common custom
tasks or ultimately override properties set in Directory.Build.props or the project files.
Note: I don't believe we need to set these in the Directory.Build.targets file.
See: https://github.com/jamescrosswell/msbuild-test-4275
-->
<PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' != ''">
<TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'ios'">12.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetPlatformIdentifier)' == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
Expand Down Expand Up @@ -111,9 +109,6 @@
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" PublicKey="0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />
</ItemGroup>

<!-- Helpful properties used elsewhere -->
<PropertyGroup>
<TargetFrameworkVersion>$([MSBuild]::GetTargetFrameworkVersion($(TargetFramework)))</TargetFrameworkVersion>
<TargetFrameworkIsNet9OrGreater Condition="$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 9.0))">true</TargetFrameworkIsNet9OrGreater>
</PropertyGroup>
<!-- Definitions that we want available both for local developement and building transitively -->
<Import Project="$(MSBuildThisFileDirectory)\src\Sentry\buildTransitive\Sentry.props" />
</Project>
4 changes: 2 additions & 2 deletions src/Sentry/Platforms/Native/Sentry.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</None>
</ItemGroup>

<Target Name="CleanNativeSDK" BeforeTargets="CoreClean" Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0'">
<Target Name="CleanNativeSDK" BeforeTargets="CoreClean" Condition="'$(IsNet8OrGreater)' == 'true'">
<Message Text="Inside Custom Clean" Importance="high"/>
<RemoveDir Directories="$(SentryNativeOutputDirectory)" />
<RemoveDir Directories="$(SentryNativeSourceDirectory)build" />
Expand All @@ -86,7 +86,7 @@
built already on each native platform and fetched for the final .net build. -->
<Target Name="_BuildSentryNativeSDK"
BeforeTargets="DispatchToInnerBuilds;BeforeBuild"
Condition="('$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0') and '$(CI)' != 'true'"
Condition="'$(IsNet8OrGreater)' == 'true' and '$(CI)' != 'true'"
Inputs="$(SentryNativeBuildInputs)"
Outputs="$(SentryNativeBuildOutputs)">
<!-- We want a "-Clean" because if the build script changes, previous cmake cache may contain invalid defines. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<PropertyGroup>
<!-- net8.0 or greater -->
<FrameworkSupportsNative Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</FrameworkSupportsNative>
<FrameworkSupportsNative Condition="'$(IsNet8OrGreater)' == 'true' and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</FrameworkSupportsNative>
<!-- Make it opt-out -->
<FrameworkSupportsNative Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'">false</FrameworkSupportsNative>
</PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
</ItemGroup>

<ItemGroup>
<None Include="buildTransitive\Sentry.props" Pack="true" PackagePath="buildTransitive\Sentry.props" />
<None Include="buildTransitive\Sentry.props" Pack="true" PackagePath="build\Sentry.props" />
<None Include="buildTransitive\Sentry.targets" Pack="true" PackagePath="buildTransitive\Sentry.targets" />
<None Include="buildTransitive\Sentry.targets" Pack="true" PackagePath="build\Sentry.targets" />
<None Include="buildTransitive\Sentry.SourceGenerators.targets" Pack="true" PackagePath="buildTransitive\Sentry.SourceGenerators.targets" />
Expand Down
9 changes: 9 additions & 0 deletions src/Sentry/buildTransitive/Sentry.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Helpful properties used elsewhere -->
<PropertyGroup Condition="'$(TargetFramework)' != ''">
<TargetFrameworkVersion>$([MSBuild]::GetTargetFrameworkVersion($(TargetFramework)))</TargetFrameworkVersion>
<IsNet8OrGreater>$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 8.0))</IsNet8OrGreater>
<IsNet9OrGreater>$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 9.0))</IsNet9OrGreater>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<!-- Visual tests need net9.0+ mobile and are flaky when using the headless runner on CI -->
<EnableMauiDeviceTestVisualRunner>false</EnableMauiDeviceTestVisualRunner>
<EnableMauiDeviceTestVisualRunner Condition="'$(TargetFrameworkIsNet9OrGreater)' == 'true' AND '$(PlatformIsMobile)' == 'true' AND '$(ContinuousIntegrationBuild)' != 'true'">true</EnableMauiDeviceTestVisualRunner>
<EnableMauiDeviceTestVisualRunner Condition="'$(IsNet9OrGreater)' == 'true' AND '$(PlatformIsMobile)' == 'true' AND '$(ContinuousIntegrationBuild)' != 'true'">true</EnableMauiDeviceTestVisualRunner>
</PropertyGroup>
<!--
Workaround for Verify issue with scrubbing when running in Rider on Windows.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<ProjectReference Include="..\Sentry.Tests\Sentry.Tests.csproj"/>
<ProjectReference Include="..\Sentry.Extensions.Logging.Tests\Sentry.Extensions.Logging.Tests.csproj"/>
<ProjectReference Include="..\Sentry.Maui.Tests\Sentry.Maui.Tests.csproj"/>
<ProjectReference Include="..\Sentry.Maui.CommunityToolkit.Mvvm.Tests\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj" Condition="'$(TargetFrameworkIsNet9OrGreater)' == 'true'"/>
<ProjectReference Include="..\Sentry.Maui.CommunityToolkit.Mvvm.Tests\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj" Condition="'$(IsNet9OrGreater)' == 'true'"/>
</ItemGroup>

</Project>
Loading