aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin/org/jetbrains/projectUtils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/kotlin/org/jetbrains/projectUtils.kt')
-rw-r--r--buildSrc/src/main/kotlin/org/jetbrains/projectUtils.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/buildSrc/src/main/kotlin/org/jetbrains/projectUtils.kt b/buildSrc/src/main/kotlin/org/jetbrains/projectUtils.kt
new file mode 100644
index 00000000..46d803a5
--- /dev/null
+++ b/buildSrc/src/main/kotlin/org/jetbrains/projectUtils.kt
@@ -0,0 +1,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) }
+}
+