Hey all, I've a doubt regarding kotlin-dsl for and...
# android
k
Hey all, I've a doubt regarding kotlin-dsl for android gradle projects: In conventional gradle-groovy based project s, we used to get some warnings/suggestions for new version releases of any library. When I shift all my versions from groovy file to a "dependencies.kt" file, it seems like I lose the ability to get such notifications. Is there any way to make that work? Am I missing something?
z
You’ll have to use a different way to explicitly manage your dependencies. There’s many, but one is #gradle-refresh-versions from @louiscad
👍 1
😊 1
l
Agreed, that's the one I use, though I'm not the sole author 🙃
e
in future, Gradle may have a built-in way to handle centralized dependency versions: https://github.com/gradle/gradle/pull/14896
gradle itself doesn't give any notification of outdated dependencies 😞 https://github.com/gradle/gradle/issues/13498 so there's a few other options, such as ^^ the aforementioned gradle refreshVersions plugin, or the gradle versions plugin (which I'm currently using)
l
refreshVersions will keep working with possible upcoming Gradle way of grouping dependency maven coordinates declarations FYI.
v
As Gradle does not have any warnings / suggestions about new library versions you probably used some tool or plugin already for that. I guess during the transition you maybe forgot to apply it or something like that. If it was a tool you used, it hopefully is not DSL-language specific, that would be quite strange.
e
Android Lint has some rules that parse dependencies from gradle files and provide hints on a few specific outdated libraries/versions. this doesn't work if it's not formatted exactly like
dependencies { implementation("g:a:v") }
or
dependencies { implementation(group = ..., name = ..., version = ...) }
I think IntelliJ might do something like that too
v
Oh, that sounds so wrong 😄
And I'm not aware of IJ doing that, never seen something like that.
Or do you think there also only for Android?
e
just tested this out… this is Android Studio, but not an Android project
I don't have base IJ installed to test, but I would be surprised if this was add-on functionality by AS
v
Can you have a look at the three dots to tell me the name of that inspection?
e
Issue id: GradleDependency
v
Hm, that inspection is present and enabled, but it does not trigger on what you show in your screenshot. Besides that it is in the
Android -> Lint -> Correctness
category
e
oh I see why. did this in a non-Android project that applies Android Lint (because it works and we have some useful custom rules)
ok, so it's (mostly) just Android then