Luis Cardoza Bird
Luis Cardoza Bird

Reputation: 1482

Check for dependencies update with kotlin-dsl

This question has already been asked before, however the solution is still unknown... Kotlin DSL build scripts dependency updates

With the new implementation of kotlin-dsl. Now the imports looks like this.

implementation Koin.core
implementation Koin.android

and the buildSrc.

object Versions{
    const val koin = "2.0.1"
}

object Koin {
    val core = "org.koin:koin-core:${Versions.koin}"
    val android = "org.koin:koin-android:${Versions.koin}"
    val scope = "org.koin:koin-androidx-scope:${Versions.koin}"
    val viewModel = "org.koin:koin-androidx-viewmodel:${Versions.koin}"
    val extension = "org.koin:koin-androidx-ext:${Versions.koin}"
    val test = "org.koin:koin-test:${Versions.koin}"
}

in this case Koin is using a previous version, but i know that there's a new version https://github.com/InsertKoinIO/koin

anyone knows how to check if the dependencies has a newer version with kotlin-dsl?

Upvotes: 7

Views: 4640

Answers (2)

Arst
Arst

Reputation: 3307

I made this plugin. Dependency Updates Commenter. Just apply plugin and add annotation to the dependency properties and execute commentDependencyUpdates task. This is the example:

object Junit {
    const val junit = "junit:junit:4.12"
}
import io.github.zeroarst.dependencyupdatescommenter.CommentUpdates

object Junit {
    // Available versions:
    // 4.13-rc-2
    // 4.13-rc-1
    // 4.13-beta-3
    // 4.13-beta-2
    // 4.13-beta-1
    @CommentUpdates
    const val junit = "junit:junit:4.12"
}

Upvotes: 0

dnh
dnh

Reputation: 577

I've tested this Gradle Dependencies Update Check Plugin on my Android/Kotlin DSL build (with a separate Versions class with versions definitions) and it works fine for me:

CheckDependencyUpdates Gradle Plugin

(I've also tested that it works with a traditional Groovy-DSL project)

To install the plugin (copied from linked page) add the following to your build.gradle.kts. Note that I've removed the version number from this as it will, unlike the page I've linked to, get out of date:

plugins {
  id("name.remal.check-dependency-updates")
}

To run the update check (copied from gradle tasks) run the following:

gradle checkDependencyUpdates

You will see an output section similar to the following:

New dependency version: com.android.tools.build:aapt2: 3.6.1-6040484 -> 3.6.3-6040484
New dependency version: com.android.tools.lint:lint-gradle: 26.6.1 -> 26.6.3

Upvotes: 7

Related Questions