-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
103 lines (96 loc) · 3.71 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
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishBasePlugin
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.KtlintPlugin
import org.openjfx.gradle.JavaFXOptions
import org.openjfx.gradle.JavaFXPlugin
val developerId: String by project
val developerName: String by project
val developerUrl: String by project
val releaseGroup: String by project
val releaseArtifact: String by project
val releaseVersion: String by project
val releaseDescription: String by project
val releaseUrl: String by project
val jdkVersion = JavaLanguageVersion.of(libs.versions.jdk.get())
val jreVersion = JavaLanguageVersion.of(libs.versions.jre.get())
plugins {
alias(libs.plugins.javafx) apply false
kotlin("jvm") version libs.versions.kotlin apply false
kotlin("kapt") version libs.versions.kotlin apply false
alias(libs.plugins.dokka)
alias(libs.plugins.kotlinx.kover) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.maven.publish) apply false
}
allprojects {
group = releaseGroup
version = releaseVersion
}
subprojects {
plugins.withType<JavaFXPlugin>().configureEach {
the<JavaFXOptions>().version = libs.versions.javafx.get()
}
plugins.withType<KotlinPluginWrapper>().configureEach {
the<KotlinJvmProjectExtension>().jvmToolchain(jdkVersion.asInt())
}
plugins.withType<KtlintPlugin>().configureEach {
the<KtlintExtension>().version.set(libs.versions.ktlint.get())
}
plugins.withType<MavenPublishBasePlugin> {
configure<MavenPublishBaseExtension> {
configure(KotlinJvm(JavadocJar.Dokka("dokkaJavadoc")))
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
pom {
name.set(project.name)
description.set(releaseDescription)
url.set(releaseUrl)
inceptionYear.set("2024")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set(developerId)
name.set(developerName)
url.set(developerUrl)
}
}
scm {
url.set(releaseUrl)
connection.set("scm:git:https://github.com/$developerId/$releaseArtifact.git")
developerConnection.set("scm:git:ssh://[email protected]/$developerId/$releaseArtifact.git")
}
}
}
}
tasks {
withType<JavaCompile>().configureEach {
options.release = jreVersion.asInt()
}
withType<KotlinCompile>().configureEach {
compilerOptions.jvmTarget
.set(JvmTarget.fromTarget(JavaVersion.toVersion(jreVersion).toString()))
}
}
}
tasks {
register(LifecycleBasePlugin.CLEAN_TASK_NAME) {
delete(layout.buildDirectory)
}
dokkaHtmlMultiModule {
outputDirectory.set(layout.buildDirectory.dir("dokka/dokka/"))
}
}