generated from VulpixelMC/fabric-example-mod-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
133 lines (108 loc) · 3.55 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
122
123
124
125
126
127
128
129
130
131
132
133
@file:Suppress("DEPRECATION")
import com.modrinth.minotaur.TaskModrinthUpload
import com.modrinth.minotaur.request.VersionType
plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.0"
id("fabric-loom") version "0.11.+"
id("com.modrinth.minotaur") version "1.2.1"
`maven-publish`
}
val modId: String by project
val minecraftVersion: String by project
val loaderVersion: String by project
val yarnMappings: String by project
val fabricVersion: String by project
val modVersion: String by project
val mavenGroup: String by project
val fabricKotlinVersion: String by project
val modLoader: String by project
val modrinthId: String by project
val verType: String by project
base.archivesBaseName = modId
version = modVersion
group = mavenGroup
repositories {
maven {
name = "JitPack"
url = uri("https://jitpack.io")
}
maven {
name = "Curseforge Maven"
url = uri("https://www.cursemaven.com")
}
maven {
name = "Devan-Kerman/Devan-Repo"
url = uri("https://raw.githubusercontent.com/Devan-Kerman/Devan-Repo/master/")
}
maven {
name = "Bikeshedaniel Maven"
url = uri("https://maven.shedaniel.me/")
}
// // temporary cursed gradle hack for github actions. don't forget to remove this when prospector fixes it!
// if (System.getenv("GITHUB_ACTIONS") == null) {
//
// }
maven {
name = "TerraformersMC"
url = uri("https://maven.terraformersmc.com/")
}
maven {
url = uri("https://bai.jfrog.io/artifactory/maven")
}
}
val modImplementationInclude by configurations.register("modImplementationInclude")
dependencies {
minecraft("net.minecraft", "minecraft", minecraftVersion)
mappings("net.fabricmc", "yarn", yarnMappings, classifier = "v2")
modImplementation("net.fabricmc", "fabric-loader", loaderVersion)
modImplementation("net.fabricmc.fabric-api", "fabric-api", fabricVersion)
modImplementation("net.fabricmc", "fabric-language-kotlin", fabricKotlinVersion)
// modImplementationInclude("net.devtech", "grossfabrichacks", "6.1")
if (!file("ignoreruntime.txt").exists()) {
println("Setting up runtimes...")
modRuntimeOnly("com.terraformersmc", "modmenu", "3.1.0")
modRuntimeOnly("mcp.mobius.waila", "wthit", "fabric-4.8.0")
modRuntimeOnly("me.shedaniel", "RoughlyEnoughItems-fabric", "8.0.442")
// modRuntimeOnly("com.github.mikroskeem", "WorldEditCUI", "mc~1.17-SNAPSHOT")
}
add(sourceSets.main.get().getTaskName("mod", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME), modImplementationInclude)
add(net.fabricmc.loom.util.Constants.Configurations.INCLUDE, modImplementationInclude)
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
tasks.withType<AbstractArchiveTask> {
from(file("LICENSE"))
}
tasks.processResources {
filesMatching("fabric.mod.json") {
expand("version" to project.version)
}
}
tasks.register("publishModrinth", TaskModrinthUpload::class) {
onlyIf {
System.getenv("MODRINTH") != null
}
token = System.getenv("MODRINTH")
projectId = modrinthId
uploadFile = tasks.remapJar.get().archiveFile.get().asFile
addGameVersion(minecraftVersion)
addLoader(modLoader)
versionType = VersionType.valueOf(verType)
versionNumber = version as String
// versionName = "${rootProject.name} ${versionNumber.split('+')[0]} for Minecraft $minecraftVersion"
versionName = File("./modrinth/name.txt").readText()
changelog = File("./modrinth/CHANGELOG.md").readText()
}.get().dependsOn(tasks.build.get())