-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto install and instrument sentry-okhttp instead of sentry-android-o…
…khttp on v7+ (#724) * removed sentry-android-okhttp module from autoInstall if Sentry v7+ * add sentry-okhttp module to autoInstall if Sentry v7+ * changed OkHttp instrumentation to use sentry-okhttp instead of sentry-android-okhttp if Sentry v7+
- Loading branch information
1 parent
bf1acca
commit a50beb1
Showing
21 changed files
with
306 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...c/main/kotlin/io/sentry/android/gradle/autoinstall/okhttp/AndroidOkHttpInstallStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.sentry.android.gradle.autoinstall.okhttp | ||
|
||
import io.sentry.android.gradle.SentryPlugin | ||
import io.sentry.android.gradle.autoinstall.AbstractInstallStrategy | ||
import io.sentry.android.gradle.autoinstall.InstallStrategyRegistrar | ||
import io.sentry.android.gradle.util.SemVer | ||
import javax.inject.Inject | ||
import org.gradle.api.artifacts.dsl.ComponentMetadataHandler | ||
import org.slf4j.Logger | ||
|
||
abstract class AndroidOkHttpInstallStrategy : AbstractInstallStrategy { | ||
|
||
constructor(logger: Logger) : super() { | ||
this.logger = logger | ||
} | ||
|
||
@Suppress("unused") // used by Gradle | ||
@Inject // inject is needed to avoid Gradle error | ||
constructor() : this(SentryPlugin.logger) | ||
|
||
override val sentryModuleId: String get() = SENTRY_ANDROID_OKHTTP_ID | ||
|
||
override val minSupportedThirdPartyVersion: SemVer get() = MIN_SUPPORTED_VERSION | ||
|
||
override val minSupportedSentryVersion: SemVer get() = SemVer(4, 4, 0) | ||
|
||
override val maxSupportedSentryVersion: SemVer get() = SemVer(6, 9999, 9999) | ||
|
||
companion object Registrar : InstallStrategyRegistrar { | ||
private const val OKHTTP_GROUP = "com.squareup.okhttp3" | ||
private const val OKHTTP_ID = "okhttp" | ||
internal const val SENTRY_ANDROID_OKHTTP_ID = "sentry-android-okhttp" | ||
|
||
private val MIN_SUPPORTED_VERSION = SemVer(3, 13, 0) | ||
|
||
override fun register(component: ComponentMetadataHandler) { | ||
component.withModule( | ||
"$OKHTTP_GROUP:$OKHTTP_ID", | ||
AndroidOkHttpInstallStrategy::class.java | ||
) {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.