@@ -8,10 +8,9 @@ import org.gradle.kotlin.dsl.extra
8
8
9
9
const val ktLintFormatVersion = " 0.48.2"
10
10
const val googleJavaFormatVersion = " 1.15.0"
11
- private const val spotlessDisable = " org.jsonschema2dataclass.internal.spotless.disable"
11
+ private const val EXTRA_SPOTLESS_DISABLE = " org.jsonschema2dataclass.internal.spotless.disable"
12
12
13
- @Suppress(" unused" )
14
- class InternalPlugin : Plugin <Project > {
13
+ class SpotlessPlugin : Plugin <Project > {
15
14
override fun apply (project : Project ) {
16
15
project.plugins.withId(" com.diffplug.spotless" ) {
17
16
applySpotless(project)
@@ -20,42 +19,43 @@ class InternalPlugin : Plugin<Project> {
20
19
}
21
20
22
21
private fun applySpotless (project : Project ) {
23
- val spotlessDisable = project.extra.has(spotlessDisable) && project.extra[spotlessDisable].toString().toBoolean()
22
+ val spotlessDisable = project.extra.has(EXTRA_SPOTLESS_DISABLE ) &&
23
+ project.extra[EXTRA_SPOTLESS_DISABLE ].toString().toBoolean()
24
24
project.extensions.configure(SpotlessExtension ::class .java) {
25
25
if (spotlessDisable) {
26
26
this .isEnforceCheck = false
27
27
}
28
28
kotlin {
29
- targetExclude(" .idea" , " **/.idea" , " **/build" )
29
+ targetExclude(" .idea/** " , " **/.idea/** " , " **/build" )
30
30
target(" **/*.kt" )
31
31
ktlint(ktLintFormatVersion)
32
32
endWithNewline()
33
33
}
34
34
kotlinGradle {
35
- targetExclude(" .idea" , " **/.idea" , " **/build" )
35
+ targetExclude(" .idea/** " , " **/.idea/** " , " **/build" )
36
36
target(" **/*.kts" )
37
37
ktlint(ktLintFormatVersion)
38
38
endWithNewline()
39
39
}
40
40
json {
41
- targetExclude(" .idea" , " **/.idea" , " **/build" )
41
+ targetExclude(" .idea/** " , " **/.idea/** " , " **/build" )
42
42
target(" **/*.json" )
43
43
jackson()
44
44
endWithNewline()
45
45
}
46
46
yaml {
47
- targetExclude(" .idea" , " **/.idea" , " **/build" )
47
+ targetExclude(" .idea/** " , " **/.idea/** " , " **/build" )
48
48
target(" **/*.yaml" )
49
49
jackson()
50
50
endWithNewline()
51
51
}
52
52
format(" xml" ) {
53
- targetExclude(" .idea" , " **/.idea" , " **/build" )
53
+ targetExclude(" .idea/** " , " **/.idea/** " , " **/build" )
54
54
target(" **/*.xml" )
55
55
eclipseWtp(EclipseWtpFormatterStep .XML )
56
56
}
57
57
java {
58
- targetExclude(" .idea" , " **/.idea" , " **/build" )
58
+ targetExclude(" .idea/** " , " **/.idea/** " , " **/build" )
59
59
target(" **/*.java" )
60
60
googleJavaFormat(googleJavaFormatVersion)
61
61
}
0 commit comments