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

Removing okhttp testing deobfuscation #180

Merged
merged 1 commit into from
Dec 11, 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
10 changes: 0 additions & 10 deletions auto-instrumentation/okhttp/okhttp-3.0/testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ plugins {
id("net.bytebuddy.byte-buddy-gradle-plugin")
}

android {
buildTypes {
debug {
isMinifyEnabled = true
Copy link
Member

Choose a reason for hiding this comment

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

I might be wrong but I guess isMinifyEnabled is NoOp for debug builds, not sure if this has something to do with the problem you've faced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if that's the reason because it seems to work well when the desugaring is disabled 🤔 The problem I saw with desugaring enabled is that it seems like the corelib classes are trimmed by R8, even though I add rules to keep them... Specifically, the test crashed because the function Duration.toMillis wasn't found, and the error was mentioning the class like so: Lj$/time/Duration;. I'm guessing j$ is the shade name given by Google's desugaring to the corelib classes.

Based on that, I tried to avoid it by adding these rules:

-keep class java.time.** { *; }
-keep class j$.time.** { *; }

But no luck, they seem to be ignored.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it was done on API 33.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@marandaneto marandaneto Dec 11, 2023

Choose a reason for hiding this comment

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

nvm, thats what this PR does and the java.time requires desugaring so I guess its the right solution.

proguardFile("proguard-rules.pro")
testProguardFile("proguard-test-rules.pro")
}
}
}

dependencies {
byteBuddy(project(":auto-instrumentation:okhttp:okhttp-3.0:agent"))
implementation(project(":auto-instrumentation:okhttp:okhttp-3.0:library"))
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.publish.maven.MavenPublication

plugins {
id("com.android.application")
id("otel.errorprone-conventions")
Expand All @@ -20,11 +17,13 @@ android {
val javaVersion = rootProject.extra["java_version"] as JavaVersion
sourceCompatibility(javaVersion)
targetCompatibility(javaVersion)
isCoreLibraryDesugaringEnabled = true
}
}

val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
dependencies {
androidTestImplementation(libs.findLibrary("androidx-test-runner").get())
androidTestImplementation(libs.findLibrary("opentelemetry-sdk-testing").get())
coreLibraryDesugaring(libs.findLibrary("desugarJdkLibs").get())
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.publish.maven.MavenPublication

plugins {
id("com.android.library")
id("otel.errorprone-conventions")
Expand Down