-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
executable file
·126 lines (102 loc) · 3.79 KB
/
build.gradle
File metadata and controls
executable file
·126 lines (102 loc) · 3.79 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import groovy.json.JsonSlurper
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'org.jetbrains.kotlin.jvm' version '1.7.22'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.22'
id "de.undercouch.download" version '4.0.2'
id "io.github.http-builder-ng.http-plugin" version "0.1.1"
}
repositories {
mavenCentral()
}
File getJar(Project project) {
return file(project.projectDir.path + '/build/libs/' + project.name + '-' + project.version + '-all.jar')
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
project.ext {
mcVersion = '1.19.3'
serverPath = project.projectDir.path + '/server'
kt_version = '1.7.22'
citizens_version = '2.0.30-SNAPSHOT'
we_version = '7.2.13-SNAPSHOT'
okhttp_version = '4.10.0'
mongo_version = '4.7.1'
ktor_version = '2.1.2'
nbt_version = '2.11.0'
}
task download(type: Download) {
def json = new URL("https://papermc.io/api/v2/projects/paper/versions/${project.ext.mcVersion}/builds").text
def paper = new JsonSlurper().parseText(json)
def latest = 0
for (build in paper.builds) {
if (build.build > latest) {
latest = build.build
}
}
src "https://papermc.io/api/v2/projects/paper/" +
"versions/${project.ext.mcVersion}/builds/${latest}/downloads/paper-${project.ext.mcVersion}-${latest}.jar"
dest project.ext.serverPath + '/paper.jar'
overwrite true
}
subprojects {
def isBaseProject = project.name.charAt(0).isLowerCase()
group 'com.zhufu.opencraft'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'kotlin'
if (!isBaseProject)
apply plugin: 'com.github.johnrengelman.shadow'
dependencies {
compileOnly "io.papermc.paper:paper-api:" + rootProject.ext.mcVersion + "-R0.1-SNAPSHOT"
testImplementation group: 'junit', name: 'junit', version: '4.12'
compileOnly fileTree(dir: 'lib', includes: ['*.jar'])
}
sourceCompatibility = 17
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
repositories {
mavenCentral()
maven { url 'https://repo.alessiodp.com/releases/' }
maven { url 'https://papermc.io/repo/repository/maven-public/' }
maven { url 'https://libraries.minecraft.net/' }
maven { url 'https://maven.citizensnpcs.co/repo/' }
maven { url 'https://repo.codemc.org/repository/maven-public/' }
maven { url 'https://maven.enginehub.org/repo/' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}
if (!isBaseProject) {
beforeEvaluate {
copyJar.shouldRunAfter(build)
}
def jarName = getJar(project).name
clean {
delete(rootProject.ext.serverPath + '/plugins/' + jarName, projectDir.path + '/build', projectDir.path + '/out')
}
task copyJar(type: Copy) {
dependsOn shadowJar
from getJar(project)?.path ?: project.rootDir.path + '/build/libs/' + jarName
into project.rootDir.path + '/server/plugins/'
}
if (project.name != 'Updater' && project.name != 'CoreRuntime')
task hotReloadJar(type: Copy) {
dependsOn shadowJar
from getJar(project)?.path ?: project.rootDir.path + '/build/libs/' + jarName
into project.rootDir.path + '/server/new_plugins/'
}
}
if (project.name != 'CoreRuntime') {
dependencies {
if (!isBaseProject)
compileOnly project(':pluginBase')
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compileOnly "org.jetbrains.kotlin:kotlin-reflect:${rootProject.ext.kt_version}"
}
}
}