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

Add Sentry proguard setting for watch app and add changelog #1068

Merged
merged 5 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
7.41
-----

* New Features:
* Wear OS app
([#1068](https://github.com/Automattic/pocket-casts-android/pull/1068)).

7.40
-----
Expand Down
2 changes: 0 additions & 2 deletions base.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ android {
if (canSignRelease) {
signingConfig signingConfigs.release
}

}
}

}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ plugins {
id 'com.mikepenz.aboutlibraries.plugin' version '10.4.0' apply false
id 'com.github.ben-manes.versions' version '0.42.0'
id 'com.diffplug.spotless' version '6.2.2'
id 'io.sentry.android.gradle' version '3.1.5' apply false
id 'io.sentry.android.gradle' version '3.10.0' apply false
}

apply plugin: 'base'
Expand Down Expand Up @@ -86,4 +86,3 @@ allprojects {
}
}
}

31 changes: 17 additions & 14 deletions wear/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import io.sentry.android.gradle.extensions.InstrumentationFeature

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'io.sentry.android.gradle'
}

apply plugin: 'com.google.gms.google-services'
Expand All @@ -14,17 +17,6 @@ android {
applicationId project.applicationId
}

if (canSignRelease) {
signingConfigs {
release {
storeFile = project.storeFile
storePassword = project.storePassword
keyAlias = project.keyAlias
keyPassword = project.keyPassword
}
}
}

buildTypes {
debug {
applicationIdSuffix '.debug'
Expand All @@ -50,11 +42,15 @@ android {
sentryDsn: project.pocketcastsSentryDsn
]

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
if (!project.pocketcastsSentryDsn) {
println "WARNING: Sentry DSN gradle property 'pocketcastsSentryDsn' not found. Crash reporting won't work without this."
}

if (canSignRelease) {
signingConfig signingConfigs.release
if (!file("${project.rootDir}/sentry.properties").exists()) {
println "WARNING: Sentry configuration file 'sentry.properties' not found. The ProGuard mapping files won't be uploaded."
}

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

Expand All @@ -70,6 +66,13 @@ android {
}
}

sentry {
includeProguardMapping = file("$rootDir/sentry.properties").exists()
tracingInstrumentation {
features = EnumSet.allOf(InstrumentationFeature) - InstrumentationFeature.FILE_IO
}
}

dependencies {
implementation androidLibs.wearInput

Expand Down
152 changes: 144 additions & 8 deletions wear/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,157 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# By default, the flags in this file are appended to flags specified
# in /Applications/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# Without this the playback notification doesn't show up on fresh launch
# https://github.com/shiftyjelly/pocketcasts-android/issues/1656
-keep class au.com.shiftyjelly.pocketcasts.core.player.** { *; }

-dontwarn android.test.**
-dontwarn org.junit.internal.runners.statements.**
-dontwarn org.junit.rules.**
# retrolambda
-dontwarn java.lang.invoke.*
# okhttp
-dontwarn com.squareup.okhttp.**
-dontwarn org.conscrypt.**
-dontwarn okio.**
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
-keepattributes *Annotation*

# kotlin
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}

# appcompat
-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }
-keep public class android.support.v4.media.session.** { *; }
-keep public class * extends android.support.v4.view.ActionProvider {
public <init>(android.content.Context);
}

# dagger 2
-dontwarn com.google.errorprone.annotations.*

-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-keep class com.google.android.gms.measurement.** { *; }
-dontwarn com.google.android.gms.measurement.**

# chrome cast
-keep class androidx.media3.cast.DefaultCastOptionsProvider { *; }
-keep class androidx.mediarouter.app.MediaRouteActionProvider { *; }
-keep class au.com.shiftyjelly.pocketcasts.CastOptionsProvider { *; }

# glide
-keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}

-keepclassmembers enum * {
<fields>;
public static **[] values();
public static ** valueOf(java.lang.String);
}

# retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
-dontwarn okhttp3.**
-dontwarn retrofit2.Platform$Java8
-dontwarn javax.annotation.**

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# moshi
-dontwarn okio.**
-dontwarn javax.annotation.**
-keepclasseswithmembers class * {
@com.squareup.moshi.* <methods>;
}
-keep @com.squareup.moshi.JsonQualifier interface *
-keep class **JsonAdapter {
<init>(...);
<fields>;
}
-keepnames @com.squareup.moshi.JsonClass class *

# Enum field names are used by the integrated EnumJsonAdapter.
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
<fields>;
}

# Retain generated JsonAdapters if annotated type is retained.
-if @com.squareup.moshi.JsonClass class *
-keep class <1>JsonAdapter {
<init>(...);
<fields>;
}

# Keep layout classes
-keep class * extends android.view.View

# clean up notes
-dontnote io.reactivex.**
-dontnote com.facebook.stetho.**
-dontnote com.afollestad.materialdialogs.internal.**
-dontnote com.astuetz.**
-dontnote com.google.android.gms.**
-dontnote com.google.android.material.**
-dontnote io.fabric.sdk.**
-dontnote com.google.firebase.**
-dontnote okhttp3.**
-dontnote retrofit2.**
-dontwarn com.google.common.**

# requested by Adam for MediaCompat and Android Auto
-keep class android.support.v4.media.** implements android.os.Parcelable {
public static final ** CREATOR;
}

# corountines
-keepnames class kotlinx.coroutines.experimental.internal.MainDispatcherFactory {}
-dontwarn kotlinx.coroutines.**

## remove our logs
#-assumenosideeffects class timber.log.Timber {
# public static *** e(...);
# public static *** d(...);
# public static *** w(...);
# public static *** i(...);
#}
#
#-assumenosideeffects class au.com.shiftyjelly.pocketcasts.core.helper.log.TimberHelper {
# public static *** sql(...);
#}