forked from Technus/TecTech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
280 lines (249 loc) · 9.41 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
import net.minecraftforge.gradle.user.UserExtension
import java.io.FileInputStream
import java.util.*
import java.io.*
buildscript {
repositories {
mavenCentral()
maven("http://files.minecraftforge.net/maven")
maven("https://jitpack.io")
}
dependencies {
classpath("com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT")
}
}
plugins {
idea
java
signing
}
apply(plugin = "forge")
//Downloads Javadocs and sources by default
idea {
module {
this.isDownloadJavadoc = true
this.isDownloadSources = true
}
}
//Set Java to version 1.8
java {
this.sourceCompatibility = JavaVersion.VERSION_1_8
this.targetCompatibility = JavaVersion.VERSION_1_8
}
//Set standard encoding
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
//Add extra sources here
sourceSets.getByName("main") {
java.srcDir("src/main/java")
java.srcDir("AVRcore/src")
}
//Load Minecraft Version
val Project.minecraft: UserExtension
get() = extensions.getByName<UserExtension>("minecraft")
//TODO Delete this! This exists to load the configs from the real properties file, which is needed for Jenkins to build
//Gradle will load gradle.properties from it's home, it's install, and the project folder. Clearly whoever setup the
//Jenkins jar signing needs to be reminded of this!
val prop = Properties()
prop.load(FileInputStream("real.gradle.properties"))
val propSign = Properties()
propSign.load(FileInputStream("gradle.properties"))
//TODO Delete
val projectVersion: String = prop.getProperty("projectVersion")
//TODO Uncomment
//val projectVersion: String by project
//Generates a hash for each new commit to differentiate versions
var commitHash = Runtime
.getRuntime()
.exec("git rev-parse --short HEAD")
.let { process ->
process.waitFor()
val output = process.inputStream.use {
it.bufferedReader().use(BufferedReader::readText)
}
process.destroy()
output.trim()
}
minecraft.version = "1.7.10-10.13.4.1614-1.7.10"
version = "$projectVersion-$commitHash"
group = "com.github.technus"
//Minecraft Block
configure<UserExtension> {
//Replaces version inside the mod
this.includes.addAll(
arrayOf(
"Reference.java"
)
)
this.replacements.putAll(
mapOf(
Pair("GRADLETOKEN_VERSION", project.version)
)
)
//This is sometimes called 'eclipse' instead
this.runDir = "run"
}
repositories {
mavenLocal()
maven("https://gregtech.overminddl1.com/") { this.name = "GT6Maven" }
maven("http://maven.ic2.player.to/") { this.name = "ic2" }
maven("http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/") { this.name = "UsrvDE/GTNH" }
ivy {
this.name = "gtnh_download_source_underscores"
this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]")
}
ivy {
this.name = "gtnh_download_source"
this.artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]")
}
ivy {
this.name = "BuildCraft"
this.artifactPattern("http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision](-[classifier]).[ext]")
}
maven("http://maven.cil.li/") { this.name = "OpenComputers" }
maven("http://default.mobiusstrip.eu/maven") { this.name = "Jabba" }
maven("http://chickenbones.net/maven/") { this.name = "CodeChicken" }
maven("http://www.ryanliptak.com/maven/") { this.name = "appleCore" }
maven("https://jitpack.io")
}
dependencies {
//Local Libraries
compile(fileTree("libs") { this.include("*.jar") })
//TODO Uncomment
//Versions from properties
//val ic2Version: String by project
//val gt5uVersion: String by project
//val yamcoreVersion: String by project
//val opencomputersVersion: String by project
//val computercraftVersion: String by project
//val baublesVersion: String by project
//val thaumcraftVersion: String by project
//val codechickenlibVersion: String by project
//val codechickencoreVersion: String by project
//val neiVersion: String by project
//val wailaVersion: String by project
//val galacticraftVersion: String by project
//val galacticGregVersion: String by project
//val buildcraftVersion: String by project
//val forestryVersion: String by project
//val enderioVersion: String by project
//val enderCoreVersion: String by project
//TODO Delete
val ic2Version: String = prop.getProperty("ic2Version")
val gt5uVersion: String = prop.getProperty("gt5uVersion")
val yamcoreVersion: String = prop.getProperty("yamcoreVersion")
val opencomputersVersion: String = prop.getProperty("opencomputersVersion")
val computercraftVersion: String = prop.getProperty("computercraftVersion")
val baublesVersion: String = prop.getProperty("baublesVersion")
val thaumcraftVersion: String = prop.getProperty("thaumcraftVersion")
val codechickenlibVersion: String = prop.getProperty("codechickenlibVersion")
val codechickencoreVersion: String = prop.getProperty("codechickencoreVersion")
val neiVersion: String = prop.getProperty("neiVersion")
val wailaVersion: String = prop.getProperty("wailaVersion")
val galacticraftVersion: String = prop.getProperty("galacticraftVersion")
val galacticGregVersion: String = prop.getProperty("galacticGregVersion")
val buildcraftVersion: String = prop.getProperty("buildcraftVersion")
val forestryVersion: String = prop.getProperty("forestryVersion")
val enderioVersion: String = prop.getProperty("enderioVersion")
val enderCoreVersion: String = prop.getProperty("enderCoreVersion")
//Hard Dependencies
compile("net.industrial-craft:industrialcraft-2:$ic2Version:dev")
compile("com.github.GTNewHorizons:GT5-Unofficial:$gt5uVersion:dev"){
exclude("net.industrial-craft", "industrialcraft-2")
}
compile("eu.usrv:YAMCore:$yamcoreVersion:deobf")
//Compile Dependencies
compileOnly("li.cil.oc:OpenComputers:$opencomputersVersion:dev")
compileOnly("dan200.computercraft:ComputerCraft:$computercraftVersion")
compile("com.azanor.baubles:Baubles:$baublesVersion:deobf")
compile("thaumcraft:Thaumcraft:$thaumcraftVersion:dev")
compile("codechicken:CodeChickenLib:$codechickenlibVersion:dev")
compile("codechicken:CodeChickenCore:$codechickencoreVersion:dev")
compile("codechicken:NotEnoughItems:$neiVersion:dev")
//Optional Libraries for Testing
runtimeOnly("mcp.mobius.waila:Waila:$wailaVersion")
//runtimeOnly("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev")
//runtimeOnly("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev")
//runtimeOnly("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev")
//runtimeOnly("com.github.GTNewHorizons:GalacticGregGT5:$galacticGregVersion")
//runtimeOnly("com.mod-buildcraft:buildcraft:$buildcraftVersion:dev")
//runtimeOnly("net.sengir.forestry:forestry_1.7.10:$forestryVersion:dev")
//runtimeOnly("com.enderio.core:EnderCore:$enderCoreVersion:dev")
//runtimeOnly("com.enderio:EnderIO:$enderioVersion:dev"){
// exclude("com.enderio.core", "EnderCore")
// exclude("mcp.mobius.waila", "Waila")
//}
}
tasks.withType<Jar> {
//Mark as outdated if versions change
this.inputs.properties += "version" to project.version
this.inputs.properties += "mcversion" to project.minecraft.version
this.archiveBaseName.set("TecTech-${project.minecraft.version}")
//Replace versions in mcmod.info
this.filesMatching("/mcmod.info") {
this.expand(
mapOf(
"version" to project.version,
"mcversion" to project.minecraft.version
)
)
}
}
//Load AVRcore
val submodulesUpdate by tasks.creating(Exec::class) {
this.description = "Updates (and inits) git submodules"
this.group = "Build Setup"
this.commandLine("git", "submodule", "update", "--init", "--recursive", "--remote")
}
tasks.named("setupCIWorkspace") {
dependsOn(":submodulesUpdate")
}
tasks.named("setupDevWorkspace") {
dependsOn(":submodulesUpdate")
}
tasks.named("setupDecompWorkspace") {
dependsOn(":submodulesUpdate")
}
tasks.named("compileJava") {
dependsOn(":submodulesUpdate")
}
tasks.named("sourceMainJava") {
dependsOn(":submodulesUpdate")
}
tasks.jar {
//Needed for access transformer which allows nerfing hardness of blocks
this.manifest.attributes(
mapOf(
Pair("FMLAT", "tectech_at.cfg")
)
)
}
val sourcesJar by tasks.creating(Jar::class) {
this.from(sourceSets.main.get().allSource)
this.archiveClassifier.set("sources")
}
val devJar by tasks.creating(Jar::class) {
this.from(sourceSets.main.get().output)
this.archiveClassifier.set("dev")
}
artifacts {
this.archives(sourcesJar)
this.archives(devJar)
}
tasks.register("signJar") {
dependsOn("reobf")
}
//TODO Fix, but technically it was never fully implemented
//signing {
// sign(tasks["jar"])
//}
//
//tasks.named("signJar") {
// allprojects {
// extra["signing.keyId"] = propSign.getProperty("keyStoreAlias")
// extra["signing.secretKeyRingFile"] = propSign.getProperty("keyStore")
// extra["signing.password"] = propSign.getProperty("keyStorePass")
// }
// dependsOn(":reobf")
//}