-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
151 lines (140 loc) · 5.81 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
import io.papermc.hangarpublishplugin.model.Platforms
import net.kyori.indra.licenser.spotless.IndraSpotlessLicenserPlugin
import java.util.*
plugins {
`maven-publish`
signing
id("io.papermc.hangar-publish-plugin") version "0.1.2"
id("com.gradleup.shadow") version "8.3.2" apply false
id("net.kyori.indra.licenser.spotless") version "3.1.3"
java
}
group = Version.PROJECT_GROUP
version = Version.PROJECT_VERSION
subprojects {
apply {
plugin<MavenPublishPlugin>()
plugin<SigningPlugin>()
plugin("java")
plugin<IndraSpotlessLicenserPlugin>()
}
indraSpotlessLicenser {
newLine(true)
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
}
tasks {
gradle.projectsEvaluated {
javadoc {
(options as StandardJavadocDocletOptions).tags(
"apiNote:a:API Note",
"implSpec:a:Implementation Requirements",
"implNote:a:Implementation Note"
)
}
signing {
val signingKey = findProperty("signingKey")?.toString() ?: System.getenv("SIGNING_KEY")
val signingPassword = findProperty("signingPassword")?.toString() ?: System.getenv("SIGNING_PASSWORD")
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign(publishing.publications)
}
publishing {
repositories {
maven(
if (project.publishingVersion().endsWith("-SNAPSHOT"))
"https://s01.oss.sonatype.org/content/repositories/snapshots/" else "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
) {
name = "ossrh"
credentials {
username =
project.findProperty("sonatypeUsername") as String?
?: System.getenv("SONATYPE_USERNAME")
password =
project.findProperty("sonatypePassword") as String?
?: System.getenv("SONATYPE_PASSWORD")
}
}
}
publications {
create<MavenPublication>(rootProject.name) {
from(this@subprojects.components["java"])
groupId = rootProject.group.toString().lowercase(Locale.getDefault())
artifactId = project.name
version = project.publishingVersion()
pom {
name.set(project.name)
description.set(project.description)
url.set("https://github.com/JvstvsHD/necrify")
packaging = "jar"
developers {
developer {
name.set("JvstvsHD")
}
}
licenses {
license {
name.set("GNU General Public License v3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.en.html")
}
}
scm {
connection.set("scm:git:git://github.com/JvstvsHD/necrify.git")
url.set("https://github.com/JvstvsHD/necrify/tree/main")
}
}
}
}
}
}
}
}
hangarPublish {
publications.register("necrify") {
version.set(buildVersion())
channel.set(if (!rootProject.isRelease) "Snapshot" else "Release")
id.set("necrify")
apiKey.set(System.getenv("HANGAR_API_TOKEN") ?: "")
if (!rootProject.isRelease) {
changelog.set(changelogMessage())
} else {
changelog.set("Changes will be provided shortly.\nComplete changelog can be found on GitHub: https://www.github.com/JvstvsHD/necrify/releases/tag/v${rootProject.version}")
}
platforms {
register(Platforms.PAPER) {
jar.set((project(":necrify-paper").tasks.getByName("shadowJar") as Jar).archiveFile)
val versions: List<String> = (property("paperVersion") as String)
.split(",")
.map { it.trim() }
platformVersions.set(versions)
}
register(Platforms.VELOCITY) {
jar.set((project(":necrify-velocity").tasks.getByName("shadowJar") as Jar).archiveFile)
val versions: List<String> = (property("velocityVersion") as String)
.split(",")
.map { it.trim() }
platformVersions.set(versions)
}
}
}
}
tasks {
register<Javadoc>("alljavadoc") {
title = "Necrify " + buildVersion()
(options as StandardJavadocDocletOptions).tags(
"apiNote:a:API Note",
"implSpec:a:Implementation Requirements",
"implNote:a:Implementation Note"
)
setDestinationDir(file("${layout.buildDirectory.get()}/docs/javadoc"))
val projects = rootProject.allprojects
setSource(projects.map { project -> project.sourceSets.main.get().allJava })
classpath = files(projects.map { project -> project.sourceSets.main.get().compileClasspath })
}
}