-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
121 lines (99 loc) · 3.18 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import groovy.util.ConfigObject
import groovy.util.ConfigSlurper
import net.minecraftforge.gradle.user.ReobfMappingType
import org.gradle.jvm.tasks.Jar
import java.io.File
import java.util.Properties
plugins {
scala
//We apply these to get pretty build script
java
idea
id("com.github.johnrengelman.shadow").version("2.0.4")
id("net.minecraftforge.gradle.forge").version("2.3-SNAPSHOT")
}
val compileJava: JavaCompile by tasks
val compileScala: ScalaCompile by tasks
val shadowJar: ShadowJar by tasks
val config = parseConfig(file("build.properties"))
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
compileJava.options.encoding = "UTF-8"
compileScala.scalaCompileOptions.additionalParameters = listOf("-Xexperimental")
version = "${config["mc_version"]}-${config["version"]}-${config["build_number"]}"
group = "net.katsstuff.teamnightclipse"
base.archivesBaseName = "journeyToGensokyo"
sourceSets["main"].apply {
java {
setSrcDirs(listOf<File>())
}
withConvention(ScalaSourceSet::class) {
scala {
srcDir("src/main/java")
}
}
}
minecraft {
version = "${config["mc_version"]}-${config["forge_version"]}"
runDir = if (file("../run1.12").exists()) "../run1.12" else "run"
mappings = "stable_39"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
replace("@VERSION@", project.version)
replaceIn("LibMod.Scala")
}
repositories {
maven {
name = "TeamNightclipse Bintray"
setUrl("https://dl.bintray.com/team-nightclipse/maven/")
}
jcenter()
mavenLocal()
}
dependencies {
compile("net.katsstuff.teamnightclipse:danmakucore:${config["danmaku_core_version"]}")
}
shadowJar.apply {
classifier = "shaded"
dependencies {
exclude(dependency("com.chuusai:shapeless_2.11:2.3.3"))
exclude(dependency("net.katsstuff.teamnightclipse:mirror:1.12.2-0.3.0"))
exclude(dependency("net.katsstuff.teamnightclipse:danmakucore:${config["danmaku_core_version"]}"))
}
exclude("dummyThing")
relocate("shapeless", "net.katsstuff.mirror.shade.shapeless")
}
tasks.withType<Jar> {
exclude("**/*.psd")
manifest {
attributes(mapOf("FMLAT" to "danmakucore_at.cfg"))
}
}
tasks.withType<ProcessResources> {
inputs.property("version", project.version)
inputs.property("mcversion", minecraft.version)
from(sourceSets["main"].resources.srcDirs) {
include("mcmod.info")
expand(mapOf("version" to project.version, "mcversion" to minecraft.version))
}
from(sourceSets["main"].resources.srcDirs) {
exclude("mcmod.info")
}
}
fun parseConfig(config: File): ConfigObject {
val prop = Properties()
prop.load(config.reader())
return ConfigSlurper().parse(prop)
}
idea.module.inheritOutputDirs = true
tasks["build"].dependsOn(shadowJar)
reobf.create("shadowJar") {
mappingType = ReobfMappingType.SEARGE
}
tasks["reobfShadowJar"].mustRunAfter(shadowJar)
tasks["build"].dependsOn("reobfShadowJar")
artifacts {
add("archives", shadowJar)
}