ModuleCheck icon indicating copy to clipboard operation
ModuleCheck copied to clipboard

Support Gradle 7.0's type-safe project accessors in auto-correct

Open RBusarow opened this issue 4 years ago • 2 comments

https://docs.gradle.org/7.0-rc-1/userguide/declaring_dependencies.html#sec:type-safe-project-accessors

dependencies {
  // type-safe alternative to project(":commons:utils:numbers")
  implementation(projects.commons.utils.numbers)
}

RBusarow avatar Mar 23 '21 12:03 RBusarow

This is currently partially working.

ModuleCheck always knows the traditional, non-type-safe path. From here, it's easy to determine what the string value for the type-safe accessor would be.

  • :core becomes core
  • :core:jvm becomes core.jvm
  • :core-testing becomes coreTesting
  • :base:ui:navigation becomes base.ui.navigation

Because we can figure out the type-safe version, we're able to look for type-safe versions inside the dependency blocks. So, removing or modifying an existing type-safe reference works.

Adding type-safe accessors is not working.

RBusarow avatar Feb 24 '22 20:02 RBusarow

This was surprisingly working well for me when I tried. The main benefit of this tool is to find what can be removed so it is ok if adding part does not work :D

tasomaniac avatar Mar 09 '22 21:03 tasomaniac