Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion src/Sentry.Bindings.Android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Instead, reference one of the following:

## SDK Developers and Contributors

For .NET SDK contributors, most of the classes in this package are generated automatically.
For .NET SDK contributors, most of the classes in this package are generated automatically. These can be found in the `src/Sentry.Bindings.Android/obj/{Configuration}/{tfm}/generated/src/` folder after building the project.

- Post generation transformations are controlled via various XML files stored in the `/Transforms` directory (see [Java Bindings Metadata documentation](https://learn.microsoft.com/en-gb/previous-versions/xamarin/android/platform/binding-java-library/customizing-bindings/java-bindings-metadata) for details).

Expand Down
58 changes: 55 additions & 3 deletions src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,33 @@
<TargetFrameworks>$(LatestAndroidTfm);$(PreviousAndroidTfm)</TargetFrameworks>
<SentryAndroidSdkVersion>8.29.0</SentryAndroidSdkVersion>
<SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\$(TargetFramework)\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory>
<!-- This gets resolved by the DownloadSentryAndroidSdk target -->
<!-- This gets resolved by the DownloadSentryAndroidSdk and ResolveSentryNativeNdkFromLocalMaven targets -->
<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 that you may need to check out specific branches/tags to match the version defined in SentryAndroidSdkVersion
and the resulting native ndk version.
-->
<UseLocalSentryMavenRepo>false</UseLocalSentryMavenRepo>
<LocalSentryMavenRepoDir Condition="'$(LocalSentryMavenRepoDir)' == ''">$(HOME)/.m2/repository/</LocalSentryMavenRepoDir>
Comment thread
jamescrosswell marked this conversation as resolved.
Outdated
<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>

<!-- 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 -->
Expand Down Expand Up @@ -73,13 +96,25 @@
</ItemGroup>

<!-- Starting with .NET 9 we can detect Java dependencies using POM files and AndroidMavenLibrary references -->
<ItemGroup>
<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)" />
</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" />
Expand All @@ -88,7 +123,7 @@
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\x86_64\libsentrysupplemental.so" Abi="x86_64" />
</ItemGroup>

<Target Name="DownloadSentryAndroidSdk" BeforeTargets="CollectPackageReferences">
<Target Name="DownloadSentryAndroidSdk" BeforeTargets="CollectPackageReferences" Condition="'$(UseLocalSentryMavenRepo)' != 'true'">
Comment thread
sentry[bot] marked this conversation as resolved.
<!-- 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"
Expand All @@ -109,5 +144,22 @@
</ItemGroup>
</Target>

<Target Name="ResolveSentryNativeNdkFromLocalMaven" BeforeTargets="CollectPackageReferences" Condition="'$(UseLocalSentryMavenRepo)' == 'true'">
<PropertyGroup>
<_LocalAndroidNdkPom>$(LocalSentryMavenRepoDir)io/sentry/sentry-android-ndk/$(SentryAndroidSdkVersion)/sentry-android-ndk-$(SentryAndroidSdkVersion).pom</_LocalAndroidNdkPom>
</PropertyGroup>
Comment thread
jamescrosswell marked this conversation as resolved.
Outdated

<XmlPeek
XmlInputPath="$(_LocalAndroidNdkPom)"
Query="//*[local-name()='dependency' and .//*[local-name()='artifactId' and text()='sentry-native-ndk']]/*[local-name()='version']/text()"
Condition="Exists('$(_LocalAndroidNdkPom)')">
<Output TaskParameter="Result" PropertyName="SentryNativeNdkVersion" />
</XmlPeek>

<ItemGroup Condition="'$(SentryNativeNdkVersion)' != ''">
<AndroidMavenLibrary Include="io.sentry:sentry-native-ndk" Version="$(SentryNativeNdkVersion)" />
</ItemGroup>
Comment thread
jamescrosswell marked this conversation as resolved.
Outdated
</Target>

<UsingTask TaskName="XmlPeek" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</Project>
2 changes: 1 addition & 1 deletion src/Sentry.Bindings.Android/Transforms/Metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
-->
<remove-node path="/api/package[@name='io.sentry']/interface[@name='BackfillingEventProcessor']" />
<remove-node path="/api/package[@name='io.sentry.android.core']/class[@name='AnrV2EventProcessor']" />

<!--
SentryEvent.serialize() expects an parameter which implements IObjectWriter.
JsonObjectWriter implements IObjectWriter in Java, but somehow this is not reflected in the generated binding.
Expand Down
Loading