forked from aasmus/PvPToggle
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
102 lines (87 loc) · 2.89 KB
/
build.gradle
File metadata and controls
102 lines (87 loc) · 2.89 KB
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
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
id("com.gradleup.shadow") version "9.3.0"
}
group = 'PvpToggle'
version = '1.7.3-017'
def pluginDisplayName = '1MB-PvPToggle'
def pluginVersion = version.toString()
def pluginApiCompatibilityFloor = '1.21.11'
def paperApiDependencyVersion = "${pluginApiCompatibilityFloor}-R0.1-SNAPSHOT"
def javaTarget = 25
def paperRuntimeTarget = '26.1.2'
java {
toolchain.languageVersion = JavaLanguageVersion.of(javaTarget)
}
repositories {
mavenCentral()
maven {
name = "papermc"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven {
name = "placeholderAPI"
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:${paperApiDependencyVersion}")
compileOnly("net.kyori:adventure-text-minimessage:4.26.1")
compileOnly("net.kyori:adventure-text-serializer-legacy:4.26.1")
compileOnly("net.kyori:adventure-text-serializer-plain:4.26.1")
compileOnly("me.clip:placeholderapi:2.11.7")
implementation("org.jspecify:jspecify:1.0.0")
}
jar {
enabled = false
}
shadowJar {
archiveFileName.set("${pluginDisplayName}-v${project.version}-j${javaTarget}-${paperRuntimeTarget}.jar")
}
def shadowJarProvider = tasks.named("shadowJar")
def shadowJarFileProvider = shadowJarProvider.flatMap { it.archiveFile }
def shadowJarNameProvider = shadowJarProvider.map { it.archiveFileName.get() }
assemble {
dependsOn(shadowJar)
}
def copyReleaseJar = tasks.register("copyReleaseJar", Copy) {
dependsOn(shadowJarProvider)
from(shadowJarFileProvider)
into(layout.projectDirectory.dir("libs"))
}
def printBuildConfig = tasks.register("printBuildConfig") {
dependsOn(shadowJarProvider)
doLast {
def jarName = shadowJarNameProvider.get()
println "Plugin: ${pluginDisplayName}"
println "Version: ${pluginVersion}"
println "Java target: ${javaTarget}"
println "Paper API dependency: ${paperApiDependencyVersion}"
println "Paper runtime target: ${paperRuntimeTarget}"
println "plugin.yml api-version floor: ${pluginApiCompatibilityFloor}"
println "Shadow jar: build/libs/${jarName}"
println "Release jar: libs/${jarName}"
}
}
processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [
version: project.version,
apiVersion: pluginApiCompatibilityFloor
]
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
tasks.withType(JavaCompile).configureEach {
options.release.set(javaTarget)
options.compilerArgs += ['-Xlint:deprecation']
}
tasks.named("build") {
dependsOn(copyReleaseJar)
finalizedBy(printBuildConfig)
}