-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
114 lines (95 loc) · 3.14 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.shadow)
alias(libs.plugins.sonatype.central.portal.publisher)
`maven-publish`
}
val baseVersion = "0.0.1"
val commitHash = System.getenv("COMMIT_HASH")
val snapshotversion = "${baseVersion}-dev.$commitHash"
allprojects {
group = "app.simplecloud.droplet"
version = if (commitHash != null) snapshotversion else baseVersion
repositories {
mavenCentral()
maven("https://buf.build/gen/maven")
maven("https://repo.simplecloud.app/snapshots")
}
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "net.thebugmc.gradle.sonatype-central-portal-publisher")
apply(plugin = "maven-publish")
dependencies {
testImplementation(rootProject.libs.kotlin.test)
implementation(rootProject.libs.kotlin.jvm)
}
kotlin {
jvmToolchain(21)
compilerOptions {
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
}
publishing {
repositories {
maven {
name = "simplecloud"
url = uri("https://repo.simplecloud.app/snapshots/")
credentials {
username = System.getenv("SIMPLECLOUD_USERNAME")?: (project.findProperty("simplecloudUsername") as? String)
password = System.getenv("SIMPLECLOUD_PASSWORD")?: (project.findProperty("simplecloudPassword") as? String)
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}
centralPortal {
name = project.name
username = project.findProperty("sonatypeUsername") as? String
password = project.findProperty("sonatypePassword") as? String
pom {
name.set("Metrics Droplet")
description.set("Keep track of your metrics")
url.set("https://github.com/theSimpleCloud/metrics-droplet")
developers {
developer {
id.set("fllipeis")
email.set("p.eistrach@gmail.com")
}
}
licenses {
license {
name.set("Apache-2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/theSimpleCloud/metrics-droplet.git")
connection.set("git:git@github.com:theSimpleCloud/metrics-droplet.git")
}
}
}
signing {
if (commitHash != null) {
return@signing
}
sign(publishing.publications)
useGpgCmd()
}
tasks.named("shadowJar", ShadowJar::class) {
mergeServiceFiles()
archiveFileName.set("${project.name}.jar")
}
tasks.test {
useJUnitPlatform()
}
}