-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
build.gradle.kts
126 lines (104 loc) · 3.32 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
plugins {
java
application
`maven-publish`
}
subprojects {
apply(plugin = "java")
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
}
val mainClass = "io.papermc.paperclip.Main"
tasks.jar {
val java6Jar = project(":java6").tasks.named("jar")
val java17Jar = project(":java17").tasks.named("shadowJar")
dependsOn(java6Jar, java17Jar)
from(zipTree(java6Jar.map { it.outputs.files.singleFile }))
from(zipTree(java17Jar.map { it.outputs.files.singleFile }))
manifest {
attributes(
"Main-Class" to mainClass
)
}
from(file("license.txt")) {
into("META-INF/license")
rename { "paperclip-LICENSE.txt" }
}
rename { name ->
if (name.endsWith("-LICENSE.txt")) {
"META-INF/license/$name"
} else {
name
}
}
}
val sourcesJar by tasks.registering(Jar::class) {
val java6Sources = project(":java6").tasks.named("sourcesJar")
val java17Sources = project(":java17").tasks.named("sourcesJar")
dependsOn(java6Sources, java17Sources)
from(zipTree(java6Sources.map { it.outputs.files.singleFile }))
from(zipTree(java17Sources.map { it.outputs.files.singleFile }))
archiveClassifier.set("sources")
}
val isSnapshot = project.version.toString().endsWith("-SNAPSHOT")
publishing {
publications {
register<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
artifact(sourcesJar)
withoutBuildIdentifier()
pom {
val repoPath = "PaperMC/Paperclip"
val repoUrl = "https://github.com/$repoPath"
name.set("Paperclip")
description.set(project.description)
url.set(repoUrl)
packaging = "jar"
licenses {
license {
name.set("MIT")
url.set("$repoUrl/blob/main/license.txt")
distribution.set("repo")
}
}
issueManagement {
system.set("GitHub")
url.set("$repoUrl/issues")
}
developers {
developer {
id.set("DemonWav")
name.set("Kyle Wood")
email.set("demonwav@gmail.com")
url.set("https://github.com/DemonWav")
}
}
scm {
url.set(repoUrl)
connection.set("scm:git:$repoUrl.git")
developerConnection.set("scm:git:git@github.com:$repoPath.git")
}
}
}
repositories {
val url = if (isSnapshot) {
"https://repo.papermc.io/repository/maven-snapshots/"
} else {
"https://repo.papermc.io/repository/maven-releases/"
}
maven(url) {
credentials(PasswordCredentials::class)
name = "paper"
}
}
}
}
tasks.register("printVersion") {
doFirst {
println(version)
}
}