Open SimonMarquis opened 1 year ago
🤔 . The reason why I printed it and then it's part of the exception is that I didn't know how to add color to the exception message, and I loved the color. Any tips here?
I do too 🌈 But what I don't understand is why we need the same message in both stdout and as Gradle error. In the "tree" mode we only have it on the stdout (not in the Gradle error).
Also, it seems you disabled to colors explicitely here:
Without this, colors are visible in the Gradle exception.
Though it does not play nice with is some places where rich output is unsupported like here for instance:
We might be able to ask Gradle what the current behavior is with this: https://docs.gradle.org/current/userguide/command_line_interface.html#sec:command_line_customizing_log_format or use Gradle's own internal StyledTextOutput
.
Happy to accept a PR regarding this. I personally only use tree
format locally when trying to track down where a transitive dependency came from. That being said, I don't use it much, and don't have much of an opinion about the messaging.
If you would like to update/improve the messaging for tree
, I'm open to it!
--
Because it's a plaintext string and not console output, it just looks like some crazy encoded characters if you don't do it that way unfortunately.
StyledTextOutput
sounds nice. I'd love to use something built in.
Additionally I dislike the double messages, but now I remember why I did it: In our CI system, it only bubbles up the exception to users when looking at a PR. If I did not add it to the exception, then users had to dig really deep, so for me at this time, it's a requirement. I'm open to having a flag for this if it's undesirable for others.
Also, if you want to just chat about any of this, feel free to message me on Slack (Kotlin, Gradle, or ASG).
Ok, this makes more sense now. Then I guess there is no one solution fits all. And adding even more settings to configure the desired output feels like the wrong approach for this kind of plugin.
Gradle's StyledTextOutput
has been moved to their internal
package, so I would not rely on this to work across many Gradle versions.
List and Tree modes throw different exception content.
Tree
List
As you can see, the List output contains the diff twice. Moreover, the colored diff output is generally hidden, and only the last bit appear, which is the
GradleException
message. (and the first line is different as well) Do you think we could harmonize this behavior?https://github.com/dropbox/dependency-guard/blob/56ba80d9612e5de24a1d9e722f9befaf9ef19a47/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/utils/DependencyGuardTreeDiffer.kt#L66-L72
https://github.com/dropbox/dependency-guard/blob/56ba80d9612e5de24a1d9e722f9befaf9ef19a47/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/list/DependencyGuardListTask.kt#L105