gradle-use-latest-versions-plugin icon indicating copy to clipboard operation
gradle-use-latest-versions-plugin copied to clipboard

Support for `properties.gradle.kts`?

Open u-ways opened this issue 3 years ago • 1 comments

Hello,

Are there any plans to support extra properties.gradle.kts version formats? Example:

// properties.gradle.kts file
val fooVersion by extra("1.5.0-RC")
val barVersion by extra("1920")

Usage

// build.gradle.kts file
plugins {
    kotlin("jvm") version "1.5.0" apply false
    id("se.patrikerdes.use-latest-versions") version "0.2.15" apply false
}

allprojects {
    apply(from = "${rootProject.rootDir}/properties.gradle.kts")
    apply(plugin = "se.patrikerdes.use-latest-versions")

    val fooVersion: String by extra
    val barVersion: String by extra

    tasks.named<UseLatestVersionsTask>("useLatestVersions").configure {
        doFirst {
            updateWhitelist = FileReader(File("${project.buildDir}/identifyDependencies/identified-dependencies.txt")).readText().split(",")
            rootVersionFiles = listOf("properties.gradle.kts")
        }
        updateRootProperties = true

        dependsOn("identifyDependencies")
        mustRunAfter("identifyDependencies")
    }

    tasks.register<identifyDependenciesTask>("identifyDependencies") {
        // will create a file with property names to update. i.e.
        // -> org.x:foo
        // -> org.x:bar
        propertyNames = project.propertyOrBlank("propertyNames").split(",")
    }

    dependencies {
        implementation("org.x:foo:$fooVersion")
        testImplementation("org.x:bar:$barVersion")
    }
}

Running gw useLatestVersions -PpropertyNames=fooVersion does not update the versions in build.gradle.kts. Am I doing anything wrong here?

Thanks :D

u-ways avatar Aug 24 '21 15:08 u-ways

Sounds like a bug. Or maybe feature request. Anyway, sounds like something that is reasonable to support.

patrikerdes avatar Aug 25 '21 11:08 patrikerdes