How to replace a token in resource file using Kotlin DSL

Viewed 1392

What would be the equivament of the following in Kotlin DSL (build.gradle.kts)?

processResources {
    from(sourceSets.main.resources.srcDirs) {
        filter ReplaceTokens, tokens: [version: version]
    }
}
1 Answers

It's actually super easy:

tasks.processResources {
    expand("version" to project.version)
}

And then just put ${version} in resource and it will be replaced with your project version

Related