Skip to content

Commit 682fa0c

Browse files
committed
Fix minification of ByteBuddy 1.12.6 by disabling optimizations
This allows us to limit the extra entry points to just the agent code. It does increase the JAR size by about 0.1MB (now 2.3MB in total) but it should be significantly less fragile and it's still much smaller than the raw JAR (4.8MB). 30% size increase, but at least half due to a real increase in size of ByteBuddy itself.
1 parent 795890b commit 682fa0c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,13 @@ task distJar(type: Jar) {
143143
// Pull raw advice classes from the shadow JAR, unminified:
144144
from (zipTree(shadowJar.getArchiveFile())) {
145145
include "tech/httptoolkit/javaagent/advice/**/*"
146+
include "tech/httptoolkit/relocated/net/bytebuddy/agent/builder/**/*"
146147
}
147148

148149
// Pull other source & bundled dependencies in their minified form, from R8:
149150
from (zipTree(r8Jar.outputs.files[0])) {
150151
exclude "tech/httptoolkit/javaagent/advice/**/*"
152+
exclude "tech/httptoolkit/relocated/net/bytebuddy/agent/builder/**/*"
151153
}
152154
}
153155

r8-rules.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
-dontobfuscate
2+
-dontoptimize
23
-allowaccessmodification
34
-keepattributes SourceFile, LineNumberTable, *Annotation*
45

5-
-keep class tech.httptoolkit.relocated.net.bytebuddy.utility.Invoker { *; }
6+
-keep class tech.httptoolkit.relocated.net.bytebuddy.agent.builder.** { *; }
67

78
-keep class tech.httptoolkit.javaagent.** { *; }
89
-keep class tech.httptoolkit.relocated.net.bytebuddy.asm.** { *; }

0 commit comments

Comments
 (0)