hi all... i am trying to do the following, but unf...
# kotlin-dsl
c
hi all... i am trying to do the following, but unfortunately, I am getting an error saying that the property
usingComposeCompiler
don't have a configured value....
Copy code
fun Project.configure() {
    if (tasks.findByName(TASK_NAME) != null) {
        val taskA = tasks.named(TASK_NAME, CheckComposeAllowListTask::class.java)
        val taskB = tasks.withType(KotlinCompile::class.java)
        val booleanOutput: Property<Boolean> = objects.property(Boolean::class.java)

        taskA.configure {
            usingComposeCompiler.set(booleanOutput)
        }
        taskB.configureEach {
            doFirst {
                val usingComposeCompiler = kotlinOptions.freeCompilerArgs.any { arg ->
                    arg.contains("androidx.compose.compiler")
                }
                booleanOutput.set(usingComposeCompiler)
            }
            finalizedBy(taskA)
        }
    }
}
what i am trying to do is that, i configure TaskA with a property that will later be set from TaskB.doFirst.....i am actually not sure if this is the right way to approach it.
v
No, you should not change the configuration at execution time. And when you ever want to use configuration cache you even cannot.
c
how would i achieve what i need? I am trying to make sense of Provider/Property, so far, i have no luck.
v
I don't know, as I don't know what it is you really need. You could for example store something in a fine output of a task and then feed that output to an input of another task. Or you could store some value in a shared build service in one task execution phase and read it from another task's execution phase
But that has nothing really to do with properties and providers
And properties and providers also have nothing to do with Kotlin DSL, so you are probably in the wrong channel