Gradle Kotlin-DSL has double quotes and parenthesis
jmfayard opened this issue · 7 comments
Can you add an option --format=[kotlin|groovy]
to generate the dependency information compatible with build.gradle
for groovy and build.gradle.kts
for kotlin?
Ideally calling with no format argument should use the previous value
--format=kotlin would be like this:
dependencies {
implementation("com.squareup.picaso:picaso:2.5.2")
}
it doesn't work without ()
anymore?
Correct,
- in kotlin
build.gradle.kts
, it doesn't work without()
(implementation is a normal extension method) - in kotlin
build.gradle.kts
, it doesn't work with simple quotes (like in java) - in groovy
build.gradle,
implementation("com.squareup.picaso:picaso:2.5.2")` with parenthesis and double quotes is actually an accepted syntax.
So actually, instead of having an option --format=kotlin|groovy
, we could just change the dependency format to implementation("com.squareup.picaso:picaso:2.5.2")
and be compatible with both!
@cesarferreira would you be interested by a pull-request where I change the output so that it works both in a build.gradle
and a build.gradle.kts
file?
dependencies {
- implementation 'com.squareup.picaso:picaso:2.5.2'
+ implementation("com.squareup.picaso:picaso:2.5.2")
}
Yes please @jmfayard
@cesarferreira done! The first line of ruby I ever wrote, hopefully not wrong :)
It works, thanks for the PR
btw @jmfayard love the idea on your lib https://github.com/jmfayard/gradle-kotlin-dsl-libs