Skip to content

Commit 3c985f2

Browse files
committed
Try whitelisting supported runtimes
1 parent 17a5d73 commit 3c985f2

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
<!-- SentryNative.IsEnabled should result in compile-time constant for trimmed applications -->
1414
<!-- Effectively disabling native library -->
1515
<RuntimeHostConfigurationOption Include="Sentry.Native.IsEnabled"
16-
Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'"
17-
Value="false"
16+
Value="$(_SentryNativeEnabled)"
1817
Trim="true" />
1918
</ItemGroup>
2019

@@ -32,6 +31,25 @@
3231
<FrameworkSupportsNative Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'">false</FrameworkSupportsNative>
3332
</PropertyGroup>
3433

34+
<!-- Whitelist supported runtimes -->
35+
<Choose>
36+
<When Condition="'$(FrameworkSupportsNative)' == 'true'">
37+
<PropertyGroup>
38+
<!-- Windows -->
39+
<_SentryNativeEnabled Condition="'$(RuntimeIdentifier)' == 'win-x64' or '$(RuntimeIdentifier)' == 'win-arm64'">true</_SentryNativeEnabled>
40+
<!-- Linux -->
41+
<_SentryNativeEnabled Condition="'$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64' or '$(RuntimeIdentifier)' == 'linux-musl-x64'">true</_SentryNativeEnabled>
42+
<!-- macOS -->
43+
<_SentryNativeEnabled Condition="'$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64'">true</_SentryNativeEnabled>
44+
</PropertyGroup>
45+
</When>
46+
<Otherwise>
47+
<PropertyGroup>
48+
<_SentryNativeEnabled>false</_SentryNativeEnabled>
49+
</PropertyGroup>
50+
</Otherwise>
51+
</Choose>
52+
3553
<ItemGroup Condition="'$(FrameworkSupportsNative)' == 'true' and ('$(RuntimeIdentifier)' == 'win-x64' or '$(RuntimeIdentifier)' == 'win-arm64')">
3654
<DirectPInvoke Include="sentry-native" />
3755
<NativeLibrary Include="$(MSBuildThisFileDirectory)..\sentry-native\$(RuntimeIdentifier)\sentry-native.lib" />

0 commit comments

Comments
 (0)