From a64df7cbd5bf39e9b86ca76624cc718da6d22824 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 5 May 2021 09:57:50 +0200 Subject: [PATCH 1/7] fix ascii comment --- .../transport/apache/ApacheHttpClientTransportFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransportFactory.java b/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransportFactory.java index e2e62f263d..0281e9e32d 100644 --- a/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransportFactory.java +++ b/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransportFactory.java @@ -57,7 +57,7 @@ public ITransport create( // the time to wait for a connection from the connection manager/pool .setConnectionRequestTimeout( options.getConnectionTimeoutMillis(), TimeUnit.MILLISECONDS) - // the time waiting for data – after establishing the connection; maximum time + // the time waiting for data, after establishing the connection; maximum time // of inactivity between two data packets .setResponseTimeout(options.getReadTimeoutMillis(), TimeUnit.MILLISECONDS) .build()) From 81353512511ab855b3de1d01904088bb84294093 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 5 May 2021 10:23:52 +0200 Subject: [PATCH 2/7] Bump: AGP to 4.2.0 --- CHANGELOG.md | 1 + buildSrc/src/main/java/Config.kt | 2 +- gradle.properties | 2 +- sentry-android-core/build.gradle.kts | 5 ----- sentry-android-ndk/build.gradle.kts | 5 ----- sentry-android-okhttp/build.gradle.kts | 5 ----- sentry-android-timber/build.gradle.kts | 5 ----- sentry-android/build.gradle.kts | 5 ----- sentry-samples/sentry-samples-android/build.gradle.kts | 5 ----- sentry-servlet/build.gradle.kts | 4 ++-- 10 files changed, 5 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a78e2a071d..f6385330c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Fix: sentry-android-timber package sets sentry.java.android.timber as SDK name (#1456) * Fix: When AppLifecycleIntegration is closed, it should remove observer using UI thread (#1459) +* Bump: AGP to 4.2.0 Breaking Changes: diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index b1859dc887..e45b452f65 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -10,7 +10,7 @@ object Config { val springKotlinCompatibleLanguageVersion = "1.3" object BuildPlugins { - val androidGradle = "com.android.tools.build:gradle:4.1.3" + val androidGradle = "com.android.tools.build:gradle:4.2.0" val kotlinGradlePlugin = "gradle-plugin" val buildConfig = "com.github.gmazzo.buildconfig" val buildConfigVersion = "3.0.0" diff --git a/gradle.properties b/gradle.properties index cab99d67bb..3a1f034740 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Daemon’s heap size -org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:MaxMetaspaceSize=1536m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:MaxMetaspaceSize=1536m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC # AndroidX required by AGP >= 3.6.x android.useAndroidX=true diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index 667c612fe1..8410a9b5e0 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -33,11 +33,6 @@ android { } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } diff --git a/sentry-android-ndk/build.gradle.kts b/sentry-android-ndk/build.gradle.kts index 2504861e06..5904e98918 100644 --- a/sentry-android-ndk/build.gradle.kts +++ b/sentry-android-ndk/build.gradle.kts @@ -60,11 +60,6 @@ android { } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } diff --git a/sentry-android-okhttp/build.gradle.kts b/sentry-android-okhttp/build.gradle.kts index bca0697f4e..0a3c5e6fb0 100644 --- a/sentry-android-okhttp/build.gradle.kts +++ b/sentry-android-okhttp/build.gradle.kts @@ -31,11 +31,6 @@ android { } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } diff --git a/sentry-android-timber/build.gradle.kts b/sentry-android-timber/build.gradle.kts index 1ed0869c00..94ce669f03 100644 --- a/sentry-android-timber/build.gradle.kts +++ b/sentry-android-timber/build.gradle.kts @@ -35,11 +35,6 @@ android { } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } diff --git a/sentry-android/build.gradle.kts b/sentry-android/build.gradle.kts index 00b139dea9..2066f51fb7 100644 --- a/sentry-android/build.gradle.kts +++ b/sentry-android/build.gradle.kts @@ -15,11 +15,6 @@ android { versionCode = project.properties[Config.Sentry.buildVersionCodeProp].toString().toInt() } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - buildFeatures { // Determines whether to generate a BuildConfig class. buildConfig = false diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index d1c3e107ca..a96afab7aa 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -80,11 +80,6 @@ android { } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } diff --git a/sentry-servlet/build.gradle.kts b/sentry-servlet/build.gradle.kts index fadf639bcd..9339e2f4ad 100644 --- a/sentry-servlet/build.gradle.kts +++ b/sentry-servlet/build.gradle.kts @@ -82,11 +82,11 @@ repositories { } val compileKotlin: KotlinCompile by tasks compileKotlin.kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_1_8.toString() languageVersion = Config.springKotlinCompatibleLanguageVersion } val compileTestKotlin: KotlinCompile by tasks compileTestKotlin.kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_1_8.toString() languageVersion = Config.springKotlinCompatibleLanguageVersion } From d12af3927f638add0c86cd9a4a2a8e5026b488dc Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Wed, 5 May 2021 10:25:45 +0200 Subject: [PATCH 3/7] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6385330c9..996009989a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * Fix: sentry-android-timber package sets sentry.java.android.timber as SDK name (#1456) * Fix: When AppLifecycleIntegration is closed, it should remove observer using UI thread (#1459) -* Bump: AGP to 4.2.0 +* Bump: AGP to 4.2.0 (#1460) Breaking Changes: From 914d422a3842fa674aecede336eb0289f5447b19 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 5 May 2021 10:31:21 +0200 Subject: [PATCH 4/7] remove jcenter --- build.gradle.kts | 3 --- buildSrc/build.gradle.kts | 4 ---- 2 files changed, 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a2ee5255ed..9d27d32925 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,8 +15,6 @@ plugins { buildscript { repositories { google() - jcenter() - maven { setUrl("https://kotlin.bintray.com/kotlinx") } } dependencies { classpath(Config.BuildPlugins.androidGradle) @@ -43,7 +41,6 @@ apply(plugin = Config.QualityPlugins.binaryCompatibilityValidator) allprojects { repositories { google() - jcenter() mavenCentral() } group = Config.Sentry.group diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 1b4d202cce..67cc5832a9 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -2,10 +2,6 @@ plugins { `kotlin-dsl` } -repositories { - jcenter() -} - // Disabling the warning about the use of experimental Kotlin compiler features kotlinDslPluginOptions { experimentalWarning.set(false) From b1f79e15377f758344e1c99155944c99d4990710 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 5 May 2021 10:34:21 +0200 Subject: [PATCH 5/7] fix --- buildSrc/build.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 67cc5832a9..665714a5eb 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -2,6 +2,10 @@ plugins { `kotlin-dsl` } +repositories { + mavenCentral() +} + // Disabling the warning about the use of experimental Kotlin compiler features kotlinDslPluginOptions { experimentalWarning.set(false) From 0879149765e88c82c90fc37fc8c71cd928cac3ba Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 5 May 2021 11:25:05 +0200 Subject: [PATCH 6/7] fix detekt --- buildSrc/src/main/java/Config.kt | 3 ++- .../okhttp/SentryOkHttpInterceptorTest.kt | 26 ++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index e45b452f65..c133e987c2 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -116,7 +116,8 @@ object Config { val gradleVersionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.36.0" val gradleVersions = "com.github.ben-manes.versions" val detekt = "io.gitlab.arturbosch.detekt" - val detektVersion = "1.16.0" + // use RC2 to drop jcenter because of kotlinx-html + val detektVersion = "1.17.0-RC2" val detektPlugin = "io.gitlab.arturbosch.detekt" val binaryCompatibilityValidatorPlugin = "org.jetbrains.kotlinx:binary-compatibility-validator:0.5.0" val binaryCompatibilityValidator = "binary-compatibility-validator" diff --git a/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt b/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt index 38cab58b84..9e23351173 100644 --- a/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt +++ b/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt @@ -40,11 +40,17 @@ class SentryOkHttpInterceptorTest { whenever(hub.options).thenReturn(SentryOptions()) } - fun getSut(isSpanActive: Boolean = true, httpStatusCode: Int = 201, responseBody: String = "success", socketPolicy: SocketPolicy = SocketPolicy.KEEP_OPEN): OkHttpClient { + fun getSut(isSpanActive: Boolean = true, + httpStatusCode: Int = 201, + responseBody: String = "success", + socketPolicy: SocketPolicy = SocketPolicy.KEEP_OPEN): OkHttpClient { if (isSpanActive) { whenever(hub.span).thenReturn(sentryTracer) } - server.enqueue(MockResponse().setBody(responseBody).setSocketPolicy(socketPolicy).setResponseCode(httpStatusCode)) + server.enqueue(MockResponse() + .setBody(responseBody) + .setSocketPolicy(socketPolicy) + .setResponseCode(httpStatusCode)) server.start() return OkHttpClient.Builder().addInterceptor(interceptor).build() } @@ -53,7 +59,9 @@ class SentryOkHttpInterceptorTest { private val fixture = Fixture() private val getRequest = { Request.Builder().get().url(fixture.server.url("/hello")).build() } - private val postRequest = { Request.Builder().post("request-body".toRequestBody("text/plain".toMediaType())).url(fixture.server.url("/hello")).build() } + private val postRequest = { Request.Builder().post("request-body" + .toRequestBody("text/plain" + .toMediaType())).url(fixture.server.url("/hello")).build() } @Test fun `when there is an active span, adds sentry trace header to the request`() { @@ -117,6 +125,7 @@ class SentryOkHttpInterceptorTest { }) } + @SuppressWarnings("SwallowedException") @Test fun `adds breadcrumb when http calls results in exception`() { val chain = mock() @@ -126,19 +135,24 @@ class SentryOkHttpInterceptorTest { try { fixture.interceptor.intercept(chain) fail() - } catch (e: IOException) {} - + } catch (e: IOException) { + // ignore me + } verify(fixture.hub).addBreadcrumb(check { assertEquals("http", it.type) }) } + @SuppressWarnings("SwallowedException") @Test fun `sets status and throwable when call results in IOException`() { val sut = fixture.getSut(socketPolicy = SocketPolicy.DISCONNECT_AT_START) try { sut.newCall(getRequest()).execute() - } catch (e: IOException) {} + fail() + } catch (e: IOException) { + // ignore + } val httpClientSpan = fixture.sentryTracer.children.first() assertEquals(SpanStatus.INTERNAL_ERROR, httpClientSpan.status) assertTrue(httpClientSpan.throwable is IOException) From 2427f695f36c3aa743f28108078f400b99607746 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Wed, 5 May 2021 11:30:48 +0200 Subject: [PATCH 7/7] fix --- .../android/okhttp/SentryOkHttpInterceptorTest.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt b/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt index 9e23351173..921673d89b 100644 --- a/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt +++ b/sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt @@ -40,10 +40,12 @@ class SentryOkHttpInterceptorTest { whenever(hub.options).thenReturn(SentryOptions()) } - fun getSut(isSpanActive: Boolean = true, - httpStatusCode: Int = 201, - responseBody: String = "success", - socketPolicy: SocketPolicy = SocketPolicy.KEEP_OPEN): OkHttpClient { + fun getSut( + isSpanActive: Boolean = true, + httpStatusCode: Int = 201, + responseBody: String = "success", + socketPolicy: SocketPolicy = SocketPolicy.KEEP_OPEN + ): OkHttpClient { if (isSpanActive) { whenever(hub.span).thenReturn(sentryTracer) }