dropbox / dependency-guard

A Gradle plugin that guards against unintentional dependency changes.
Apache License 2.0
390 stars 14 forks source link

Create single task for tree configuration #77

Open qwert2603 opened 1 year ago

qwert2603 commented 1 year ago

Now the separated DependencyTreeDiffTask instance is created for each guarded configuration.

But that is not necessary, because the dependencies tree rendering is done by DependencyGraphsRenderer in AsciiDependencyReportRenderer2, that can be used with different configurations, depending on passed ResolvedComponentResult.

So rendering, comparing and baselining dependencies tree for all can be performed in one single task, like for the list configuration in DependencyGuardListTask.

Also, depending on the code complexity, handling list and task configurations may be done in the single task, since they have a lot of similar configs and logic.

handstandsam commented 1 year ago

Thanks! I don't mind "combining" the tasks, but would want to keep their logic very separated in the codebase as they are similar, but very different.

I like the saying: "Write code so it can be deleted". As long as it is super easy to delete or refactor out the List or Tree task with a couple lines, I'm happy to only have 2 tasks total - dependencyGuard and dependencyGuardBaseline.

Good idea!

qwert2603 commented 1 year ago

Yes, agree. The first point is to create single tree task for all configurations.

And after that there may be some combining of list and tree tasks, if it will make the code easier to read and support.