feat: add Kotlin/Android error and stacktrace compression#8
Open
Cyvid7-Darus10 wants to merge 1 commit intojee599:mainfrom
Open
feat: add Kotlin/Android error and stacktrace compression#8Cyvid7-Darus10 wants to merge 1 commit intojee599:mainfrom
Cyvid7-Darus10 wants to merge 1 commit intojee599:mainfrom
Conversation
Adds a new `contextzip gradle` command that compresses Kotlin compiler
errors, Android/JVM stack traces, and Gradle build noise.
- Kotlin compiler errors (e:/w: lines) are collected and summarized
- Android/JVM stack frames from framework packages (android.*, kotlin.*,
java.*, androidx.*, dalvik.*, etc.) are collapsed with a count
- Gradle task lines are collapsed into a single count summary
- Gradle download and configuration noise is stripped
- BUILD SUCCESSFUL/FAILED result lines are always preserved
- Caused-by exception chains are preserved
Registered as `contextzip gradle {build,test,lint}` with passthrough
for other Gradle subcommands. Added .kt/.kts extension mapping to the
Java language for code filtering. Includes 7 unit tests covering
compiler errors, stacktrace compression, task collapse, and mixed
output scenarios.
Closes jee599#2
91347e6 to
7378864
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses #2 by adding a Kotlin/Android filter to contextzip. I took a look at how the existing filters work (cargo_cmd, go_cmd, error_cmd) and followed the same pattern for Gradle/Kotlin.
The new
contextzip gradlecommand handles three kinds of noise that Android developers deal with constantly. First, Kotlin compiler errors — thosee:andw:lines get collected and presented as a numbered summary instead of being buried in build output. Second, Android/JVM stack traces — framework frames fromandroid.*,androidx.*,java.*,kotlin.*,kotlinx.*,dalvik.*, and friends get collapsed into a "(+ N framework frames hidden)" line while your app code stays visible. Third, Gradle task spam — those 30+ "> Task :app:compileSomething" lines that nobody reads get collapsed into a single "(N Gradle tasks executed)" summary. The BUILD SUCCESSFUL/FAILED line is always preserved.Here is what the before/after looks like for a typical Android build failure:
Before (raw Gradle output):
After (contextzip gradle build):
And for stack traces, a typical Android crash that spits out 15+ framework frames gets compressed to just your app frames plus a hidden count.
The implementation registers
contextzip gradle {build,test,lint}as subcommands with passthrough for any other Gradle tasks. I also added.kt/.ktsextension mapping to the Java language infilter.rsfor code filtering, and added thegradle/gradlew/./gradlewpattern todiscover/rules.rsso the hook can automatically rewrite gradle commands. All 1056 existing tests still pass along with the 7 new ones I added.Closes #2