-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
120 lines (101 loc) · 3.29 KB
/
build.gradle
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
import dev.s7a.gradle.minecraft.server.tasks.LaunchMinecraftServerTask
import groovy.json.JsonSlurper
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2' // Add the Shadow plugin
id 'dev.s7a.gradle.minecraft.server' version '2.1.0'
id "com.apollographql.apollo3" version "3.8.1"
}
group = 'com.agoramp'
version = '1.0'
targetCompatibility = 1.8
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven { url 'https://jitpack.io' }
maven { url "https://repo.dmulloy2.net/repository/public/" }
mavenLocal()
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
shadow 'com.agoramp:fulfillment-core-java:1.0-SNAPSHOT'
shadow 'com.agoramp:minecraft-util:1.0-SNAPSHOT'
implementation 'com.comphenix.protocol:ProtocolLib:5.1.0'
implementation 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}
def targetJavaVersion = 8
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
// Configure the shadowJar task
shadowJar {
configurations = [project.configurations.shadow]
archiveClassifier.set('')
exclude 'com/google/*'
}
build.dependsOn(shadowJar)
tasks.register('testPlugin', LaunchMinecraftServerTask) {
dependsOn 'build'
doFirst {
copy {
from "$buildDir/libs"
into "$buildDir/MinecraftServer/plugins"
include "${project.name}-${project.version}.jar"
rename { String fileName ->
fileName.replace("${project.name}-${project.version}", "${project.name}")
}
}
}
jarUrl = paper('1.20.1')
agreeEula = true
//jvmArgument = ['-DAGORA-API-URL=http://localhost:4000']
}
task copyPlugin(type: Copy) {
dependsOn(build)
from "$buildDir/libs"
into "$projectDir/test-server/plugins"
include "${project.name}-${project.version}.jar"
rename { String fileName ->
fileName.replace("${project.name}-${project.version}", "${project.name}")
}
}
static String paper(String version) {
String versionsUrl = "https://papermc.io/api/v2/projects/paper/versions"
String versionsJson = new URL("$versionsUrl/$version").text
def jsonSlurper = new JsonSlurper()
def versionData = jsonSlurper.parseText(versionsJson)
def build = versionData.builds.max()
return "$versionsUrl/$version/builds/$build/downloads/paper-$version-${build}.jar"
}
apollo {
service("service") {
packageName.set("com.agoramp.minecraft.models.graphql")
}
}