Skip to content

Commit

Permalink
Drop @SourceDebugExtension as well
Browse files Browse the repository at this point in the history
  • Loading branch information
izhangzhihao committed Jun 5, 2023
1 parent fd98853 commit 87306a3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Unmeta Kotlin gradle plugin 🐘

A Gradle plugin to remove all Kotlin @Metadata and @DebugMetadata annotations from the compile output and jars.
A Gradle plugin to remove all Kotlin @Metadata / @DebugMetadata / @SourceDebugExtension annotations from the compile output and jars.

Kotlin @Metadata and @DebugMetadata annotations are not fully processed by ProGuard / R8 and contain un-obfuscated symbol information, both in binary and plain text forms. This information can be used to more easily reverse engineer your code.

This plugin allows removing all Kotlin @Metadata / @DebugMetadata annotations from generated class files. This is safe to do as long as:
This plugin allows removing all Kotlin @Metadata / @DebugMetadata / @SourceDebugExtension annotations from generated class files. This is safe to do as long as:

* you do not intend to use the resulting binaries as a Kotlin library (@Metadata annotations are used to determine Kotlin function definitions),
* you are not using Kotlin Reflection (certain reflection functionality depends on the presence of the @Metadata annotations).
Expand All @@ -14,7 +14,7 @@ This plugin allows removing all Kotlin @Metadata / @DebugMetadata annotations fr
```kotlin
plugins {
kotlin("jvm")
id("io.github.izhangzhihao.unmeta") version "1.0.0"
id("io.github.izhangzhihao.unmeta") version "1.0.1"
}

unmeta {
Expand Down Expand Up @@ -42,8 +42,8 @@ gradle.taskGraph.whenReady {

```kotlin
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.10'
id "io.github.izhangzhihao.unmeta" version "1.0.0"
id 'org.jetbrains.kotlin.jvm' version '1.8.21'
id "io.github.izhangzhihao.unmeta" version "1.0.1"
}

unmeta {
Expand Down Expand Up @@ -84,7 +84,7 @@ You might need this to force the `unmeta` task runs before the `jar` task:

```kotlin
jar {
mustRunAfter("unmeta")
mustRunAfter("unmeta")
}
```

Expand Down
2 changes: 1 addition & 1 deletion example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
kotlin("jvm")
id("io.github.izhangzhihao.unmeta") version "1.0.0"
id("io.github.izhangzhihao.unmeta") version "1.0.1"
}

unmeta {
Expand Down
2 changes: 1 addition & 1 deletion plugin-build/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ID=io.github.izhangzhihao.unmeta
VERSION=1.0.0
VERSION=1.0.1
GROUP=io.github.izhangzhihao
DISPLAY_NAME=Unmeta Kotlin classes plugin
DESCRIPTION=Remove @Metadata and @DebugMetadata annotation from your Kotlin classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class UnmetaClassVisitor(private val path: String, cv: ClassVisitor, private val
modified = true
null
}
"Lkotlin/jvm/internal/SourceDebugExtension;" -> {
logger.debug("Removed @SourceDebugExtension annotation from $path")
modified = true
null
}
else -> {
super.visitAnnotation(desc, visible)
}
Expand Down

0 comments on commit 87306a3

Please sign in to comment.