-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
178 lines (162 loc) · 5.3 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
val kotestVersion: String by project
val kotlinVersion: String by project
val liquibaseVersion: String by project
val artifactIdPrefix: String by project
val artifactVersion: String by project
val artifactGroup: String by project
plugins {
kotlin("jvm")
id("io.gitlab.arturbosch.detekt") version "1.23.7"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
`maven-publish`
id("io.deepmedia.tools.deployer") version "0.17.0"
id("org.jetbrains.dokka") version "2.0.0"
}
group = artifactGroup
version = artifactVersion
description = "Liquibase kotlin(DSL, Wrapper client, ORM integration)"
fun validateArtifactVersion(artifactVersion: String) {
val (artifactVersionLiquibase, artifactVersionLiquibaseKotlin) = artifactVersion.split("-")
require(artifactVersionLiquibase == liquibaseVersion) {
"artifactVersion is not matched `liquibaseVersion`"
}
require(artifactVersionLiquibaseKotlin.isNotEmpty()) {
"specify the version after the `-` character of `artifactVersion`"
}
}
if (artifactVersion.isNotEmpty()) {
validateArtifactVersion(artifactVersion)
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
withSourcesJar()
withJavadocJar()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
}
}
allprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "io.gitlab.arturbosch.detekt")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
repositories {
mavenCentral()
// for snapshot version
maven {
url = uri("https://maven.pkg.github.com/liquibase/liquibase")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.token") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
freeCompilerArgs.addAll(listOf("-Xjvm-default=all"))
}
}
detekt {
parallel = true
autoCorrect = true
config.from("$rootDir/config/detekt/detekt.yml")
buildUponDefaultConfig = true
basePath = rootDir.absolutePath
}
ktlint {
version.set("1.3.1")
filter {
exclude { entry ->
entry.file.toString().contains("/generated/")
}
}
}
}
val libraryProjects =
subprojects.filter {
// To prevent accidental publishing, use a allowlist.
it.name in listOf(
// dsl
"dsl",
// parser
"script-parser",
"script-parser-exterior",
"compiled-parser",
// serializer
"serializer-core",
"script-serializer",
"compiled-serializer",
// client
"command-client",
"client",
// custom-change
"custom-komapper-jdbc-change",
"custom-jooq-change",
"custom-change-core",
"custom-exposed-migration-change",
"custom-ktorm-change",
// starter
"starter-compiled",
"starter-script"
)
}
configure(libraryProjects) {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "maven-publish")
apply(plugin = "io.deepmedia.tools.deployer")
apply(plugin = "org.jetbrains.dokka")
version = rootProject.version
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
val javadocs = tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
deployer {
val projectUrl: String by project
val artifactVersion: String by project
val autherName: String by project
val autherEmail: String by project
projectInfo {
name = rootProject.name
description = rootProject.description
url = projectUrl
groupId = artifactGroup
artifactId = "$artifactIdPrefix-${project.name}"
scm {
fromGithub(autherName, artifactIdPrefix)
}
license(apache2)
developer(autherName, autherEmail)
}
content {
component {
sources(sourcesJar)
docs(javadocs)
fromJava()
}
}
release {
release.version = artifactVersion
release.tag = artifactVersion
release.description = project.description
}
centralPortalSpec {
auth.user = secret("CENTRAL_PORTAL_USER")
auth.password = secret("CENTRAL_PORTAL_PASSWORD")
signing.key = secret("SIGNING_KEY")
signing.password = secret("SIGNING_PASSWORD")
// Publish manually from this link https://central.sonatype.com/publishing
allowMavenCentralSync = false
}
localSpec {}
}
}
dependencies {}