Skip to content

Commit

Permalink
Bind spotlessCheck to compileJava to make sure all dependency modules…
Browse files Browse the repository at this point in the history
… run spotlessCheck
  • Loading branch information
cool9850311 committed Jan 6, 2025
1 parent 1405824 commit 0f32589
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -501,22 +501,8 @@ subprojects {
exclude("test/**")
}
}

afterEvaluate {
val implConfig = configurations.findByName("implementation") ?: return@afterEvaluate

val projectDeps = implConfig.dependencies
.filterIsInstance<ProjectDependency>()
.filter { it.dependencyProject.plugins.hasPlugin("com.diffplug.spotless") }

tasks.named("spotlessCheck").configure {
projectDeps.forEach { dep ->
val spotlessTask = "${dep.dependencyProject.path}:spotlessCheck"
if (tasks.findByPath(spotlessTask) != null) {
dependsOn(spotlessTask)
}
}
}
tasks.named("compileJava").configure {
dependsOn("spotlessCheck")
}
}

Expand Down

0 comments on commit 0f32589

Please sign in to comment.