-
-
Notifications
You must be signed in to change notification settings - Fork 75
/
update.gradle
76 lines (66 loc) · 3 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
apply plugin: 'java'
repositories {
mavenLocal()
mavenCentral()
maven { url = 'https://maven.minecraftforge.net/'}
}
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)
}
println('Update Old: ' + OLD_VERSION + ' New: ' + NEW_VERSION)
MAP_DATA = 'build/update/data'
}
task downloadMappingToy(type: Download) {
ext.VER = '1.0.25'
src "https://maven.minecraftforge.net/net/minecraftforge/lex/MappingToy/${VER}/MappingToy-${VER}-all.jar"
dest rootProject.file("build/libraries/net/minecraftforge/lex/MappingToy/${VER}/MappingToy-${VER}-all.jar")
overwrite false
}
task runMappingToy(type: JavaExec, dependsOn: downloadMappingToy) {
classpath.from files(downloadMappingToy.dest)
mainClass = 'net.minecraftforge.lex.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(21)
}
//args += ['--force']
}
task downloadJammer(type: Download) {
ext.VER = '1.0.36'
src "https://maven.minecraftforge.net/net/minecraftforge/lex/jam-mcpconfig/${VER}/jam-mcpconfig-${VER}-all.jar"
dest rootProject.file("build/libraries/net/minecraftforge/lex/${VER}/jam-mcpconfig-${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.mcpconfig.Main'
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(21)
}
}
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])