Skip to content

Commit 80ab336

Browse files
chore(deps): update Java SDK to v8.2.0 (#2014)
1 parent 3409e44 commit 80ab336

File tree

15 files changed

+95
-32
lines changed

15 files changed

+95
-32
lines changed

.craft.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
minVersion: 0.24.0
22
changelogPolicy: auto
33
targets:
4-
- name: symbol-collector
5-
includeNames: /libsentry(-android)?\.so/
6-
batchType: android
7-
bundleIdPrefix: sentry-unity-android-ndk-
84
- name: upm
95
releaseRepoOwner: getsentry
106
releaseRepoName: unity

.github/workflows/build.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ jobs:
7272
path: package-dev/Plugins/Android
7373
wait-timeout: 3600
7474

75-
- name: Download Android Libraries
76-
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
77-
with:
78-
name: Android-libraries
79-
path: modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib
80-
wait-timeout: 3600
81-
8275
- name: Download Linux SDK
8376
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
8477
with:
@@ -119,7 +112,6 @@ jobs:
119112
if-no-files-found: error
120113
path: |
121114
package-release.zip
122-
modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/*
123115
124116
- name: Run Unity tests (playmode)
125117
run: |

.github/workflows/sdk.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
# hash of package/package.json for cache busting on release builds (version bump)
4848
path: |
4949
package-dev/Plugins
50-
modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib
5150
key: sdk=${{ inputs.target }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}
5251

5352
- name: Installing Linux Dependencies
@@ -76,11 +75,3 @@ jobs:
7675
path: package-dev/Plugins/${{ inputs.target }}
7776
# Lower retention period - we only need this to retry CI.
7877
retention-days: 14
79-
80-
- uses: actions/upload-artifact@v4
81-
if: ${{ inputs.target == 'Android' }}
82-
with:
83-
name: ${{ inputs.target }}-libraries
84-
path: modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/*
85-
# Lower retention period - we only need this to retry CI.
86-
retention-days: 14

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ package-dev/**/TestSentryOptions.json
3131
package-dev/Tests/Editor/TestFiles/
3232
package-dev/Plugins/*/Sentry/crashpad_handler*
3333

34-
# Download cache for Cocoa SDK
34+
# Download cache for native SDKs
3535
modules/sentry-cocoa
36+
modules/sentry-native-ndk
3637

3738
# Adding .meta to control target platforms for all of our DLLs
3839
!package-dev/**/Sentry*.dll.meta

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
- Bump .NET SDK from v5.0.1 to v5.1.1 ([#2005](https://github.com/getsentry/sentry-unity/pull/2005), [#2018](https://github.com/getsentry/sentry-unity/pull/2018))
2828
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#511)
2929
- [diff](https://github.com/getsentry/sentry-dotnet/compare/5.0.1...5.1.1)
30+
- Bump Java SDK from v7.20.0 to v8.2.0 ([#2014](https://github.com/getsentry/sentry-unity/pull/2014))
31+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#820)
32+
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.0...8.2.0)
3033

3134
## 3.0.0-beta.1
3235

Directory.Build.targets

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<SentryiOSArtifactsDestination>$(SentryArtifactsDestination)iOS/Sentry.xcframework~/</SentryiOSArtifactsDestination>
1717
<SentrymacOSArtifactsDestination>$(SentryArtifactsDestination)macOS/Sentry/</SentrymacOSArtifactsDestination>
1818
<!-- Android -->
19+
<SentryNativeNdkCache>$(RepoRoot)modules/sentry-native-ndk/</SentryNativeNdkCache>
1920
<SentryAndroidRoot>$(RepoRoot)modules/sentry-java/</SentryAndroidRoot>
2021
<SentryAndroidArtifactsDestination>$(SentryArtifactsDestination)Android/Sentry~/</SentryAndroidArtifactsDestination>
2122
<!-- Native -->
@@ -228,8 +229,10 @@ Expected to exist:
228229
</Target>
229230

230231
<!-- Build the Android SDK: dotnet msbuild /t:BuildAndroidSDK src/Sentry.Unity -->
231-
<Target Name="BuildAndroidSDK" Condition="'$(MSBuildProjectName)' == 'Sentry.Unity'
232-
And !Exists('$(SentryAndroidArtifactsDestination)')" BeforeTargets="BeforeBuild">
232+
<Target Name="BuildAndroidSDK"
233+
DependsOnTargets="DownloadCLI"
234+
Condition="'$(MSBuildProjectName)' == 'Sentry.Unity' And !Exists('$(SentryAndroidArtifactsDestination)')"
235+
BeforeTargets="BeforeBuild">
233236
<Error Condition="!Exists('$(SentryAndroidRoot)')" Text="Couldn't find the Android root at $(SentryAndroidRoot)." />
234237
<Message Importance="High" Text="Building Sentry Android SDK." />
235238

@@ -243,6 +246,48 @@ Expected to exist:
243246
<Copy SourceFiles="@(AndroidSdkArtifacts)" DestinationFiles="@(AndroidSdkArtifacts->'$(SentryAndroidArtifactsDestination)%(RecursiveDir)%(Filename)%(Extension)')" />
244247
<Exec WorkingDirectory="$(SentryAndroidRoot)" Command="cp sentry/build/libs/sentry*.jar $(SentryAndroidArtifactsDestination)sentry.jar" />
245248

249+
<Message Importance="High" Text="Reading the sentry-native-ndk version from the 'Config.kt' file." />
250+
251+
<PropertyGroup>
252+
<PropertiesContent>$([System.IO.File]::ReadAllText("$(RepoRoot)modules/sentry-java/buildSrc/src/main/java/Config.kt"))</PropertiesContent>
253+
<NativeVersion>$([System.Text.RegularExpressions.Regex]::Match($(PropertiesContent), 'sentryNativeNdk\s*=\s*"[^"]+:([^"]+)"').Groups[1].Value)</NativeVersion>
254+
</PropertyGroup>
255+
256+
<!-- Clean cache if version does not exist to get rid of old versions -->
257+
<RemoveDir
258+
Condition="!Exists('$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip')"
259+
Directories="$(SentryNativeNdkCache)" />
260+
261+
<!-- Create cache directory -->
262+
<MakeDir Condition="!Exists('$(SentryNativeNdkCache)')" Directories="$(SentryNativeNdkCache)" />
263+
264+
<Message Importance="High" Text="Downloading sentry-native-ndk version '$(NativeVersion)'." />
265+
266+
<!-- Download prebuilt sentry-native-ndk -->
267+
<Exec
268+
Condition="!Exists('$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip')"
269+
Command="curl -L https://github.com/getsentry/sentry-native/releases/download/$(NativeVersion)/sentry-native-ndk-$(NativeVersion).zip -o $(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip" />
270+
271+
<Exec
272+
Condition="!Exists('$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion)')"
273+
Command="unzip -o $(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip -d $(SentryNativeNdkCache)" />
274+
275+
<Copy SourceFiles="$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion)/sentry-native-ndk-release.aar" DestinationFiles="$(SentryAndroidArtifactsDestination)sentry-native-ndk-release.aar" />
276+
277+
<Error Condition="!Exists('$(SentryAndroidArtifactsDestination)')" Text="Failed to build the Android SDK." />
278+
</Target>
279+
280+
<!-- Build the NDK: dotnet msbuild /t:DownloadNDK src/Sentry.Unity -->
281+
<Target Name="DownloadNDK" >
282+
<Message Importance="High" Text="Downloading Sentry NDK SDK." />
283+
284+
<PropertyGroup>
285+
<PropertiesContent>$([System.IO.File]::ReadAllText("$(RepoRoot)modules/sentry-java/buildSrc/src/main/java/Config.kt"))</PropertiesContent>
286+
<NativeVersion>$([System.Text.RegularExpressions.Regex]::Match($(PropertiesContent), 'sentryNativeNdk\s*=\s*"[^"]+:([^"]+)"').Groups[1].Value)</NativeVersion>
287+
</PropertyGroup>
288+
289+
<Message Importance="High" Text="Downloading up the NDK SDK version '$(NativeVersion)'." />
290+
246291
<Error Condition="!Exists('$(SentryAndroidArtifactsDestination)')" Text="Failed to build the Android SDK." />
247292
</Target>
248293

modules/sentry-java

Submodule sentry-java updated 970 files
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#if UNITY_ANDROID && !UNITY_2020_1_OR_NEWER
2+
using UnityEditor;
3+
using UnityEditor.Callbacks;
4+
using UnityEngine;
5+
6+
namespace Editor
7+
{
8+
/// <summary>
9+
/// With version v8 of the sentry-java SDK the min-sdk-version got raised to 21
10+
/// The default min-version for Unity 2019 builds is 19
11+
/// </summary>
12+
public class GradleProjectUpdater : MonoBehaviour
13+
{
14+
[PostProcessBuild]
15+
public static void OnPostProcessBuild(BuildTarget target, string pathToBuildProject)
16+
{
17+
PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel21;
18+
}
19+
}
20+
}
21+
#endif

samples/unity-of-bugs/Assets/Editor/GradleProjectUpdater.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sentry.Unity.Editor/Android/GradleSetup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ internal class GradleSetup
1313

1414
public const string SdkDependencies = @"dependencies {
1515
implementation(name: 'sentry-android-ndk-release', ext:'aar')
16-
implementation(name: 'sentry-android-core-release', ext:'aar')";
16+
implementation(name: 'sentry-android-core-release', ext:'aar')
17+
implementation(name: 'sentry-native-ndk-release', ext:'aar')";
1718
public const string DependenciesAddedMessage = "The Sentry Gradle dependencies have already been added.";
1819
private readonly string _unityLibraryGradle;
1920

0 commit comments

Comments
 (0)