Skip to content

Commit

Permalink
chore(deps): update Java SDK to v8.2.0 (#2014)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Feb 14, 2025
1 parent 3409e44 commit 80ab336
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 32 deletions.
4 changes: 0 additions & 4 deletions .craft.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
minVersion: 0.24.0
changelogPolicy: auto
targets:
- name: symbol-collector
includeNames: /libsentry(-android)?\.so/
batchType: android
bundleIdPrefix: sentry-unity-android-ndk-
- name: upm
releaseRepoOwner: getsentry
releaseRepoName: unity
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ jobs:
path: package-dev/Plugins/Android
wait-timeout: 3600

- name: Download Android Libraries
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
with:
name: Android-libraries
path: modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib
wait-timeout: 3600

- name: Download Linux SDK
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848
with:
Expand Down Expand Up @@ -119,7 +112,6 @@ jobs:
if-no-files-found: error
path: |
package-release.zip
modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/*
- name: Run Unity tests (playmode)
run: |
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
# hash of package/package.json for cache busting on release builds (version bump)
path: |
package-dev/Plugins
modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib
key: sdk=${{ inputs.target }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}

- name: Installing Linux Dependencies
Expand Down Expand Up @@ -76,11 +75,3 @@ jobs:
path: package-dev/Plugins/${{ inputs.target }}
# Lower retention period - we only need this to retry CI.
retention-days: 14

- uses: actions/upload-artifact@v4
if: ${{ inputs.target == 'Android' }}
with:
name: ${{ inputs.target }}-libraries
path: modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/*
# Lower retention period - we only need this to retry CI.
retention-days: 14
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ package-dev/**/TestSentryOptions.json
package-dev/Tests/Editor/TestFiles/
package-dev/Plugins/*/Sentry/crashpad_handler*

# Download cache for Cocoa SDK
# Download cache for native SDKs
modules/sentry-cocoa
modules/sentry-native-ndk

# Adding .meta to control target platforms for all of our DLLs
!package-dev/**/Sentry*.dll.meta
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
- 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))
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#511)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/5.0.1...5.1.1)
- Bump Java SDK from v7.20.0 to v8.2.0 ([#2014](https://github.com/getsentry/sentry-unity/pull/2014))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#820)
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.0...8.2.0)

## 3.0.0-beta.1

Expand Down
49 changes: 47 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<SentryiOSArtifactsDestination>$(SentryArtifactsDestination)iOS/Sentry.xcframework~/</SentryiOSArtifactsDestination>
<SentrymacOSArtifactsDestination>$(SentryArtifactsDestination)macOS/Sentry/</SentrymacOSArtifactsDestination>
<!-- Android -->
<SentryNativeNdkCache>$(RepoRoot)modules/sentry-native-ndk/</SentryNativeNdkCache>
<SentryAndroidRoot>$(RepoRoot)modules/sentry-java/</SentryAndroidRoot>
<SentryAndroidArtifactsDestination>$(SentryArtifactsDestination)Android/Sentry~/</SentryAndroidArtifactsDestination>
<!-- Native -->
Expand Down Expand Up @@ -228,8 +229,10 @@ Expected to exist:
</Target>

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

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

<Message Importance="High" Text="Reading the sentry-native-ndk version from the 'Config.kt' file." />

<PropertyGroup>
<PropertiesContent>$([System.IO.File]::ReadAllText("$(RepoRoot)modules/sentry-java/buildSrc/src/main/java/Config.kt"))</PropertiesContent>
<NativeVersion>$([System.Text.RegularExpressions.Regex]::Match($(PropertiesContent), 'sentryNativeNdk\s*=\s*"[^"]+:([^"]+)"').Groups[1].Value)</NativeVersion>
</PropertyGroup>

<!-- Clean cache if version does not exist to get rid of old versions -->
<RemoveDir
Condition="!Exists('$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip')"
Directories="$(SentryNativeNdkCache)" />

<!-- Create cache directory -->
<MakeDir Condition="!Exists('$(SentryNativeNdkCache)')" Directories="$(SentryNativeNdkCache)" />

<Message Importance="High" Text="Downloading sentry-native-ndk version '$(NativeVersion)'." />

<!-- Download prebuilt sentry-native-ndk -->
<Exec
Condition="!Exists('$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip')"
Command="curl -L https://github.com/getsentry/sentry-native/releases/download/$(NativeVersion)/sentry-native-ndk-$(NativeVersion).zip -o $(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip" />

<Exec
Condition="!Exists('$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion)')"
Command="unzip -o $(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion).zip -d $(SentryNativeNdkCache)" />

<Copy SourceFiles="$(SentryNativeNdkCache)sentry-native-ndk-$(NativeVersion)/sentry-native-ndk-release.aar" DestinationFiles="$(SentryAndroidArtifactsDestination)sentry-native-ndk-release.aar" />

<Error Condition="!Exists('$(SentryAndroidArtifactsDestination)')" Text="Failed to build the Android SDK." />
</Target>

<!-- Build the NDK: dotnet msbuild /t:DownloadNDK src/Sentry.Unity -->
<Target Name="DownloadNDK" >
<Message Importance="High" Text="Downloading Sentry NDK SDK." />

<PropertyGroup>
<PropertiesContent>$([System.IO.File]::ReadAllText("$(RepoRoot)modules/sentry-java/buildSrc/src/main/java/Config.kt"))</PropertiesContent>
<NativeVersion>$([System.Text.RegularExpressions.Regex]::Match($(PropertiesContent), 'sentryNativeNdk\s*=\s*"[^"]+:([^"]+)"').Groups[1].Value)</NativeVersion>
</PropertyGroup>

<Message Importance="High" Text="Downloading up the NDK SDK version '$(NativeVersion)'." />

<Error Condition="!Exists('$(SentryAndroidArtifactsDestination)')" Text="Failed to build the Android SDK." />
</Target>

Expand Down
2 changes: 1 addition & 1 deletion modules/sentry-java
Submodule sentry-java updated 970 files
21 changes: 21 additions & 0 deletions samples/unity-of-bugs/Assets/Editor/GradleProjectUpdater.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#if UNITY_ANDROID && !UNITY_2020_1_OR_NEWER
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;

namespace Editor
{
/// <summary>
/// With version v8 of the sentry-java SDK the min-sdk-version got raised to 21
/// The default min-version for Unity 2019 builds is 19
/// </summary>
public class GradleProjectUpdater : MonoBehaviour
{
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget target, string pathToBuildProject)
{
PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel21;
}
}
}
#endif
11 changes: 11 additions & 0 deletions samples/unity-of-bugs/Assets/Editor/GradleProjectUpdater.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/Sentry.Unity.Editor/Android/GradleSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ internal class GradleSetup

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

Expand Down
5 changes: 5 additions & 0 deletions test/Scripts.Integration.Test/Editor/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public static void BuildIl2CPPPlayer(BuildTarget target, BuildTargetGroup group,
Debug.Log($"Builder: Creating output directory at '{outputDir}'");
Directory.CreateDirectory(outputDir);

#if !UNITY_2020_1_OR_NEWER
Debug.Log("Builder: Raising the minSdkVersion to 21");
PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel21;
#endif

Debug.Log("Builder: Enabling minify");
#if UNITY_2020_1_OR_NEWER
PlayerSettings.Android.minifyDebug = PlayerSettings.Android.minifyRelease = true;
Expand Down
1 change: 1 addition & 0 deletions test/Scripts.Tests/package-release.zip.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,7 @@ Plugins/Android/proguard-sentry-unity.pro
Plugins/Android/proguard-sentry-unity.pro.meta
Plugins/Android/Sentry~/sentry-android-core-release.aar
Plugins/Android/Sentry~/sentry-android-ndk-release.aar
Plugins/Android/Sentry~/sentry-native-ndk-release.aar
Plugins/Android/Sentry~/sentry.jar
Plugins/Windows/Sentry.meta
Plugins/Windows/Sentry/crashpad_handler.exe
Expand Down
6 changes: 0 additions & 6 deletions test/Scripts.Tests/test-pack-contents.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ try {
$zip.Dispose()
}

$androidLibsDir = "$projectRoot/modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib/"
if (-not(Test-Path -Path $androidLibsDir)) {
Write-Host "Android native libs not found in: '$androidLibsDir'"
exit 1
}

$androidLibs = Get-ChildItem -Recurse $androidLibsDir | ForEach-Object {$_.Directory.Name + "/" + $_.Name}
$result = Compare-Object $androidLibs (Get-Content "$PSScriptRoot/android-libs.snapshot")
if ($result.count -eq 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repositories {
dependencies {
implementation(name: 'sentry-android-ndk-release', ext:'aar')
implementation(name: 'sentry-android-core-release', ext:'aar')
implementation(name: 'sentry-native-ndk-release', ext:'aar')
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
dependencies {
implementation(name: 'sentry-android-ndk-release', ext:'aar')
implementation(name: 'sentry-android-core-release', ext:'aar')
implementation(name: 'sentry-native-ndk-release', ext:'aar')
}

android {
Expand Down

0 comments on commit 80ab336

Please sign in to comment.