-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
109 lines (89 loc) · 3.04 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
plugins {
id("fabric-loom") version "1.7-SNAPSHOT" apply false
id("legacy-looming") version "1.7-SNAPSHOT" apply false
id("com.github.hierynomus.license-base") version "0.16.1"
id("base")
}
subprojects {
apply(plugin = "java")
apply(plugin = "base")
apply(plugin = "com.github.hierynomus.license-base")
configure<JavaPluginExtension> {
withSourcesJar()
withJavadocJar()
}
tasks {
withType(JavaCompile::class) {
options.encoding = "UTF-8"
println(project.name)
val target_version = when (project.name)
{
"1.7.10" -> JavaVersion.VERSION_1_8
"1.8.9" -> JavaVersion.VERSION_1_8
"1.9.4" -> JavaVersion.VERSION_1_8
"1.10.2" -> JavaVersion.VERSION_1_8
"1.11.2" -> JavaVersion.VERSION_1_8
"1.12.2" -> JavaVersion.VERSION_1_8
"1.13.2" -> JavaVersion.VERSION_1_8
"1.14.4" -> JavaVersion.VERSION_1_8
"1.15.2" -> JavaVersion.VERSION_1_8
"1.16.5" -> JavaVersion.VERSION_1_8
"1.17.1" -> JavaVersion.VERSION_17
"1.18.2" -> JavaVersion.VERSION_17
"1.19.4" -> JavaVersion.VERSION_17
"1.20.4" -> JavaVersion.VERSION_17
"1.21" -> JavaVersion.VERSION_21
else -> JavaVersion.VERSION_1_8
}.toString()
sourceCompatibility = target_version
targetCompatibility = target_version
}
withType(ProcessResources::class) {
inputs.property("version", version)
from(project.the<SourceSetContainer>()["main"].resources.srcDirs) {
include("fabric.mod.json")
expand("version" to version)
}
}
named<Jar>("jar") {
archiveFileName.set("realmsfix-${project.name}-${version}.jar")
}
withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.WARN
}
base {
archivesName.set("realmsfix+${version}")
}
repositories {
maven {
url = uri("https://repo.legacyfabric.net/repository/maven/")
}
}
license {
header = rootProject.file("HEADER")
exclude("**/*.json")
}
// suppress warnings (i'm lazy)
withType(Javadoc::class) {
options {
(this as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
}
}
}
}
tasks.register<Jar>("mergedJar") {
archiveBaseName.set("realmsfix")
destinationDirectory.set(file("$buildDir/mergedJars"))
dependsOn(subprojects.map { it.tasks.named("build") })
// Get all JAR files from subprojects
val jars = subprojects.map {
it.tasks.named("remapJar").get().outputs.files.asPath
}
jars.map { jar ->
from(zipTree(jar)) {
eachFile {
}
}
duplicatesStrategy = DuplicatesStrategy.WARN
}
}