Gradle Task on kotlin. Declaration OutputFile value

836 Views Asked by At

I want to write very simple task, which downloads a zip and unzip current file.

open class HelmInstall : DefaultTask() {

    @Input
    var downloadUrl = "https://someZip"

    @Input
    var destDir: String = ".helm"


    @TaskAction
    fun start() {
        val dir = project.buildDir.resolve(destDir)
        /*
        some logic by upload from downloadUrl 
        */
        val file = dir.resolve("nameOfApp").write(text)

        helm.set(file )

    }

    @OutputFile
    var helm: RegularFileProperty = project.objects.fileProperty()

}

It builds, but when I try apply my task I have error

Caused by: org.gradle.api.InvalidUserDataException: No value has been specified for property 'helm'.
    at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:71)

how should I declare helm so that there is no error? And maybe you now good helm plugin or client? And useful lib for download and unzip file?

0

There are 0 best solutions below