All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.name.remal.gradle_plugins.plugins.vcs.WriteAutoVcsVersionInFileTask.kt Maven / Gradle / Ivy

There is a newer version: 1.9.2
Show newest version
package name.remal.gradle_plugins.plugins.vcs

import name.remal.createParentDirectories
import name.remal.gradle_plugins.dsl.BuildTask
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File

@BuildTask
class WriteAutoVcsVersionInFileTask : DefaultTask() {

    @get:OutputFile
    var file: File = project.buildDir.resolve("auto-vcs-version.txt")

    @get:Input
    protected val version: String
        get() = project.version.toString()

    @TaskAction
    protected fun doWriteAutoVcsVersionInFile() {
        logger.lifecycle("Writing version '{}' to file: {}", version, file)
        file.createParentDirectories().writeText(version)
        didWork = true
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy