-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
105 lines (92 loc) · 3.58 KB
/
build.gradle
File metadata and controls
105 lines (92 loc) · 3.58 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
103
104
105
plugins {
id 'java'
id 'eclipse'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.4'
id 'xyz.jpenilla.run-paper' version '2.3.1'
id 'xyz.jpenilla.run-velocity' version '2.3.1'
// id 'io.github.goooler.shadow' version '8.1.8'
}
group = 'org.zeroBzeroT'
version = "${project.plugin_version}"
repositories {
mavenCentral()
maven {
url = 'https://repo.papermc.io/repository/maven-public/'
content {
includeGroup 'com.velocitypowered'
}
}
}
dependencies {
compileOnly group: 'com.velocitypowered', name: 'velocity-api', version: "${project.velocity_api_version}"
annotationProcessor group: 'com.velocitypowered', name: 'velocity-api', version: "${project.velocity_api_version}"
// implementation group: 'org.bstats', name: 'bstats-velocity', version: '3.1.0'
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
tasks.withType(JavaCompile).configureEach {
it.sourceCompatibility = it.targetCompatibility = JavaVersion.toVersion(21)
it.options.release = 21
it.options.encoding = 'UTF-8'
}
// template file for compile-time value injection
def templateSource = file('src/main/templates')
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
def generateTemplates = tasks.register('generateTemplates', Copy) { task ->
def props = ['version': project.version]
task.inputs.properties props
task.from templateSource
task.into templateDest
task.expand props
}
sourceSets.main.java.srcDir(generateTemplates.map { it.outputs })
/*
shadowJar {
configurations = [project.configurations.shadow]
archiveFileName = "${project.name}-${project.version}+${project.velocity_api_version}_velocity.jar"
destinationDirectory = layout.buildDirectory.dir('dist')
relocate "org.bstats", "org.zeroBzeroT.anarchyqueue.shaded.bstats"
// delete unshaded jar
doLast {
file(jar.archiveFile).delete()
}
}
build.finalizedBy(shadowJar)
*/
// put jar artifact in build/dist/
jar.destinationDirectory.set(layout.buildDirectory.dir('dist'))
// test setup
runPaper.disablePluginJarDetection()
tasks {
runVelocity {
runDirectory = layout.projectDirectory.dir('run').dir('proxy')
velocityVersion("${project.velocity_api_version}")
dependsOn('build')
downloadPlugins {
url("https://github.com/ViaVersion/ViaBackwards/releases/download/5.3.2/ViaBackwards-5.3.2.jar")
url("https://github.com/ViaVersion/ViaVersion/releases/download/5.3.2/ViaVersion-5.3.2.jar")
}
}
}
tasks.register('runServerMain', runServer.getClass() as Class<Task>) {
minecraftVersion("${project.minecraft_version}")
systemProperty('com.mojang.eula.agree', 'true')
systemProperty('Paper.skipServerPropertiesComments', 'true')
runDirectory = layout.projectDirectory.dir('run').dir('main')
dependsOn('build')
}
tasks.register('runServerQueue', runServer.getClass() as Class<Task>) {
minecraftVersion("${project.minecraft_version}")
systemProperty('com.mojang.eula.agree', 'true')
systemProperty('Paper.skipServerPropertiesComments', 'true')
runDirectory = layout.projectDirectory.dir('run').dir('queue')
downloadPlugins {
github("zeroBzeroT", "QueuePlugin", "v3.0.1", "QueuePlugin-3.0.1+1.21-paper.jar")
url("https://github.com/dmulloy2/ProtocolLib/releases/download/5.3.0/ProtocolLib.jar")
}
dependsOn('build')
}
// eclipse + intellij hooks for generating template files
project.eclipse.synchronizationTasks(generateTemplates)
rootProject.idea.project.settings.taskTriggers.afterSync generateTemplates