forked from GregTechCEu/gregicality-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
119 lines (100 loc) · 3.49 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
import net.minecraftforge.gradle.user.UserBaseExtension
import java.util.*
buildscript {
repositories {
mavenCentral()
maven {
name = "Jitpack"
setUrl("https://jitpack.io")
}
maven {
name = "Forge"
setUrl("https://maven.minecraftforge.net")
}
}
dependencies {
classpath("com.github.GregTechCE:ForgeGradle:FG_2.3-SNAPSHOT")
}
}
apply {
plugin("net.minecraftforge.gradle.forge")
}
val Project.minecraft: UserBaseExtension
get() = extensions.getByName<UserBaseExtension>("minecraft")
val config: Properties = file("build.properties").inputStream().let {
val prop = Properties()
prop.load(it)
return@let prop
}
val modVersion = config["gcys.version"] as String
val mcVersion = config["mc.version"] as String
val forgeVersion = "$mcVersion-${config["forge.version"]}"
val shortVersion = mcVersion.substring(0, mcVersion.lastIndexOf("."))
val strippedVersion = shortVersion.replace(".", "") + "0";
version = "$mcVersion-$modVersion"
group = "gregicality"
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
configure<BasePluginConvention> {
archivesBaseName = "GregicalityScience"
}
configure<UserBaseExtension> {
version = forgeVersion
mappings = config["mcp.version"] as String
runDir = "run"
replace("@VERSION@", modVersion)
replaceIn("GregicalityScience.java")
}
repositories {
maven {
name = "JEI"
setUrl("http://dvs1.progwml6.com/files/maven/")
}
maven {
name = "CraftTweaker"
setUrl("https://maven.blamejared.com/")
}
maven {
name = "CurseForge"
setUrl("https://minecraft.curseforge.com/api/maven")
}
maven {
name = "CCL, CASM"
setUrl("http://chickenbones.net/maven/")
}
maven {
name = "CTM"
setUrl("https://maven.tterrag.com/")
}
}
dependencies {
// These 7 will always be in game
//"deobfCompile"("gregtechce:gregtech:$mcVersion:${config["gregtech.version"]}")
"deobfCompile"("codechicken-lib-1-8:CodeChickenLib-$mcVersion:${config["ccl.version"]}:universal")
"deobfCompile"("codechicken:ChickenASM:$shortVersion-${config["chickenasm.version"]}")
"deobfCompile"("mezz.jei:jei_$mcVersion:${config["jei.version"]}")
"deobfCompile"("mcjty.theoneprobe:TheOneProbe-$shortVersion:$shortVersion-${config["top.version"]}")
"deobfCompile"("CraftTweaker2:CraftTweaker2-MC$strippedVersion-Main:${config["crafttweaker.version"]}")
"deobfCompile"("team.chisel.ctm:CTM:MC$mcVersion-${config["ctm.version"]}")
"provided"(files("libs/gregtech-$mcVersion-${config["gregtech.version"]}.jar"))
"provided"(files("libs/GregicalityMultiblocks-$mcVersion-${config["gcym.version"]}.jar"))
// JUnit testing used for GitHub Actions
"testImplementation"("junit:junit:${config["junit.version"]}")
}
val processResources: ProcessResources by tasks
val sourceSets: SourceSetContainer = the<JavaPluginConvention>().sourceSets
processResources.apply {
inputs.property("version", modVersion)
inputs.property("mcversion", forgeVersion)
from(sourceSets["main"].resources.srcDirs) {
include("mcmod.info")
expand(mapOf("version" to modVersion, "mcversion" to forgeVersion))
}
from(sourceSets["main"].resources.srcDirs) {
exclude("mcmod.info")
}
// Access Transformer jar manifest info
rename("(.+_at.cfg)", "META-INF/$1")
}