I am trying to process with sed the following shell output from Gradle to recognize and colorize the severity levels:
23:06:28.686 [LIFECYCLE] [system.out]
23:06:28.686 [QUIET] [system.out] Note: the configuration keeps the entry point 'androidx.core.graphics.drawable.IconCompatParcelizer { android.support.v4.graphics.drawable.IconCompat read(androidx.versionedparcelable.VersionedParcel); }', but not the descriptor class 'androidx.versionedparcelable.VersionedParcel'
23:06:28.686 [QUIET] [system.out] Note: the configuration keeps the entry point 'androidx.core.graphics.drawable.IconCompatParcelizer { void write(android.support.v4.graphics.drawable.IconCompat,androidx.versionedparcelable.VersionedParcel); }', but not the descriptor class 'androidx.versionedparcelable.VersionedParcel'
23:06:28.710 [QUIET] [system.out] Note: there were 5 references to unknown classes.
23:06:28.711 [QUIET] [system.out] You should check your configuration for typos.
23:06:28.711 [QUIET] [system.out] (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
23:06:28.711 [QUIET] [system.out] Note: there were 2 unkept descriptor classes in kept class members.
23:06:28.711 [QUIET] [system.out] You should consider explicitly keeping the mentioned classes
23:06:28.711 [QUIET] [system.out] (using '-keep').
23:06:28.711 [QUIET] [system.out] (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
23:06:28.711 [QUIET] [system.out] Note: there were 12 unresolved dynamic references to classes or interfaces.
23:06:28.711 [QUIET] [system.out] You should check if you need to specify additional program jars.
23:06:28.711 [QUIET] [system.out] (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
23:06:28.711 [ERROR] [system.err] Warning: there were 11 unresolved references to classes or interfaces.
23:06:28.711 [ERROR] [system.err] You may need to add missing library jars or update their versions.
23:06:28.711 [ERROR] [system.err] If your code works fine without the missing classes, you can suppress
23:06:28.711 [ERROR] [system.err] the warnings with '-dontwarn' options.
23:06:28.711 [ERROR] [system.err] (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
23:06:28.711 [QUIET] [system.out] Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
23:06:28.585 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger]
I use the following shell script:
#!/bin/sh
c_red=`tput setaf 1`
c_end=`tput sgr0`
./gradlew --info --debug assemble | sed -E -e "s/(\[ERROR\])/${c_red}\1${c_end}/g" \
Here is a screenshot of the unprocessed output:
Here is a screenshot of the processed output:
Besides the missing color I noticed that some lines of the output are lost in the processed output. Further, Gradle itself seems to colorize certain word as one can see in the unprocessed output. The control characters from Gradle and what I use in the sed command might interfere.
If I choose LIFECYCLE instead of ERROR then the script works somewhat. Some lines are lost there too! And the Gradle colorization disappears.
I am running this on the Terminal on Ubuntu 16.04.


