1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package org.jetbrains import org.gradle.api.Project fun Project.whenEvaluated(action: Project.() -> Unit) { if (state.executed) { action() } else { afterEvaluate { action() } } } fun Project.invokeWhenEvaluated(action: (project: Project) -> Unit) { whenEvaluated { action(this) } }