forked from cavallium/CoordinatesObfuscator
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
102 lines (87 loc) · 2.94 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
buildscript {
repositories {
mavenCentral()
}
}
plugins {
java
`java-library`
id("com.gradleup.shadow") version "8.3.3"
id("com.palantir.git-version") version "3.1.0"
`maven-publish`
}
val gitVersion: groovy.lang.Closure<String> by extra
group = "com.jtprince"
version = gitVersion()
val pluginYmlApiVersion: String by project
val paperApiVersion: String by project
val javaVersion: JavaLanguageVersion = JavaLanguageVersion.of(17)
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots") // Adventure (required by PacketEvents)
maven("https://repo.codemc.org/repository/maven-public/") // PacketEvents
}
dependencies {
// API dependencies: Not shaded into plugin, but needed for API consumers
api("org.jetbrains:annotations:24.0.1")
// Compile Only dependencies: Neither shaded nor needed by API consumers (assumed they'll already add it themselves)
compileOnly("io.papermc.paper:paper-api:$paperApiVersion")
// Shade and Relocate: Shaded into plugin, exposed to API consumers with relocated names if necessary
implementation("com.github.retrooper:packetevents-spigot:2.7.1-SNAPSHOT")
implementation("org.bstats:bstats-bukkit:3.0.2")
implementation("com.jeff-media:MorePersistentDataTypes:2.4.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
testImplementation("io.papermc.paper:paper-api:$paperApiVersion")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
java {
toolchain {
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)
languageVersion.set(javaVersion)
}
}
tasks {
processResources {
val placeholders = mapOf(
"version" to version.toString().trimStart('v'),
"apiVersion" to pluginYmlApiVersion,
)
placeholders.forEach { (k, v) -> inputs.property(k, v) } // ensure cache is invalidated after version bumps
filesMatching(listOf("plugin.yml", "config.yml")) {
expand(placeholders)
}
}
jar {
archiveClassifier.set("thin")
}
shadowJar {
archiveClassifier.set("")
isEnableRelocation = true
relocationPrefix = "${project.group}.lib"
minimize()
}
register<Copy>("buildSnapshot") {
// Copy the latest artifact from `assemble` task to a consistent place for symlinking into a server.
dependsOn(shadowJar)
from(shadowJar)
into("build")
rename { "${rootProject.name}-SNAPSHOT.jar" }
}
assemble {
dependsOn(shadowJar)
}
test {
useJUnitPlatform()
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
groupId = "com.jtprince"
artifactId = "CoordinateOffset"
}
}
}