square / gradle-dependencies-sorter

A CLI app and Gradle plugin to sort the dependencies in your Gradle build scripts
Apache License 2.0
260 stars 12 forks source link

Feature request: support dependency configuration syntax #24

Open ZacSweers opened 1 year ago

ZacSweers commented 1 year ago

Some dependences can include a trailing lambda to further configure the dependency

implementation(libs.someExternalSdk) {
  artifact {
    name = "some-external-sdk"
    type = "aar"
  }
}
autonomousapps commented 1 year ago

Is this a feature request or a bug? I thought the grammar could already handle trailing lambas? For example, I think we have a test verifying that it supports { because 'reason' }.

technoir42 commented 1 year ago

@autonomousapps one example where sorting currently produces invalid code:

 dependencies {
-    apiImplementation project(":Utils")
-
     implementation(project(":MyProject")) {
         capabilities {
             requireCapability("com.my.lib:api")
         }
-    }
+
+    apiImplementation project(":Utils")
+}
     runtimeOnly project(":OtherProject")