Skip to content

Commit 017cdbd

Browse files
committed
Added extra method for TaskProviders
1 parent 6a566dd commit 017cdbd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

buildSrc/src/main/java/com/google/firebase/gradle/plugins/ProjectUtils.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import org.gradle.api.Project
1717
import org.gradle.api.Task
1818
import org.gradle.api.artifacts.Configuration
1919
import org.gradle.api.attributes.Attribute
20+
import org.gradle.api.provider.Provider
2021

2122
fun Project.isAndroid(): Boolean =
2223
listOf("com.android.application", "com.android.library", "com.android.test")
@@ -63,6 +64,14 @@ fun <T : Task, R : Task> T.dependsOnAndMustRunAfter(otherTask: R) {
6364
dependsOn(otherTask)
6465
}
6566

67+
/**
68+
* Utility method to call [Task.mustRunAfter] and [Task.dependsOn] on the specified task
69+
*/
70+
fun <T : Task, R : Task> T.dependsOnAndMustRunAfter(otherTask: Provider<R>) {
71+
mustRunAfter(otherTask)
72+
dependsOn(otherTask)
73+
}
74+
6675
/**
6776
* Utility method to call [Task.mustRunAfter] and [Task.dependsOn] on the specified task name
6877
*/

0 commit comments

Comments
 (0)