-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
update.gradle
89 lines (77 loc) · 3.28 KB
/
update.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
apply plugin: 'java'
configurations {
jarDeps
}
repositories {
mavenLocal()
mavenCentral()
maven { url = 'https://maven.neoforged.net/releases/'}
}
dependencies {
jarDeps "net.neoforged:srgutils:${SRGUTILS_VERSION}"
jarDeps "org.ow2.asm:asm:${ASM_VERSION}"
jarDeps "org.ow2.asm:asm-commons:${ASM_VERSION}"
jarDeps "org.ow2.asm:asm-tree:${ASM_VERSION}"
jarDeps "org.ow2.asm:asm-util:${ASM_VERSION}"
}
ext {
OLD_VERSION = project.getProperty('old_version')
OLD_PATH = 'versions/release/' + OLD_VERSION + '/'
if (OLD_VERSION.indexOf('/') != -1) {
OLD_PATH = 'versions/' + OLD_VERSION + '/'
OLD_VERSION = OLD_VERSION.substring(OLD_VERSION.lastIndexOf('/') + 1)
}
NEW_VERSION = project.getProperty('new_version')
NEW_PATH = 'versions/release/' + NEW_VERSION + '/'
if (NEW_VERSION.indexOf('/') != -1) {
NEW_PATH = 'versions/' + NEW_VERSION + '/'
NEW_VERSION = NEW_VERSION.substring(NEW_VERSION.lastIndexOf('/') + 1)
}
MAP_DATA = 'build/update/data'
}
task downloadMappingToy(type: Download) {
ext.VER = '2.0.0'
src "https://maven.neoforged.net/releases/net/neoforged/MappingToy/${VER}/MappingToy-${VER}-all.jar"
dest rootProject.file("build/libraries/net/neoforged/MappingToy/${VER}/MappingToy-${VER}-all.jar")
overwrite false
}
task runMappingToy(type: JavaExec, dependsOn: downloadMappingToy) {
classpath.from configurations.jarDeps
classpath.from files(downloadMappingToy.dest)
mainClass = 'net.neoforged.mappingtoy.MappingToy'
args = ['--libs', '--output', MAP_DATA, '--version', OLD_VERSION, '--version', NEW_VERSION]
def toolchainService = project.extensions.getByType(JavaToolchainService)
javaLauncher = toolchainService.launcherFor {
it.languageVersion = JavaLanguageVersion.of(16)
}
//args += ['--force']
}
task downloadJammer(type: Download) {
ext.VER = '3.2'
src "https://maven.neoforged.net/releases/com/ldtteam/jam/jam-neoform/${VER}/jam-neoform-${VER}-all.jar"
dest rootProject.file("build/libraries/com/ldtteam/jam/jam-neoform/${VER}/jam-neoform-${VER}-all.jar")
overwrite false
}
task runJammer(type: JavaExec, dependsOn: [downloadJammer, runMappingToy]) {
inputs.file("${MAP_DATA}/${OLD_VERSION}/client.txt")
inputs.file("${MAP_DATA}/${NEW_VERSION}/client.txt")
mainClass = 'com.ldtteam.jam.neoform.Main'
classpath.from configurations.jarDeps
classpath.from files(downloadJammer.dest)
args = ['-en', OLD_VERSION, '-ej', "${MAP_DATA}/${OLD_VERSION}/client.jar", '-em', "${MAP_DATA}/${OLD_VERSION}/client.txt", '-emd', "${MAP_DATA}/${OLD_VERSION}/joined_a_meta.json", '-ei', "${OLD_PATH}joined.tsrg", '-in', NEW_VERSION, '-ij', "${MAP_DATA}/${NEW_VERSION}/client.jar", '-imd', "${MAP_DATA}/${NEW_VERSION}/joined_a_meta.json", '-im', "${MAP_DATA}/${NEW_VERSION}/client.txt", '-o', NEW_PATH]
def toolchainService = project.extensions.getByType(JavaToolchainService)
javaLauncher = toolchainService.launcherFor {
it.languageVersion = JavaLanguageVersion.of(17)
}
}
task copyConfig(type: Copy) {
from(OLD_PATH) {
include 'config.json'
}
into NEW_PATH
}
task copyInject(type: Copy) {
from OLD_PATH + '/inject'
into NEW_PATH + '/inject'
}
task update(dependsOn: [copyConfig, copyInject, runJammer])