forked from mezz/JustEnoughItems
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
104 lines (93 loc) · 3.43 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
plugins {
id("com.diffplug.spotless") version("5.14.3")
id("com.dorongold.task-tree") version("2.1.0")
}
apply {
from("buildtools/ColoredOutput.gradle")
}
// gradle.properties
val curseHomepageUrl: String by extra
val curseProjectId: String by extra
val fabricApiVersion: String by extra
val fabricLoaderVersion: String by extra
val forgeVersion: String by extra
val forgeVersionRange: String by extra
val githubUrl: String by extra
val loaderVersionRange: String by extra
val parchmentVersionForge: String by extra
val minecraftVersion: String by extra
val minecraftVersionRange: String by extra
val modAuthor: String by extra
val modDescription: 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> {
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
))
}
}
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", "fabric.mod.json")) {
expand(mapOf(
"curseHomepageUrl" to curseHomepageUrl,
"fabricApiVersion" to fabricApiVersion,
"fabricLoaderVersion" to fabricLoaderVersion,
"forgeVersionRange" to forgeVersionRange,
"githubUrl" to githubUrl,
"loaderVersionRange" to loaderVersionRange,
"minecraftVersion" to minecraftVersion,
"minecraftVersionRange" to minecraftVersionRange,
"modAuthor" to modAuthor,
"modDescription" to modDescription,
"modId" to modId,
"modJavaVersion" to modJavaVersion,
"modName" to modName,
"version" to version,
))
}
}
// Activate reproducible builds
// https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
}