square/gradle-dependencies-sorter

Support for custom functions in implementation module

kozaxinan opened this issue · 1 comments

We have following some methods that we use to add conditional dependency based on variants.

dependencies {
  addX()
  addY()
  implementation()
  testImplementation()
}

fun DependencyHandlerScope.addX() {}
fun DependencyHandlerScope.addY() {}

This gives parsing errors.

Issue also happens on 0.3-SNAPSHOT.

Caused by: com.squareup.parse.BuildScriptParseException: 1: no viable alternative at input 'addX()'
	at app//com.squareup.parse.BuildScriptParseException$Companion.withErrors(BuildScriptParseException.kt:9)
	at app//com.squareup.sort.Sorter.rewritten(Sorter.kt:76)
	at com.squareup.sort.SorterSpec.keep identical dependencies that have non-identical comments(SorterSpec.groovy:421)

Thanks for the issue. Providing support for arbitrary functionality like this is outside of the scope of what we can support.