-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
78 lines (69 loc) · 2.16 KB
/
build.gradle
File metadata and controls
78 lines (69 loc) · 2.16 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
import com.replaymod.gradle.preprocess.Node
import groovy.json.JsonSlurper
plugins {
id 'maven-publish'
id 'com.github.hierynomus.license' version '0.16.1' apply false
id 'dev.architectury.loom' version '1.13-SNAPSHOT' apply false
// https://github.com/ReplayMod/preprocessor
// https://github.com/Fallen-Breath/preprocessor
id 'com.replaymod.preprocess' version 'd452ef7612'
// https://github.com/Fallen-Breath/yamlang
id 'me.fallenbreath.yamlang' version '1.5.0' apply false
}
def linkNode(Node src, Node dst) {
def mappingFile = rootProject.file("versions/mapping-${src.project}-${dst.project}.txt")
src.link(dst, mappingFile.isFile() ? mappingFile : null)
}
preprocess {
strictExtraMappings = false
def settings = new JsonSlurper().parseText(file('settings.json').text)
def all_versions = new ArrayList<>(settings.versions)
Map<String, Node> all_nodes = [:]
for (String version : all_versions) {
String[] versionParts = version.split("-")[0].split("\\.")
if (versionParts.size() == 2) {
versionParts = [versionParts[0], versionParts[1], "0"]
}
int versionId = Integer.parseInt(versionParts[0]) * 10000 + Integer.parseInt(versionParts[1]) * 100 + Integer.parseInt(versionParts[2])
all_nodes[version] = createNode(version, versionId, '')
}
Node prev_fabric_node = null
for (String version : all_versions) {
def (mc_version, mod_brand) = version.split("-")
def node = all_nodes[version]
switch (mod_brand) {
case "fabric":
if (prev_fabric_node != null) {
linkNode(prev_fabric_node, all_nodes[version])
}
prev_fabric_node = node
break
default:
linkNode(all_nodes["${mc_version}-fabric"], all_nodes[version])
}
}
}
tasks.register('buildAndGather') {
subprojects {
dependsOn project.tasks.named('build').get()
}
doFirst {
println 'Gathering builds'
def buildLibs = {
p -> p.buildDir.toPath().resolve('libs')
}
delete fileTree(buildLibs(rootProject)) {
include '*'
}
subprojects {
copy {
from(buildLibs(project)) {
include '*.jar'
exclude '*-dev.jar', '*-sources.jar', '*-shadow.jar'
}
into buildLibs(rootProject)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
}
}