-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
178 lines (155 loc) · 5.19 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import com.vanniktech.maven.publish.SonatypeHost
import dev.teogor.winds.api.MavenPublish
import dev.teogor.winds.api.getValue
import dev.teogor.winds.api.model.Developer
import dev.teogor.winds.api.model.LicenseType
import dev.teogor.winds.api.model.createVersion
import dev.teogor.winds.api.provider.Scm
import dev.teogor.winds.gradle.utils.afterWindsPluginConfiguration
import dev.teogor.winds.gradle.utils.attachTo
import org.jetbrains.dokka.gradle.DokkaPlugin
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.ceres.android.hilt) apply false
alias(libs.plugins.ceres.android.room) apply false
alias(libs.plugins.winds) apply true
alias(libs.plugins.vanniktech.maven) apply true
alias(libs.plugins.dokka) apply true
alias(libs.plugins.spotless) apply true
alias(libs.plugins.api.validator) apply true
}
winds {
buildFeatures {
mavenPublish = true
docsGenerator = true
}
mavenPublish {
displayName = "Stitch"
name = "stitch"
canBePublished = false
description =
"\uD83E\uDEA1 Stitch handles the Room boilerplate, including automatic generation of repositories, dependency injection integration, and flexible customizations."
groupId = "dev.teogor.stitch"
artifactIdElements = 1
url = "https://source.teogor.dev/stitch"
version = createVersion(1, 0, 0) {
alphaRelease(2)
}
inceptionYear = 2024
sourceControlManagement(
Scm.Git(
owner = "teogor",
repo = "stitch",
),
)
addLicense(LicenseType.APACHE_2_0)
addDeveloper(TeogorDeveloper())
}
docsGenerator {
name = "Stitch"
identifier = "stitch"
alertOnDependentModules = true
}
}
afterWindsPluginConfiguration { winds ->
// TODO winds
// required by dokka
group = winds.mavenPublish.groupId ?: "undefined"
version = winds.mavenPublish.version ?: "undefined"
if (!plugins.hasPlugin("com.gradle.plugin-publish")) {
val mavenPublish: MavenPublish by winds
if (mavenPublish.canBePublished) {
mavenPublishing {
publishToMavenCentral(SonatypeHost.S01)
signAllPublications()
@Suppress("UnstableApiUsage")
pom {
coordinates(
groupId = mavenPublish.groupId!!,
artifactId = mavenPublish.artifactId!!,
version = mavenPublish.version!!.toString(),
)
mavenPublish attachTo this
}
}
}
}
}
data class TeogorDeveloper(
override val id: String = "teogor",
override val name: String = "Teodor Grigor",
override val email: String = "open-source@teogor.dev",
override val url: String = "https://teogor.dev",
override val roles: List<String> = listOf("Code Owner", "Developer", "Designer", "Maintainer"),
override val timezone: String = "UTC+2",
override val organization: String = "Teogor",
override val organizationUrl: String = "https://github.com/teogor",
) : Developer
val ktlintVersion = "0.50.0"
val excludedProjects = listOf(
project.name,
"app",
)
subprojects {
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",
"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>()
}
}