forked from zhaixianyu/litematica-printer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
96 lines (81 loc) · 3.19 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
plugins {
id("maven-publish")
id("fabric-loom").version("1.7-SNAPSHOT").apply(false)
id("org.ajoberstar.grgit").version("5.2.0")
id("com.replaymod.preprocess").version("ce1aeb2b")
}
preprocess {
// def mc11404 = createNode("1.14.4", 1_14_04, "mojang")
// def mc11502 = createNode("1.15.2", 1_15_02, "mojang")
// def mc11605 = createNode("1.16.5", 1_16_05, "mojang")
// def mc11701 = createNode("1.17.1", 1_17_01, "mojang")
def mc11802 = createNode("1.18.2", 1_18_02, "mojang")
// def mc11902 = createNode("1.19.2", 1_19_02, "mojang")
// def mc11903 = createNode("1.19.3", 1_19_03, "mojang")
def mc11904 = createNode("1.19.4", 1_19_04, "mojang")
def mc12001 = createNode("1.20.1", 1_20_01, "mojang")
def mc12002 = createNode("1.20.2", 1_20_02, "mojang")
def mc12004 = createNode("1.20.4", 1_20_04, "mojang")
def mc12006 = createNode("1.20.6", 1_20_06, "mojang")
def mc12100 = createNode("1.21.0", 1_21_00, "mojang")
def mc12101 = createNode("1.21.1", 1_21_01, "mojang")
// mc11404.link(mc11502, null)
// mc11502.link(mc11605, null)
// mc11605.link(mc11701, null)
// mc11701.link(mc11802, null)
mc11802.link(mc11904,file("versions/mapping-1.18.2-1.19.4.txt"))
//// mc11902.link(mc11903, null)
//// mc11903.link(mc11904, null)
mc11904.link(mc12001, file("versions/mapping-1.19.4-1.20.1.txt"))
mc12001.link(mc12002, file("versions/mapping-1.20.1-1.20.2.txt"))
mc12002.link(mc12004, file("versions/mapping-1.20.2-1.20.4.txt"))
mc12004.link(mc12006, file("versions/mapping-1.20.4-1.20.6.txt"))
mc12006.link(mc12100, file("versions/mapping-1.20.6-1.21.0.txt"))
mc12100.link(mc12101, file("versions/mapping-1.21.0-1.21.1.txt"))
}
ext {
env = System.getenv()
getVersionGit = { List paths ->
if (grgit == null) {
return "nogit"
}
List latestCommits = paths.isEmpty() ? grgit.log(maxCommits: 1) : grgit.log(paths: paths, maxCommits: 1)
return latestCommits.isEmpty() ? "uncommited" : "${latestCommits.get(0).id.substring(0, 7)}"
}
getBuildNumber = {
return ext.env.GITHUB_RUN_NUMBER ? ext.env.GITHUB_RUN_NUMBER : Integer.MAX_VALUE
}
getVersionType = {
switch (ext.env.BUILD_TYPE) {
case "RELEASE":
return "stable"
case "BETA":
return "beta"
default:
return "dev"
}
}
getVersionPatch = { List paths ->
if (grgit == null) {
return 0
}
List latestCommits = paths.isEmpty() ? grgit.log() : grgit.log(paths: paths)
return latestCommits.size()
}
getMavenArtifactVersion = {
return ext.getVersionType() == "stable" ? "${project.mod_version}.${ext.getVersionPatch([])}" : project.version
}
getModVersion = {
return "${project.mod_version}.${getVersionPatch([])}+${getVersionGit([])}-${getVersionType()}"
}
}
setVersion(project.getModVersion())
tasks.register("cleanPreprocessSources") {
it.group("${project.mod_id}")
doFirst {
subprojects {
def path = project.projectDir.toPath().resolve("build/preprocessed")
path.toFile().deleteDir()
}
}
}