Skip to content

Commit 4a8f872

Browse files
authored
Merge pull request #313 from MaximillianLeonov/replace-allprojects-with-subprojects
Replace allprojects block with subprojects block
2 parents 63880bd + 28b48b3 commit 4a8f872

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

gradle/init.gradle.kts

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,28 @@ initscript {
2828
}
2929
}
3030

31-
allprojects {
32-
if (this == rootProject) {
33-
return@allprojects
34-
}
35-
apply<com.diffplug.gradle.spotless.SpotlessPlugin>()
36-
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
37-
kotlin {
38-
target("**/*.kt")
39-
targetExclude("**/build/**/*.kt")
40-
ktlint(ktlintVersion).userData(mapOf("android" to "true"))
41-
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
42-
}
43-
format("kts") {
44-
target("**/*.kts")
45-
targetExclude("**/build/**/*.kts")
46-
// Look for the first line that doesn't have a block comment (assumed to be the license)
47-
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")
48-
}
49-
format("xml") {
50-
target("**/*.xml")
51-
targetExclude("**/build/**/*.xml")
52-
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
53-
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
31+
rootProject {
32+
subprojects {
33+
apply<com.diffplug.gradle.spotless.SpotlessPlugin>()
34+
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
35+
kotlin {
36+
target("**/*.kt")
37+
targetExclude("**/build/**/*.kt")
38+
ktlint(ktlintVersion).userData(mapOf("android" to "true"))
39+
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
40+
}
41+
format("kts") {
42+
target("**/*.kts")
43+
targetExclude("**/build/**/*.kts")
44+
// Look for the first line that doesn't have a block comment (assumed to be the license)
45+
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")
46+
}
47+
format("xml") {
48+
target("**/*.xml")
49+
targetExclude("**/build/**/*.xml")
50+
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
51+
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
52+
}
5453
}
5554
}
56-
}
55+
}

0 commit comments

Comments
 (0)