-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
201 lines (172 loc) · 5.54 KB
/
build.gradle.kts
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import fr.brouillard.oss.jgitver.GitVersionCalculator
import fr.brouillard.oss.jgitver.Strategies
import net.minecraftforge.gradle.common.util.RunConfig
import wtf.gofancy.fancygradle.script.extensions.deobf
import net.minecraftforge.gradle.patcher.tasks.GenerateBinPatches
buildscript {
dependencies {
classpath(group = "fr.brouillard.oss", name = "jgitver", version = "0.14.0")
}
}
plugins {
`java-library`
`maven-publish`
idea
id("net.minecraftforge.gradle") version "5.1.+"
id("de.undercouch.download") version "4.1.1"
id("wtf.gofancy.fancygradle") version "1.1.+"
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(8))
val versionMc = "1.12.2"
val mappingsChannel: String by project
val mappingsVersion: String by project
val versionForge: String by project
val versionJEI: String by project
val extraUtils2Source: String by project
val taskGroup = "xu2 patcher"
version = getGitVersion()
group = "com.kanzaji"
setProperty("archivesBaseName", "XU2-Patcher")
minecraft {
mappings(mappingsChannel, mappingsVersion)
runs {
val config = Action<RunConfig> {
properties(
mapOf(
"forge.logging.markers" to "SCAN,REGISTRIES,REGISTRYDUMP,COREMODLOG",
"forge.logging.console.level" to "debug"
)
)
workingDirectory = project.file("run").canonicalPath
source(sourceSets["main"])
}
create("client", config)
create("server", config)
}
}
fancyGradle {
patches {
asm
codeChickenLib
coremods
resources
mergetool
}
}
repositories {
maven {
// JEI Repository
name = "Progwml6 maven"
url = uri("https://dvs1.progwml6.com/files/maven/")
}
maven {
// Mirror Maven for JEI
name = "ModMaven"
url = uri("https://modmaven.dev")
}
}
dependencies {
minecraft(group = "net.minecraftforge", name = "forge", version = "1.12.2-${versionForge}")
//TODO: Fix me! (Iplementation should of the source, just need to figure out how to make this point to file compiled by gradle 3.0)
// implementation(project(":XU2-Patched"))
implementation(fg.deobf(group = "mezz.jei", name = "jei_1.12.2", version = versionJEI))
// compileOnly(fg.deobf(group = "mezz.jei", name = "jei_1.12.2", version = versionJEI))
}
tasks {
named<ProcessResources>("processResources") {
// this will ensure that this task is redone when the versions change.
inputs.property("version", project.version)
inputs.property("mcversion", versionMc)
filesMatching("mcmod.info") {
// replace version and mcversion
expand(
"version" to project.version,
"mcversion" to versionMc
)
}
}
named("jar") {
enabled = false
}
//TODO: Add Generate Binary Patches ~ Dev 1.12 task and configure this one to use patches from that.
register<Jar>("Dev Jar ~ 1.12") {
group = taskGroup;
archiveFileName.set("XU2-Patcher-dev.jar")
from(sourceSets.main.get().output) {
exclude("patches");
}
manifest {
attributes(
"FMLCorePlugin" to "com.kanzaji.xu2patcher.asm.PatcherFMLPlugin",
"FMLCorePluginContainsFMLMod" to true
)
}
}
register<Jar>("Api Jar ~ 1.12") {
group = taskGroup;
archiveFileName.set("XU2-Patcher-api.jar")
from(sourceSets.main.get().output) {
exclude("com/kanzaji/xu2patcher/asm/**");
exclude("patches");
}
}
// Has to be so low, because XU2-Patched runClient requires the output of Api Jar task.
evaluationDependsOnChildren()
register<Jar>("Release Jar ~ 1.12") {
group = taskGroup;
val binPatches = project(":XU2-Patched").tasks.getByName<GenerateBinPatches>("Generate Binary Patches ~ 1.12");
dependsOn(binPatches)
mustRunAfter(binPatches)
archiveClassifier.set("")
from(sourceSets.main.get().output)
manifest {
attributes(
"FMLCorePlugin" to "com.kanzaji.xu2patcher.asm.PatcherFMLPlugin",
"FMLCorePluginContainsFMLMod" to true
)
}
}
register("Setup XU2 Source") {
group = taskGroup
dependsOn(project(":XU2-Patched").tasks.getByName<Copy>("Setup Patched Source"))
}
//
// whenTaskAdded {
// if (name.startsWith("prepareRun")) {
// dependsOn(project(":UX2-Patched").tasks.getByName("patchRunJar"))
// dependsOn("devJar")
// dependsOn("patchModifyClassPath")
// dependsOn("patchGenerateObfToSrg")
// dependsOn("patchExtractMappingsZip")
// }
// }
}
reobf {
create("jar") {
dependsOn("Release Jar ~ 1.12")
}
}
artifacts {
archives(tasks.getByName("Release Jar ~ 1.12"))
}
sourceSets {
main {
java {
// Shared classes for XU2, need to be able to compile in MC 1.10.2
srcDirs("src/main/api")
}
resources {
srcDir("src/main/generated")
}
}
}
/**
* @author Su5eD (Taken from IC2-Patcher Project)
*/
fun getGitVersion(): String {
val jgitver = GitVersionCalculator.location(rootDir)
.setNonQualifierBranches("master")
.setVersionPattern("\${M}\${<m}\${<meta.COMMIT_DISTANCE}\${-~meta.QUALIFIED_BRANCH_NAME}")
.setStrategy(Strategies.PATTERN)
return jgitver.version
}