generated from tozydev/kotlin-paper-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
107 lines (97 loc) · 3.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
@file:Suppress("UnstableApiUsage")
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.maven.publish) apply false
}
val publishProjectNames = setOf(projects.forasCore, projects.forasAdventure, projects.forasJackson).map { it.name }
val kotlinJvmId =
libs.plugins.kotlin.jvm
.get()
.pluginId
val ktlintId =
libs.plugins.ktlint
.get()
.pluginId
val mavenPublishId =
libs.plugins.maven.publish
.get()
.pluginId
subprojects {
if (name in publishProjectNames) {
apply(plugin = mavenPublishId)
}
plugins.withId(kotlinJvmId) {
apply(plugin = ktlintId)
dependencies {
"compileOnly"(kotlin("stdlib"))
}
val jdkVersion: String by project
extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion = JavaLanguageVersion.of(jdkVersion)
}
}
extensions.configure<KotlinJvmProjectExtension> {
compilerOptions {
jvmTarget = JvmTarget.fromTarget(jdkVersion)
}
}
extensions.configure<TestingExtension> {
suites {
named<JvmTestSuite>(JavaPlugin.TEST_TASK_NAME) {
useKotlinTest(libs.versions.kotlin)
}
}
}
}
repositories {
mavenCentral()
}
plugins.withType<com.vanniktech.maven.publish.MavenPublishPlugin> {
extensions.configure<PublishingExtension> {
repositories {
maven {
name = "vela"
url =
if (version.toString().endsWith("-SNAPSHOT")) {
uri("https://vela.nguyenthanhtan.id.vn/snapshots/")
} else {
uri("https://vela.nguyenthanhtan.id.vn/releases/")
}
credentials(PasswordCredentials::class)
}
}
}
extensions.configure<MavenPublishBaseExtension> {
signAllPublications()
pom {
inceptionYear.set("2024")
url = "https://github.com/tozydev/foras/"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://github.com/tozydev/foras/blob/main/LICENSE"
distribution = "repo"
}
}
developers {
developer {
id = "tozydev"
name = "Nguyễn Thanh Tân"
email = "[email protected]"
url = "https://nguyenthanhtan.id.vn"
}
}
scm {
url = "https://github.com/tozydev/foras/"
connection = "scm:git:git://github.com/tozydev/foras.git"
developerConnection = "scm:git:git://github.com/tozydev/foras.git"
}
}
}
}
}