mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-13 21:56:59 +05:30
fix(gradle): only allow Spotless plugin to be applied to the root project
This commit is contained in:
parent
a1390a0f05
commit
720f946f41
1 changed files with 4 additions and 0 deletions
|
@ -7,6 +7,7 @@ package dev.msfjarvis.aps.gradle
|
|||
|
||||
import com.diffplug.gradle.spotless.SpotlessExtension
|
||||
import com.diffplug.gradle.spotless.SpotlessPlugin
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
|
@ -16,6 +17,9 @@ import org.gradle.kotlin.dsl.getByType
|
|||
class SpotlessPlugin : Plugin<Project> {
|
||||
|
||||
override fun apply(project: Project) {
|
||||
if (project.rootProject != project) {
|
||||
throw GradleException("Spotless plugin must only be applied to the root project.")
|
||||
}
|
||||
project.pluginManager.apply(SpotlessPlugin::class)
|
||||
project.extensions.getByType<SpotlessExtension>().run {
|
||||
kotlin {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue