-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.gradle
138 lines (118 loc) · 3.47 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '6.0.0'
}
group 'com.ddf.fakeplayer'
version '0.5.11-alpha'
repositories {
maven {
name 'aliyun-central'
url 'https://maven.aliyun.com/repository/central'
}
maven {
name 'aliyun-public'
url 'https://maven.aliyun.com/repository/public'
}
maven {
name 'opencollab-releases'
url 'https://repo.opencollab.dev/maven-releases/'
}
maven {
name 'opencollab-snapshots'
url 'https://repo.opencollab.dev/maven-snapshots/'
}
maven {
name 'minecraft-libraries'
url "https://libraries.minecraft.net"
}
}
dependencies {
implementation 'org.cloudburstmc.protocol:bedrock-connection:3.0.0.Beta1-SNAPSHOT'
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'org.yaml:snakeyaml:1.29'
implementation 'com.formdev:flatlaf:1.5'
implementation 'org.java-websocket:Java-WebSocket:1.5.2'
implementation 'org.slf4j:slf4j-nop:1.7.32'
implementation 'com.miglayout:miglayout-swing:5.3'
implementation 'com.mojang:brigadier:1.0.18'
implementation 'ar.com.hjg:pngj:2.1.0'
implementation 'org.mozilla:rhino:1.7.13'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
mainClassName = 'com.ddf.fakeplayer.main.Main'
distributions {
main {
contents {
from "LICENSE"
into ""
}
}
}
distTar {
archiveVersion.set(getFullVersionString())
}
distZip {
archiveVersion.set(getFullVersionString())
}
run {
standardInput = System.in
jvmArgs += '-Dfakeplayer.nogui=true'
}
processResources {
doLast {
def file = new File(getDestinationDir(), 'version.properties')
def text = file.getText('UTF-8')
text = replace(text, 'VERSION', getFullVersionString())
file.write(text, 'UTF-8')
}
}
def getFullVersionString() {
if (isGithubActions())
return version.toString() + '-build.' + getGithubRunNumber()
return version.toString()
}
static def isGithubActions() {
return System.getenv('GITHUB_ACTIONS') == 'true'
}
static def getGithubRunNumber() {
if (!isGithubActions())
return ''
return System.getenv('GITHUB_RUN_NUMBER')
}
static def replace(String input, String name, String value) {
def regex = '\\$\\{' + name + '\\}'
return (input =~ /${regex}/).replaceAll(value)
}
task getVersion {
print version
}
task runGUI(type: JavaExec) {
classpath = run.classpath
main = run.main
jvmArgs += '-Dfakeplayer.nogui=false'
}
startScripts {
defaultJvmOpts = ['-Dfakeplayer.nogui=true']
}
task guiStartScripts(type: CreateStartScripts) {
applicationName = startScripts.applicationName + '-GUI'
classpath = startScripts.classpath
mainClassName = startScripts.mainClassName
outputDir = startScripts.outputDir
defaultJvmOpts = ['-Dfakeplayer.nogui=false']
doLast {
def windowsScriptText = windowsScript.text.replaceAll('java\\.exe', 'javaw.exe')
windowsScriptText = windowsScriptText.replaceAll('"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS%', 'start "" /B "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS%')
windowsScript.write(windowsScriptText)
}
}
startScripts.dependsOn(guiStartScripts)
shadowJar {
manifest {
attributes 'Main-Class': 'com.ddf.fakeplayer.main.Main'
}
}