Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Android gradle plugin #633

Merged
merged 10 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Add setting that allows switching between the project and user directories for the internal Sentry database location on Windows/Linux ([#616](https://github.com/getsentry/sentry-unreal/pull/616))
- Add non-ASCII characters support for user messages ([#624](https://github.com/getsentry/sentry-unreal/pull/624))
- Upgrade Android gradle plugin from v2.1.5 to v4.11.0 ([#633](https://github.com/getsentry/sentry-unreal/pull/633))
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
- Allow overriding `UploadSymbolsAutomatically` via environment variable `SENTRY_UPLOAD_SYMBOLS_AUTOMATICALLY` ([#636](https://github.com/getsentry/sentry-unreal/pull/636))

### Fixes
Expand Down
7 changes: 1 addition & 6 deletions plugin-dev/Config/FilterPlugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@
; /Extras/...
; /Binaries/ThirdParty/*.dll
/Scripts/*
/LinuxIntermediate/Build/Linux/UnrealEditor/Inc/Sentry/UHT/*
/LinuxIntermediate/Build/Linux/UnrealGame/Development/Sentry/*
/LinuxIntermediate/Build/Linux/UnrealGame/Inc/Sentry/UHT/*
/LinuxIntermediate/Build/Linux/UnrealGame/Shipping/Sentry/*
/LinuxIntermediate/Build/Linux/x64/UnrealGame/Development/Sentry/*
/LinuxIntermediate/Build/Linux/x64/UnrealGame/Shipping/Sentry/*
/Gradle/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that change intentional? The how do the LinuxIntermediate related to Gradle?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, aside from adding Gradle here I've also removed LinuxIntermediate stuff which is now redundant (probably I've missed deleting these entries earlier). Should we tackle this kind of clean-up in a separate PR?

/sentry-cli.properties
5 changes: 5 additions & 0 deletions plugin-dev/Gradle/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
2 changes: 2 additions & 0 deletions plugin-dev/Source/Sentry/Private/SentrySettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ USentrySettings::USentrySettings(const FObjectInitializer& ObjectInitializer)
, UploadSymbolsAutomatically(false)
, IncludeSources(false)
, DiagnosticLevel(ESentryCliLogLevel::Info)
, UseLegacyGradlePlugin(false)
, CrashReporterUrl()
, bIsDirty(false)
{
Expand Down Expand Up @@ -66,6 +67,7 @@ void USentrySettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChan
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, OrgName) ||
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, AuthToken) ||
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, IncludeSources) ||
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, UseLegacyGradlePlugin) ||
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, DiagnosticLevel) ||
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, CrashReporterUrl))
{
Expand Down
5 changes: 5 additions & 0 deletions plugin-dev/Source/Sentry/Public/SentrySettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ class SENTRY_API USentrySettings : public UObject
Meta = (DisplayName = "Diagnostic Level", ToolTip = "Logs verbosity level during symbol uploading.", EditCondition = "UploadSymbolsAutomatically"))
ESentryCliLogLevel DiagnosticLevel;

UPROPERTY(Config, EditAnywhere, Category = "Debug Symbols",
Meta = (DisplayName = "Use legacy Sentry Gradle plugin (for Android only)", ToolTip = "Flag indicating whether to use legacy Sentry Gradle plugin for debug symbol upload. No engine's Gradle version bump is required if enabled. This can be used as a fallback if the newer Gradle 7.5 causing compatibility issues with other third-party plugins.",
EditCondition = "UploadSymbolsAutomatically"))
bool UseLegacyGradlePlugin;

UPROPERTY(Config, EditAnywhere, Category = "Crash Reporter",
Meta = (DisplayName = "Crash Reporter Endpoint", ToolTip = "Endpoint that Unreal Engine Crah Reporter should use in order to upload crash data to Sentry."))
FString CrashReporterUrl;
Expand Down
54 changes: 40 additions & 14 deletions plugin-dev/Source/Sentry/Sentry_Android_UPL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<setBoolFromProperty result="bUploadSymbolsAutomatically" ini="Engine" section="/Script/Sentry.SentrySettings" property="UploadSymbolsAutomatically" default="false" />
<setBoolFromProperty result="bIncludeSources" ini="Engine" section="/Script/Sentry.SentrySettings" property="IncludeSources" default="false" />
<setBoolFromProperty result="bUseLegacyGradlePlugin" ini="Engine" section="/Script/Sentry.SentrySettings" property="UseLegacyGradlePlugin" default="false" />

<setStringFromProperty result="enabledBuildPlatforms" ini="Engine" section="/Script/Sentry.SentrySettings" property="EnableBuildPlatforms" default=""/>
<setStringFromProperty result="enabledBuildConfigurations" ini="Engine" section="/Script/Sentry.SentrySettings" property="EnableBuildConfigurations" default=""/>
Expand Down Expand Up @@ -34,6 +35,12 @@
<true>
<copyFile src="$S(ProjectDir)/sentry.properties" dst="$S(BuildDir)/gradle/sentry.properties" />
<copyFile src="$S(ProjectDir)/sentry.properties" dst="$S(BuildDir)/gradle/AFSProject/app/sentry.properties" />
<if condition="bUseLegacyGradlePlugin">
<false>
<log text="Modifying engine's Gradle version used by replacing gradle-wrapper.properties"/>
<copyFile src="$S(PluginDir)/../../Gradle/gradle-wrapper.properties" dst="$S(BuildDir)/gradle/gradle/wrapper/gradle-wrapper.properties" />
</false>
</if>
</true>
</if>
</prebuildCopies>
Expand Down Expand Up @@ -70,6 +77,17 @@
uploadNativeSymbols = true
}
</insert>
<if condition="bUseLegacyGradlePlugin">
<false>
<insert>
sentry {
autoInstallation {
enabled = false
}
}
</insert>
</false>
</if>
<if condition="bIncludeSources">
<true>
<insert>
Expand All @@ -78,7 +96,7 @@
}
</insert>
</true>
</if>
</if>
</true>
</if>
</buildGradleAdditions>
Expand Down Expand Up @@ -134,22 +152,30 @@
</insert>
</baseBuildGradleAdditions>

<buildscriptGradleAdditions>
<insert>
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
}
</insert>
</buildscriptGradleAdditions>

<buildscriptGradleAdditions>
<if condition="bUploadSymbols">
<true>
<insert>
dependencies {
classpath 'io.sentry:sentry-android-gradle-plugin:2.1.5'
}
</insert>
<if condition="bUseLegacyGradlePlugin">
<true>
<log text="Using legacy Sentry Gradle plugin 2.1.5 for Android debug symbol upload."/>
<insert>
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'io.sentry:sentry-android-gradle-plugin:2.1.5'
}
</insert>
</true>
<false>
<log text="Using Sentry Gradle plugin 4.11.0 for Android debug symbol upload."/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the hardcoded version number going to bite us in the butt later on?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since we don't have any means allowing to check how Sentry Gradle plugin performs in our CI probably it'd be safer to keep a hardcoded version here instead of bumping it automatically for the time being.

<log text="Enable legacy Sentry Gradle plugin in project settings in case current version conflicts with other plugins."/>
<insert>
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'io.sentry:sentry-android-gradle-plugin:4.11.0'
}
</insert>
</false>
</if>
</true>
</if>
</buildscriptGradleAdditions>
Expand Down
2 changes: 2 additions & 0 deletions scripts/packaging/package-github.snapshot
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CHANGELOG.md
Config/
Config/FilterPlugin.ini
Gradle/
Gradle/gradle-wrapper.properties
LICENSE
Resources/
Resources/Icon128.png
Expand Down
2 changes: 2 additions & 0 deletions scripts/packaging/package-marketplace.snapshot
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CHANGELOG.md
Config/
Config/FilterPlugin.ini
Gradle/
Gradle/gradle-wrapper.properties
LICENSE
Resources/
Resources/Icon128.png
Expand Down
Loading