-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
153 lines (131 loc) · 4.9 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
153 lines (131 loc) · 4.9 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
plugins {
id("fabric-loom") version "1.13-SNAPSHOT"
id("maven-publish")
kotlin("jvm") version "2.2.0"
id("com.google.devtools.ksp") version "2.2.0-2.0.2"
id("dev.kikugie.fletching-table.fabric") version "0.1.0-alpha.7"
}
class ModData {
val id = property("mod.id").toString()
val version = property("mod.version").toString()
val group = property("mod.group").toString()
}
val mod = ModData()
version = "${mod.version}+${stonecutter.current.version}"
group = mod.group
base { archivesName.set("${mod.id}-fabric") }
loom {
runConfigs.all {
ideConfigGenerated(true) // Run configurations are not created for subprojects by default
runDir = "../../run" // Use a shared run folder and create separate worlds
}
}
fabricApi {
configureDataGeneration {
client = true
}
}
repositories {
maven("https://maven.terraformersmc.com/") {
name = "Terraformers"
}
maven("https://maven.isxander.dev/releases") {
name = "Xander Maven"
}
maven {
name = "lunarclient"
url = uri("https://repo.lunarclient.dev")
}
maven {
url = uri("https://buf.build/gen/maven")
}
}
dependencies {
// To change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:${stonecutter.current.project}")
mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}:v2")
modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_version")}")
modImplementation("dev.isxander:yet-another-config-lib:${project.property("yacl_version")}")
modImplementation("com.terraformersmc:modmenu:${project.property("modmenu_version")}")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.google.protobuf:protobuf-java:4.31.1")
// implementation("com.lunarclient:apollo-api:1.1.8")
// implementation("com.lunarclient:apollo-protos:0.0.2")
// implementation("com.lunarclient:apollo-common:1.1.8")
include("com.google.code.gson:gson:2.10.1")
include("com.google.protobuf:protobuf-java:4.31.1")
// include("com.lunarclient:apollo-api:1.1.8")
// include("com.lunarclient:apollo-protos:0.0.2")
// include("com.lunarclient:apollo-common:1.1.8")
}
fletchingTable {
mixins.register("main") {
default = "${mod.id}.mixins.json"
}
fabric {
entrypointMappings.put("modmenu", "com.terraformersmc.modmenu.api.ModMenuApi")
}
}
tasks.processResources {
inputs.property("version", project.version)
inputs.property("minecraft_version", project.property("minecraft_version"))
inputs.property("loader_version", project.property("loader_version"))
inputs.property("github", project.property("github"))
inputs.property("yacl_version", project.property("yacl_version"))
filteringCharset = "UTF-8"
filesMatching("fabric.mod.json") {
expand(
"version" to project.version,
"minecraft_version" to project.property("minecraft_version"),
"loader_version" to project.property("loader_version"),
"github" to project.property("github"),
"yacl_version" to project.property("yacl_version")
)
}
}
val targetJavaVersion = 21
tasks.withType<JavaCompile>().configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) {
options.release.set(targetJavaVersion)
}
}
java {
withSourcesJar()
val java = if (stonecutter.eval(stonecutter.current.version, ">=1.20.5"))
JavaVersion.VERSION_21 else JavaVersion.VERSION_17
targetCompatibility = java
sourceCompatibility = java
}
tasks.jar {
from("LICENSE") {
rename { "${it}_${mod.id}" }
}
}
tasks.register<Copy>("buildAndCollect") {
group = "build"
from(tasks.remapJar.get().archiveFile)
into(rootProject.layout.buildDirectory.file("libs/${mod.version}"))
dependsOn("build")
}
// configure the maven publication
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = mod.id
from(components["java"])
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}