Skip to content

Commit

Permalink
Use mustRunAfter for depending on source gen tasks + add back schema …
Browse files Browse the repository at this point in the history
…task (#1098)

This is the correct way to set this up as we don't have specific
dependencies and don't necessarily require them to run if they don't
need to

<!--
  ⬆ Put your description above this! ⬆

  Please be descriptive and detailed.
  
Please read our [Contributing
Guidelines](https://github.com/tinyspeck/foundry/blob/main/.github/CONTRIBUTING.md)
and [Code of Conduct](https://slackhq.github.io/code-of-conduct).

Don't worry about deleting this, it's not visible in the PR!
-->
  • Loading branch information
ZacSweers authored Nov 15, 2024
1 parent df11f7d commit 2708162
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package foundry.gradle.tasks

import app.cash.sqldelight.gradle.GenerateSchemaTask
import app.cash.sqldelight.gradle.SqlDelightTask
import com.android.build.gradle.internal.tasks.databinding.DataBindingGenBaseClassesTask
import com.google.devtools.ksp.gradle.KspAATask
Expand All @@ -30,27 +31,30 @@ internal fun TaskProvider<*>.mustRunAfterSourceGeneratingTasks(project: Project)
// Kapt
project.pluginManager.withPlugin("org.jetbrains.kotlin.kapt") {
configure {
dependsOn(project.tasks.withType(KaptGenerateStubs::class.java))
dependsOn(project.tasks.withType(KaptTask::class.java))
mustRunAfter(project.tasks.withType(KaptGenerateStubs::class.java))
mustRunAfter(project.tasks.withType(KaptTask::class.java))
}
}
// KSP
project.pluginManager.withPlugin("com.google.devtools.ksp") {
configure {
dependsOn(project.tasks.withType(KspTask::class.java))
dependsOn(project.tasks.withType(KspAATask::class.java))
mustRunAfter(project.tasks.withType(KspTask::class.java))
mustRunAfter(project.tasks.withType(KspAATask::class.java))
}
}
// ViewBinding
project.pluginManager.withPlugin("com.android.base") {
configure { dependsOn(project.tasks.withType(DataBindingGenBaseClassesTask::class.java)) }
configure { mustRunAfter(project.tasks.withType(DataBindingGenBaseClassesTask::class.java)) }
}
// SqlDelight
project.pluginManager.withPlugin("app.cash.sqldelight") {
configure { dependsOn(project.tasks.withType(SqlDelightTask::class.java)) }
configure {
mustRunAfter(project.tasks.withType(SqlDelightTask::class.java))
mustRunAfter(project.tasks.withType(GenerateSchemaTask::class.java))
}
}
// Wire
project.pluginManager.withPlugin("com.squareup.wire") {
configure { dependsOn(project.tasks.withType(WireTask::class.java)) }
configure { mustRunAfter(project.tasks.withType(WireTask::class.java)) }
}
}

0 comments on commit 2708162

Please sign in to comment.