Skip to content
Merged
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
Prev Previous commit
Next Next commit
comments
  • Loading branch information
bitsandfoxes committed Apr 2, 2025
commit dbc8403d6a707a6be04dd5bf901d70b9fde73f25
14 changes: 4 additions & 10 deletions src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<NoWarn>$(NoWarn);BG8605;BG8606</NoWarn>
<SentryAndroidSdkVersion>8.6.0</SentryAndroidSdkVersion>
<SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory>
<!-- This gets resolved by the DownloadSentryAndroidSdk target -->
<SentryNativeNdkVersion></SentryNativeNdkVersion>
<Description>.NET Bindings for the Sentry Android SDK</Description>
</PropertyGroup>
Expand Down Expand Up @@ -41,7 +42,7 @@
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\x86_64\libsentrysupplemental.so" Abi="x86_64" />
</ItemGroup>

<Target Name="DownloadSentryAndroidSdk" BeforeTargets="ResolveAssemblyReferences">
<Target Name="DownloadSentryAndroidSdk" BeforeTargets="CollectPackageReferences">
<DownloadFile
SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-android-core/$(SentryAndroidSdkVersion)/sentry-android-core-$(SentryAndroidSdkVersion).aar"
DestinationFolder="$(SentryAndroidSdkDirectory)"
Expand All @@ -60,40 +61,33 @@
Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-$(SentryAndroidSdkVersion).jar')"
Retries="3"
/>
<!-- Download the POM file -->
<!-- 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"
/>

<!-- Read the POM file and extract the sentry-native-ndk version -->
<XmlPeek
Copy link
Member

Choose a reason for hiding this comment

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

TIL

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>

<Message Text="Found Sentry Native NDK version: $(SentryNativeNdkVersion)" Importance="high"
Condition="'$(SentryNativeNdkVersion)' != ''" />

<!-- Download the sentry-native-ndk dependency if version was found -->
<DownloadFile
SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-native-ndk/$(SentryNativeNdkVersion)/sentry-native-ndk-$(SentryNativeNdkVersion).aar"
DestinationFolder="$(SentryAndroidSdkDirectory)"
Condition="'$(SentryNativeNdkVersion)' != '' And !Exists('$(SentryAndroidSdkDirectory)sentry-native-ndk-$(SentryNativeNdkVersion).aar')"
Retries="3"
/>

<!-- Create an item for the downloaded sentry-native-ndk -->
<!-- Since we're reading the version from the POM file, we need to create an item for the downloaded sentry-native-ndk -->
<ItemGroup Condition="'$(SentryNativeNdkVersion)' != ''">
<AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-native-ndk-$(SentryNativeNdkVersion).aar" />
</ItemGroup>
</Target>

<!-- Add support for XmlPeek task -->
<UsingTask TaskName="XmlPeek" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

</Project>
Loading