|
1 | 1 | <Project Sdk="Microsoft.NET.Sdk"> |
2 | 2 | <PropertyGroup> |
3 | | - <TargetFrameworks>net8.0-android34.0</TargetFrameworks> |
4 | | - <!-- BG8605 and BG8606 happen because there's a missing androidx.lifecycle dependency, but we don't need it here. (The native Android Sentry SDK will use it if it exists.) --> |
5 | | - <NoWarn>$(NoWarn);BG8605;BG8606</NoWarn> |
| 3 | + <TargetFrameworks>net8.0-android34.0;net9.0-android35.0</TargetFrameworks> |
6 | 4 | <SentryAndroidSdkVersion>8.6.0</SentryAndroidSdkVersion> |
7 | | - <SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory> |
| 5 | + <SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\$(TargetFramework)\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory> |
8 | 6 | <!-- This gets resolved by the DownloadSentryAndroidSdk target --> |
9 | 7 | <SentryNativeNdkVersion></SentryNativeNdkVersion> |
10 | 8 | <Description>.NET Bindings for the Sentry Android SDK</Description> |
|
31 | 29 | <InternalsVisibleTo Include="Sentry.Maui.Tests" PublicKey="$(SentryPublicKey)" /> |
32 | 30 | </ItemGroup> |
33 | 31 |
|
34 | | - <ItemGroup> |
| 32 | + <!-- Dependencies for AndroidMavenLibrary references |
| 33 | + Note: versions match what was shipped with net8.0-android34.0 in: |
| 34 | + https://www.nuget.org/packages/Microsoft.Maui.Core/8.0.3#dependencies-body-tab |
| 35 | + --> |
| 36 | + <ItemGroup Condition="$(TargetFramework.StartsWith('net8'))"> |
| 37 | + <PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.6.1.3" /> |
| 38 | + <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common.Java8" Version="2.6.1.3" /> |
| 39 | + <!-- MAUI 8 references this version indirectly via Xamarin.AndroidX.SwipeRefreshLayout (>= 1.1.0.14) --> |
| 40 | + <PackageReference Include="Xamarin.AndroidX.Core" Version="1.10.1.2" /> |
| 41 | + </ItemGroup> |
| 42 | + |
| 43 | + <!-- Dependencies for AndroidMavenLibrary references |
| 44 | + Note: versions match what was shipped with net9.0-android35.0 in: |
| 45 | + https://www.nuget.org/packages/Microsoft.Maui.Core/9.0.0#dependencies-body-tab |
| 46 | + --> |
| 47 | + <ItemGroup Condition="$(TargetFramework.StartsWith('net9'))"> |
| 48 | + <PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.8.5.1" /> |
| 49 | + <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common.Java8" Version="2.8.5.1" /> |
| 50 | + <!-- MAUI 9 references this version indirectly via Xamarin.AndroidX.SwipeRefreshLayout (>= 1.1.0.24) --> |
| 51 | + <PackageReference Include="Xamarin.AndroidX.Core" Version="1.13.1.5" /> |
| 52 | + </ItemGroup> |
| 53 | + |
| 54 | + <ItemGroup Condition="$(TargetFramework.StartsWith('net8'))"> |
35 | 55 | <AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-$(SentryAndroidSdkVersion).jar" /> |
36 | 56 | <AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-android-core-$(SentryAndroidSdkVersion).aar" /> |
37 | 57 | <AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).aar" /> |
| 58 | + </ItemGroup> |
| 59 | + |
| 60 | + <!-- Starting with .NET 9 we can detect Java dependencies using POM files and AndroidMavenLibrary references --> |
| 61 | + <ItemGroup Condition="!$(TargetFramework.StartsWith('net8'))"> |
| 62 | + <AndroidLibrary |
| 63 | + Include="$(SentryAndroidSdkDirectory)sentry-$(SentryAndroidSdkVersion).jar" |
| 64 | + Manifest="$(SentryAndroidSdkDirectory)sentry-$(SentryAndroidSdkVersion).pom" |
| 65 | + JavaArtifact="io.sentry:sentry:$(SentryAndroidSdkVersion)" |
| 66 | + /> |
| 67 | + <AndroidMavenLibrary Include="io.sentry:sentry-android-core" Version="$(SentryAndroidSdkVersion)" /> |
| 68 | + <AndroidMavenLibrary Include="io.sentry:sentry-android-ndk" Version="$(SentryAndroidSdkVersion)" /> |
| 69 | + </ItemGroup> |
| 70 | + |
| 71 | + <ItemGroup> |
38 | 72 | <AndroidLibrary Include="..\..\lib\sentry-android-supplemental\bin\sentry-android-supplemental.jar" /> |
39 | 73 | <AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\arm64-v8a\libsentrysupplemental.so" Abi="arm64-v8a" /> |
40 | 74 | <AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\armeabi-v7a\libsentrysupplemental.so" Abi="armeabi-v7a" /> |
|
46 | 80 | <DownloadFile |
47 | 81 | SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-android-core/$(SentryAndroidSdkVersion)/sentry-android-core-$(SentryAndroidSdkVersion).aar" |
48 | 82 | DestinationFolder="$(SentryAndroidSdkDirectory)" |
49 | | - Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-core-$(SentryAndroidSdkVersion).aar')" |
| 83 | + Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-core-$(SentryAndroidSdkVersion).aar') And $(TargetFramework.StartsWith('net8'))" |
50 | 84 | Retries="3" |
51 | 85 | /> |
52 | 86 | <DownloadFile |
53 | 87 | SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-android-ndk/$(SentryAndroidSdkVersion)/sentry-android-ndk-$(SentryAndroidSdkVersion).aar" |
54 | 88 | DestinationFolder="$(SentryAndroidSdkDirectory)" |
55 | | - Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).aar')" |
| 89 | + Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).aar') And $(TargetFramework.StartsWith('net8'))" |
56 | 90 | Retries="3" |
57 | 91 | /> |
58 | 92 | <DownloadFile |
|
61 | 95 | Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-$(SentryAndroidSdkVersion).jar')" |
62 | 96 | Retries="3" |
63 | 97 | /> |
| 98 | + <DownloadFile |
| 99 | + SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry/$(SentryAndroidSdkVersion)/sentry-$(SentryAndroidSdkVersion).pom" |
| 100 | + DestinationFolder="$(SentryAndroidSdkDirectory)" |
| 101 | + Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-$(SentryAndroidSdkVersion).pom') And !$(TargetFramework.StartsWith('net8'))" |
| 102 | + Retries="3" |
| 103 | + /> |
| 104 | + |
64 | 105 | <!-- The native-ndk exists outside of the android-ndk now. We're downloading the POM file to get the version of the native-ndk. --> |
65 | 106 | <DownloadFile |
66 | 107 | SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-android-ndk/$(SentryAndroidSdkVersion)/sentry-android-ndk-$(SentryAndroidSdkVersion).pom" |
67 | 108 | DestinationFolder="$(SentryAndroidSdkDirectory)" |
68 | 109 | Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).pom')" |
69 | 110 | Retries="3" |
70 | 111 | /> |
71 | | - |
| 112 | + |
72 | 113 | <XmlPeek |
73 | 114 | XmlInputPath="$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).pom" |
74 | 115 | Query="//*[local-name()='dependency' and .//*[local-name()='artifactId' and text()='sentry-native-ndk']]/*[local-name()='version']/text()" |
75 | 116 | Condition="Exists('$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).pom')"> |
76 | 117 | <Output TaskParameter="Result" PropertyName="SentryNativeNdkVersion" /> |
77 | 118 | </XmlPeek> |
78 | | - |
| 119 | + |
79 | 120 | <DownloadFile |
80 | 121 | SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-native-ndk/$(SentryNativeNdkVersion)/sentry-native-ndk-$(SentryNativeNdkVersion).aar" |
81 | 122 | DestinationFolder="$(SentryAndroidSdkDirectory)" |
82 | | - Condition="'$(SentryNativeNdkVersion)' != '' And !Exists('$(SentryAndroidSdkDirectory)sentry-native-ndk-$(SentryNativeNdkVersion).aar')" |
| 123 | + Condition="'$(SentryNativeNdkVersion)' != '' And !Exists('$(SentryAndroidSdkDirectory)sentry-native-ndk-$(SentryNativeNdkVersion).aar') And $(TargetFramework.StartsWith('net8'))" |
83 | 124 | Retries="3" |
84 | 125 | /> |
85 | | - |
86 | | - <!-- Since we're reading the version from the POM file, we need to create an item for the downloaded sentry-native-ndk --> |
87 | | - <ItemGroup Condition="'$(SentryNativeNdkVersion)' != ''"> |
| 126 | + |
| 127 | + <ItemGroup Condition="'$(SentryNativeNdkVersion)' != '' And $(TargetFramework.StartsWith('net8'))"> |
88 | 128 | <AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-native-ndk-$(SentryNativeNdkVersion).aar" /> |
89 | 129 | </ItemGroup> |
| 130 | + <ItemGroup Condition="'$(SentryNativeNdkVersion)' != '' And !$(TargetFramework.StartsWith('net8'))"> |
| 131 | + <AndroidMavenLibrary Include="io.sentry:sentry-native-ndk" Version="$(SentryNativeNdkVersion)" /> |
| 132 | + </ItemGroup> |
90 | 133 | </Target> |
91 | 134 |
|
92 | 135 | <UsingTask TaskName="XmlPeek" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> |
|
0 commit comments