-
-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathSentry.Bindings.Android.csproj
More file actions
160 lines (143 loc) · 11.4 KB
/
Sentry.Bindings.Android.csproj
File metadata and controls
160 lines (143 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(LatestAndroidTfm);$(PreviousAndroidTfm)</TargetFrameworks>
<SentryAndroidSdkVersion>8.34.1</SentryAndroidSdkVersion>
<SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\$(TargetFramework)\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory>
<!-- This gets resolved by the DownloadSentryAndroidSdk unless using local maven references -->
<SentryNativeNdkVersion></SentryNativeNdkVersion>
<Description>.NET Bindings for the Sentry Android SDK</Description>
<!--
Optional dev override: enable to resolve local maven references
Example:
dotnet build -p:UseLocalSentryMavenRepo=true
To populate MavenLocal from your checkout:
cd $(LocalSentryJavaRepoDir) && ./gradlew publishToMavenLocal
cd $(LocalSentryNativeRepoDir)/ndk && ./gradlew publishToMavenLocal
Note:
1. Make sure the native-ndk-version you check out and build matches what the android sdk expects (or a fork of it)
2. You will need to manually set the `SentryNativeNdkVersion` property as this no longer gets resolved from
the POM files from the Java SDK when using local maven artifacts.
-->
<UseLocalSentryMavenRepo>false</UseLocalSentryMavenRepo>
<LocalSentryMavenRepoDir Condition="'$(LocalSentryMavenRepoDir)' == ''">$([System.Environment]::GetFolderPath(SpecialFolder.UserProfile))/.m2/repository/</LocalSentryMavenRepoDir>
<LocalSentryJarPath>$(LocalSentryMavenRepoDir)io/sentry/sentry/$(SentryAndroidSdkVersion)/sentry-$(SentryAndroidSdkVersion).jar</LocalSentryJarPath>
<LocalSentryAndroidCoreAarPath>$(LocalSentryMavenRepoDir)io/sentry/sentry-android-core/$(SentryAndroidSdkVersion)/sentry-android-core-$(SentryAndroidSdkVersion).aar</LocalSentryAndroidCoreAarPath>
<LocalSentryAndroidNdkAarPath>$(LocalSentryMavenRepoDir)io/sentry/sentry-android-ndk/$(SentryAndroidSdkVersion)/sentry-android-ndk-$(SentryAndroidSdkVersion).aar</LocalSentryAndroidNdkAarPath>
<LocalSentryAndroidReplayAarPath>$(LocalSentryMavenRepoDir)io/sentry/sentry-android-replay/$(SentryAndroidSdkVersion)/sentry-android-replay-$(SentryAndroidSdkVersion).aar</LocalSentryAndroidReplayAarPath>
<LocalSentryPomPath>$([System.String]::Copy($(LocalSentryJarPath)).Replace('.jar', '.pom'))</LocalSentryPomPath>
<LocalSentryAndroidCorePomPath>$([System.String]::Copy($(LocalSentryAndroidCoreAarPath)).Replace('.aar', '.pom'))</LocalSentryAndroidCorePomPath>
<LocalSentryAndroidNdkPomPath>$([System.String]::Copy($(LocalSentryAndroidNdkAarPath)).Replace('.aar', '.pom'))</LocalSentryAndroidNdkPomPath>
<LocalSentryAndroidReplayPomPath>$([System.String]::Copy($(LocalSentryAndroidReplayAarPath)).Replace('.aar', '.pom'))</LocalSentryAndroidReplayPomPath>
<LocalSentryNativeNdkAarPath>$(LocalSentryMavenRepoDir)io/sentry/sentry-native-ndk/$(SentryNativeNdkVersion)/sentry-native-ndk-$(SentryNativeNdkVersion).aar</LocalSentryNativeNdkAarPath>
<LocalSentryNativeNdkPomPath>$([System.String]::Copy($(LocalSentryNativeNdkAarPath)).Replace('.aar', '.pom'))</LocalSentryNativeNdkPomPath>
<!-- Android binding warnings - these are largely unavoidable due to Java interface circular dependencies -->
<!-- Only suppress warnings that are confirmed to be expected/unavoidable -->
<!-- BG8801: Invalid parameter types - caused by circular interface dependencies in Sentry Java SDK -->
<!-- BG8C01: Invalid base interface - interfaces reference types removed by Metadata.xml -->
<!-- BG8701: Invalid return types - return types reference unresolvable interfaces -->
<!-- BG8800/BG8700: Unknown/Invalid types - types intentionally removed by Metadata.xml -->
<!-- BG8605/BG8606: Missing Java types - Compose UI types not available in our binding context -->
<!-- BG8604: Missing ancestor types - nested types whose parents are removed -->
<!-- BG8502/BG8503: Interface invalidation - cascade effect from other binding issues -->
<!-- BG8401/BG8400: Field/property conflicts - resolved individually in Metadata.xml where needed -->
<!-- BG8C00: Base interface not found -->
<NoWarn>$(NoWarn);BG8801;BG8C01;BG8701;BG8800;BG8700;BG8605;BG8606;BG8604;BG8502;BG8401;BG8400;BG8503;BG8C00</NoWarn>
<!-- Disable parallel builds to avoid Maven cache conflicts: https://github.com/getsentry/sentry-dotnet/issues/4689 -->
<BuildInParallel>false</BuildInParallel>
</PropertyGroup>
<!-- Use a separate readme, and don't add the changelog to the nuget. -->
<ItemGroup>
<None Remove="$(MSBuildThisFileDirectory)..\..\README.md" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="" />
<!--
Normally we'd put this in a TFM specific directory, however this package only targets one TFM:
https://learn.microsoft.com/en-us/nuget/concepts/msbuild-props-and-targets
-->
<None Include="$(MSBuildThisFileDirectory)build/Sentry.Bindings.Android.targets" Pack="true" PackagePath="build/Sentry.Bindings.Android.targets" />
<None Include="$(MSBuildThisFileDirectory)sentry-proguard.cfg" Pack="true" PackagePath="" />
<PackageReference Remove="SIL.ReleaseTasks" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Sentry" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Testing" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Extensions.Logging.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Maui.Tests" PublicKey="$(SentryPublicKey)" />
</ItemGroup>
<!-- Dependencies for AndroidMavenLibrary references
Matching what was shipped in the 10.0.100 workloads to avoid NU1608 warnings
-->
<ItemGroup Condition="$(TargetFramework.StartsWith('net10'))">
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.9.2.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common.Java8" Version="2.9.2.1" />
<!-- MAUI 10 references this version indirectly via Xamarin.AndroidX.SwipeRefreshLayout -->
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.17.0" />
<!-- We have a dependency on 1.9.24 from here:
https://github.com/getsentry/sentry-java/blob/604a2616bebd80ea051cdcec916aa052b509c5a8/buildSrc/src/main/java/Config.kt#L6-L7
... but there's no NuGet package for that version. This version has been selected to
match the version that was available when net10.0 was released -->
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="2.2.20" />
</ItemGroup>
<!-- Dependencies for AndroidMavenLibrary references
Matching what was shipped in the 9.0.300 workloads to avoid NU1608 warnings
-->
<ItemGroup Condition="$(TargetFramework.StartsWith('net9'))">
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.8.7.2" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common.Java8" Version="2.8.7.2" />
<!-- MAUI 9 references this version indirectly via Xamarin.AndroidX.SwipeRefreshLayout -->
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.15.0.2" />
<!-- We need 1.9.24 but there's no NuGet package for that version... the lowest version we can use is 2.0.0 -->
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="2.0.0" />
</ItemGroup>
<!-- Starting with .NET 9 we can detect Java dependencies using POM files and AndroidMavenLibrary references -->
<ItemGroup Condition="'$(UseLocalSentryMavenRepo)' != 'true'">
<AndroidMavenLibrary Include="io.sentry:sentry" Version="$(SentryAndroidSdkVersion)" />
<AndroidMavenLibrary Include="io.sentry:sentry-android-core" Version="$(SentryAndroidSdkVersion)" />
<AndroidMavenLibrary Include="io.sentry:sentry-android-ndk" Version="$(SentryAndroidSdkVersion)" />
<AndroidMavenLibrary Include="io.sentry:sentry-android-replay" Version="$(SentryAndroidSdkVersion)" />
</ItemGroup>
<!-- Resolve Java dependencies from local sentry-java build outputs instead, if appropriate -->
<ItemGroup Condition="'$(UseLocalSentryMavenRepo)' == 'true'">
<AndroidLibrary Include="$(LocalSentryJarPath)" Manifest="$(LocalSentryPomPath)"
JavaArtifact="io.sentry:sentry:$(SentryAndroidSdkVersion)" />
<AndroidLibrary Include="$(LocalSentryAndroidCoreAarPath)" Manifest="$(LocalSentryAndroidCorePomPath)"
JavaArtifact="io.sentry:sentry-android-core:$(SentryAndroidSdkVersion)" />
<AndroidLibrary Include="$(LocalSentryAndroidNdkAarPath)" Manifest="$(LocalSentryAndroidNdkPomPath)"
JavaArtifact="io.sentry:sentry-android-ndk:$(SentryAndroidSdkVersion)" />
<AndroidLibrary Include="$(LocalSentryAndroidReplayAarPath)" Manifest="$(LocalSentryAndroidReplayPomPath)"
JavaArtifact="io.sentry:sentry-android-replay:$(SentryAndroidSdkVersion)" />
<AndroidLibrary Include="$(LocalSentryNativeNdkAarPath)" Manifest="$(LocalSentryNativeNdkPomPath)"
JavaArtifact="io.sentry:sentry-native-ndk:$(SentryNativeNdkVersion)" />
</ItemGroup>
<!-- protobuf-javalite 3.25.8 has no matching/compatible Xamarin.Protobuf.JavaLite NuGet package
(see https://github.com/getsentry/sentry-java/pull/5044) -->
<ItemGroup>
<AndroidMavenLibrary Include="com.google.protobuf:protobuf-javalite" Version="3.25.8" Bind="false" />
</ItemGroup>
<ItemGroup>
<AndroidLibrary Include="..\..\lib\sentry-android-supplemental\bin\sentry-android-supplemental.jar" />
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\arm64-v8a\libsentrysupplemental.so" Abi="arm64-v8a" />
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\armeabi-v7a\libsentrysupplemental.so" Abi="armeabi-v7a" />
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\x86\libsentrysupplemental.so" Abi="x86" />
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\x86_64\libsentrysupplemental.so" Abi="x86_64" />
</ItemGroup>
<Target Name="DownloadSentryAndroidSdk" BeforeTargets="CollectPackageReferences" Condition="'$(UseLocalSentryMavenRepo)' != 'true'">
<!-- The native-ndk exists outside of the android-ndk now. We're downloading the POM file to get the version of the native-ndk. -->
<DownloadFile
SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-android-ndk/$(SentryAndroidSdkVersion)/sentry-android-ndk-$(SentryAndroidSdkVersion).pom"
DestinationFolder="$(SentryAndroidSdkDirectory)"
Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).pom')"
Retries="3"
/>
<XmlPeek
XmlInputPath="$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).pom"
Query="//*[local-name()='dependency' and .//*[local-name()='artifactId' and text()='sentry-native-ndk']]/*[local-name()='version']/text()"
Condition="Exists('$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).pom')">
<Output TaskParameter="Result" PropertyName="SentryNativeNdkVersion" />
</XmlPeek>
<ItemGroup Condition="'$(SentryNativeNdkVersion)' != ''">
<AndroidMavenLibrary Include="io.sentry:sentry-native-ndk" Version="$(SentryNativeNdkVersion)" />
</ItemGroup>
</Target>
<UsingTask TaskName="XmlPeek" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</Project>