forked from mezz/JustEnoughItems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
89 lines (79 loc) · 2.79 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
plugins {
id("com.diffplug.spotless") version("5.14.3")
}
apply {
from("buildtools/ColoredOutput.gradle")
}
// gradle.properties
val curseHomepageLink: String by extra
val curseProjectId: String by extra
val forgeVersion: String by extra
val forgeVersionRange: String by extra
val githubUrl: String by extra
val loaderVersionRange: String by extra
val mappingsChannel: String by extra
val mappingsVersion: String by extra
val minecraftVersion: String by extra
val minecraftVersionRange: String by extra
val modAuthor: String by extra
val modGroup: String by extra
val modId: String by extra
val modJavaVersion: String by extra
val modName: String by extra
val specificationVersion: String by extra
spotless {
java {
target("*/src/*/java/mezz/jei/**/*.java")
endWithNewline()
trimTrailingWhitespace()
removeUnusedImports()
}
}
subprojects {
//adds the build number to the end of the version string if on a build server
var buildNumber = project.findProperty("BUILD_NUMBER")
if (buildNumber == null) {
buildNumber = "9999"
}
version = "${specificationVersion}.${buildNumber}"
group = modGroup
tasks.withType<Javadoc> {
// workaround cast for https://github.com/gradle/gradle/issues/7038
val standardJavadocDocletOptions = options as StandardJavadocDocletOptions
// prevent java 8's strict doclint for javadocs from failing builds
standardJavadocDocletOptions.addStringOption("Xdoclint:none", "-quiet")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(JavaLanguageVersion.of(modJavaVersion).asInt())
}
tasks.withType<Jar> {
val now = java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(java.util.Date())
manifest {
attributes(mapOf(
"Specification-Title" to modName,
"Specification-Vendor" to modAuthor,
"Specification-Version" to specificationVersion,
"Implementation-Title" to name,
"Implementation-Version" to archiveVersion,
"Implementation-Vendor" to modAuthor,
"Implementation-Timestamp" to now,
))
}
}
tasks.withType<ProcessResources> {
// this will ensure that this task is redone when the versions change.
inputs.property("version", version)
filesMatching(listOf("META-INF/mods.toml", "pack.mcmeta")) {
expand(mapOf(
"modId" to modId,
"modName" to modName,
"version" to version,
"minecraftVersionRange" to minecraftVersionRange,
"forgeVersionRange" to forgeVersionRange,
"loaderVersionRange" to loaderVersionRange,
"githubUrl" to githubUrl
))
}
}
}