-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
142 lines (118 loc) · 4.24 KB
/
build.gradle
File metadata and controls
142 lines (118 loc) · 4.24 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.vineflower:vineflower:1.11.2'
}
}
plugins {
id 'java'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.3'
id 'com.gradleup.shadow' version '9.3.0'
id 'maven-publish'
id 'net.saliman.properties' version '1.6.0'
}
boolean ci = System.getenv("CI") == "true"
group = 'one.armelin'
version = '1.1.3'
def decomp(fileCollection) {
def jarFile = fileCollection.singleFile
if (jarFile.name.endsWith('.jar') && jarFile.exists()) {
def decompiled = new File(jarFile.parentFile, jarFile.name.replace('.jar', '-sources.jar'))
if (!decompiled.exists()) {
println "Decompiling ${jarFile.name}..."
def vineflowerJar = buildscript.configurations.classpath.find { it.name.contains('vineflower') }
println "Vineflower JAR: ${vineflowerJar}"
println "Input: ${jarFile.absolutePath}"
println "Output: ${decompiled.absolutePath}"
def process = new ProcessBuilder(
'java',
'-Xmx10G',
'-cp',
vineflowerJar.absolutePath,
'org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler',
jarFile.absolutePath,
decompiled.absolutePath
)
process.redirectErrorStream(true)
def proc = process.start()
proc.inputStream.eachLine { line ->
println " [Vineflower] ${line}"
}
def exitCode = proc.waitFor()
println "Exit code: ${exitCode}"
println "Decompiled JAR exists: ${decompiled.exists()}"
}
return files(jarFile)
}
return fileCollection
}
configurations {
create("shade")
implementation {
extendsFrom(configurations["shade"])
}
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.hytale.com/release' }
exclusiveContent {
forRepository {
maven {
url "https://cursemaven.com"
}
}
filter {
includeGroup "curse.maven"
}
}
}
def hytale = ci ? 'com.hypixel.hytale:Server:+' : decomp(files("${project.HytaleInstallDir}/install/release/package/game/latest/Server/HytaleServer.jar"))
dependencies {
implementation hytale
implementation "curse.maven:dynamictooltipslib-1459711:7657646"
implementation 'blue.endless:jankson:1.2.3'
shade 'blue.endless:jankson:1.2.3'
}
tasks.register('updatePluginManifest') {
def manifestFile = file('src/main/resources/manifest.json')
doLast {
if (!manifestFile.exists()) {
throw new GradleException("Could not find manifest.json at ${manifestFile.path}!")
}
def manifestJson = new groovy.json.JsonSlurper().parseText(manifestFile.text)
manifestJson.Version = version
manifestJson.IncludesAssetPack = includes_pack.toBoolean()
manifestFile.text = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(manifestJson))
}
}
tasks.named('processResources') {
dependsOn 'updatePluginManifest'
}
// Creates a run configuration in IDEA that will run the Hytale server with
// your plugin and the default assets.
idea.project.settings.runConfigurations {
'HytaleServer'(org.jetbrains.gradle.ext.Application) {
mainClass = 'com.hypixel.hytale.Main'
moduleName = project.idea.module.name + '.main'
programParameters = "--allow-op --disable-sentry --assets=${project.HytaleInstallDir}/install/release/package/game/latest/Assets.zip"
if (includes_pack.toBoolean()) {
programParameters += " --mods=${sourceSets.main.java.srcDirs.first().parentFile.absolutePath}"
}
if (load_user_mods.toBoolean()) {
programParameters += " --mods=${project.HytaleInstallDir}/UserData/Mods"
}
workingDirectory = file("${project.ServerDir}").absolutePath
}
}
java {
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}
tasks.shadowJar {
archiveClassifier.set('')
configurations = [project.configurations.shade]
mergeServiceFiles()
}