-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
115 lines (103 loc) · 3.51 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import org.jetbrains.dokka.gradle.DokkaPlugin
buildscript {
repositories {
google()
mavenCentral()
}
}
// Lists all plugins used throughout the project without applying them.
plugins {
// Kotlin Plugins
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.jetbrains.kotlin.serialization) apply false
// Maven Publishing Plugins
alias(libs.plugins.vanniktech.maven) apply false
// API Documentation and Validation Plugins
alias(libs.plugins.jetbrains.dokka) apply true
alias(libs.plugins.spotless) apply true
alias(libs.plugins.api.validator) apply true
alias(libs.plugins.ben.manes.versions) apply true
alias(libs.plugins.littlerobots.version.catalog.update) apply true
}
// Explicitly set the group and version for all subprojects
allprojects {
group = "dev.teogor.winds"
version = "1.0.2"
}
val ktlintVersion = "0.50.0"
val excludedProjects = listOf(
project.name,
)
subprojects {
if (!excludedProjects.contains(this.name)) {
apply<com.diffplug.gradle.spotless.SpotlessPlugin>()
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("**/build/**/*.kt")
ktlint(ktlintVersion)
.editorConfigOverride(
mapOf(
"ij_kotlin_allow_trailing_comma" to "true",
// These rules were introduced in ktlint 0.46.0 and should not be
// enabled without further discussion. They are disabled for now.
// See: https://github.com/pinterest/ktlint/releases/tag/0.46.0
"disabled_rules" to
"filename," +
"annotation,annotation-spacing," +
"argument-list-wrapping," +
"double-colon-spacing," +
"enum-entry-name-case," +
"multiline-if-else," +
"no-empty-first-line-in-method-block," +
"package-name," +
"trailing-comma," +
"spacing-around-angle-brackets," +
"spacing-between-declarations-with-annotations," +
"spacing-between-declarations-with-comments," +
"unary-op-spacing," +
"no-trailing-spaces," +
"no-wildcard-imports," +
"max-line-length",
),
)
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
trimTrailingWhitespace()
endWithNewline()
}
format("kts") {
target("**/*.kts")
targetExclude("**/build/**/*.kts")
// Look for the first line that doesn't have a block comment (assumed to be the license)
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/**/*.xml")
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
}
}
}
}
apiValidation {
/**
* Subprojects that are excluded from API validation
*/
ignoredProjects.addAll(excludedProjects)
}
subprojects {
if (!excludedProjects.contains(project.name)) {
apply<DokkaPlugin>()
}
}
versionCatalogUpdate {
keep {
// keep versions without any library or plugin reference
keepUnusedVersions = true
// keep all libraries that aren't used in the project
keepUnusedLibraries = true
// keep all plugins that aren't used in the project
keepUnusedPlugins = true
}
}