forked from MelonCode/X-Mas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
101 lines (88 loc) · 3.37 KB
/
build.gradle
File metadata and controls
101 lines (88 loc) · 3.37 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
plugins {
id 'java'
}
group = 'com.onemb.xmas'
version = '2.0.1-024'
def projectVersion = version.toString()
def javaRelease = 25
def paperCompileVersion = '26.1.2.build.20-alpha'
def paperCompatibilityFloor = '1.21.11'
def sharedServersRoot = file(System.getenv('CODEX_SHARED_SERVERS_ROOT') ?: '/Users/floris/Projects/Codex/servers')
def sharedPaperCache = new File(sharedServersRoot, 'cache/Paper-26.1.2')
def paper2612LibrariesDir = new File(sharedPaperCache, 'libraries')
def paper2612Api = new File(sharedPaperCache, "libraries/io/papermc/paper/paper-api/${paperCompileVersion}/paper-api-${paperCompileVersion}.jar")
def placeholderApiJar = new File(sharedPaperCache, 'plugins/PlaceholderAPI-2.12.3-DEV-265.jar')
def paper2612ArchiveName = "1MB-XMas-2026-v${projectVersion}-v25-26.1.2.jar"
[
[paper2612Api, "Paper API jar"],
[paper2612LibrariesDir, "Paper libraries directory"],
[placeholderApiJar, "PlaceholderAPI jar"],
].each { entry ->
File path = entry[0] as File
String label = entry[1] as String
if (!path.exists()) {
throw new GradleException("${label} not found at ${path}. This project now uses the centralized Paper cache under ${sharedServersRoot}.")
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(javaRelease)
}
}
dependencies {
compileOnly files(paper2612Api)
compileOnly fileTree(dir: paper2612LibrariesDir, include: '**/*.jar')
compileOnly files(placeholderApiJar)
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = javaRelease
}
tasks.named('processResources') {
filteringCharset = 'UTF-8'
filesMatching('plugin.yml') {
expand(
version: projectVersion,
apiVersionFloor: paperCompatibilityFloor
)
}
}
tasks.named('jar') {
archiveFileName = paper2612ArchiveName
}
tasks.register('releaseJar', Copy) {
description = 'Copies the newest plugin jar into libs/ for the centralized Paper runner.'
group = 'build'
dependsOn tasks.named('jar')
from(tasks.named('jar'))
into(layout.projectDirectory.dir('libs'))
}
tasks.register('paper2612Jar') {
description = 'Assembles the Paper 26.1.2 Java 25 plugin jar and copies it into libs/.'
group = 'build'
dependsOn tasks.named('releaseJar')
}
tasks.register('printBuildConfig') {
description = 'Prints the active centralized build and compatibility configuration.'
group = 'help'
doLast {
println 'XMasTree build config'
println " version: ${projectVersion}"
println " compile target: Paper API ${paperCompileVersion}"
println " plugin api-version floor: ${paperCompatibilityFloor}"
println " java release target: ${javaRelease}"
println " centralized Paper cache: ${sharedPaperCache}"
println " PlaceholderAPI compile jar: ${placeholderApiJar}"
println " build/libs output: ${layout.buildDirectory.file("libs/${paper2612ArchiveName}").get().asFile}"
println " libs/ release copy: ${layout.projectDirectory.file("libs/${paper2612ArchiveName}").asFile}"
}
}
tasks.register('buildAllJars') {
description = 'Builds the current Paper 26.1.2 target jar and copies it into libs/.'
group = 'build'
dependsOn tasks.named('releaseJar')
finalizedBy tasks.named('printBuildConfig')
}
tasks.named('assemble') {
dependsOn tasks.named('paper2612Jar')
}