-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
175 lines (156 loc) · 4.52 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
buildscript {
repositories {
mavenLocal()
maven { url = 'https://maven.minecraftforge.net' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:3.0.+'
}
}
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
configurations {
shade
compile.extendsFrom shade
}
group = 'me.mikex86'
version = '1.0.3-alpha'
ext {
minecraft_version = '1.16.5'
mcp_version = '20210115.111550'
mappings_channel = 'official'
mappings_version = '1.16.5'
}
repositories {
mavenCentral()
}
dependencies {
shade 'net.minecraftforge:forgespi:3.0.+'
shade 'org.jetbrains:annotations:20.1.0'
}
project(':mcp') {
apply plugin: 'net.minecraftforge.gradle.forgedev.mcp'
mcp {
config = minecraft_version + '-' + mcp_version
pipeline = 'joined'
}
}
evaluationDependsOn(':mcp')
patcher {
parent = project(':mcp')
patchedSrc = file('src/main/java')
mappings channel: mappings_channel, version: mappings_version
mcVersion = minecraft_version
}
jar {
manifest {
attributes(
'Main-Class': 'net.minecraft.server.Main',
'Multi-Release': 'true'
)
}
from { configurations.runtimeClasspath.collect { file -> file.isDirectory() ? file : zipTree(file) } } {
exclude 'META-INF/MOJANG*'
exclude '*.dll*', '*.so*', '*.dylib*', '*.csv', '*.jnilib'
exclude '**/Log4j2Plugins.dat'
exclude 'org/lwjgl/**'
exclude 'assets/realms/**'
// Exclude all unnecessary minecraft assets not needed by the server
exclude 'assets/minecraft/gpu_warnlist.json'
exclude 'assets/minecraft/textures/**'
exclude 'assets/minecraft/texts/**'
exclude 'assets/minecraft/shaders/**'
exclude 'assets/minecraft/particles/**'
exclude 'assets/minecraft/models/**'
exclude 'assets/minecraft/font/**'
exclude 'assets/minecraft/blockstates/**'
// Exclude all log4j configuration from libraries, the log4j configuration in resource will remain
exclude 'log4j2.xml'
}
}
task runclient(type: JavaExec) {
group = "MCP"
description = "Runs the client"
classpath sourceSets.main.runtimeClasspath
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
jvmArgs '-XstartOnFirstThread'
}
args '--gameDir', '.'
args '--version', minecraft_version
args '--assetsDir', downloadAssets.output
args '--assetIndex', "1.16"
args '--accessToken', '0'
main 'net.minecraft.client.main.Main'
workingDir 'run'
}
task createDiffs() {
doFirst {
mkdir 'diffs'
def process = new ProcessBuilder("git diff --no-index build/mcp_diff_src/ src/main/java/ --output diffs/velox_source.diff".split(" "))
.inheritIO()
.directory(projectDir)
.start()
process.waitFor()
}
}
task applyDiffs() {
doFirst {
copy {
from 'build/mcp_diff_src'
into 'build/mcp_diff_clean_src'
}
def diffs = file("diffs").listFiles()
diffs.each { diff ->
def process = new ProcessBuilder("git apply \"${diff.path}\"".split(" "))
.inheritIO()
.directory(projectDir)
.start()
process.waitFor()
}
delete 'build/mcp_diff_src'
copy {
from 'build/mcp_diff_clean_src'
into 'build/mcp_diff_src'
}
delete 'build/mcp_diff_clean_src'
}
}
task setup() {
group = "MCP"
description = "Setups the dev workspace"
dependsOn ':extractMapped'
doLast {
mkdir 'run/assets'
copy {
from downloadAssets.output.path
into 'run/assets'
}
mkdir 'build/mcp_diff_src'
copy {
from 'src/main/java'
into 'build/mcp_diff_src'
}
}
}
task copyAssets {
group = "MCP"
description = "Download and place the assets into the run folder"
dependsOn ':downloadAssets'
mkdir 'run/assets'
copy {
from downloadAssets.output.path
into 'run/assets'
}
}
task buildFinalJar {
dependsOn ordered(':setup', ':applyDiffs', ':build')
}
def ordered(String... dependencyPaths) {
def dependencies = dependencyPaths.collect { tasks.getByPath(it) }
for (int i = 0; i < dependencies.size() - 1; i++) {
dependencies[i + 1].mustRunAfter(dependencies[i])
}
return dependencies
}