forked from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
131 lines (114 loc) · 3.35 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
// versions
val minecraftVersion = "1.21.1"
val minecraftDep = "=1.21.1"
// https://parchmentmc.org/docs/getting-started
val parchmentVersion = "2024.11.17"
// https://fabricmc.net/develop
val loaderVersion = "0.16.9"
val fapiVersion = "0.114.0+1.21.1"
// dev env mods
// https://modrinth.com/mod/sodium/versions?l=fabric
val sodiumVersion = "mc1.21.1-0.6.5-fabric"
// https://modrinth.com/mod/jade/versions?l=fabric
val jadeVersion = "15.9.2+fabric"
// https://modrinth.com/mod/modmenu/versions
val modmenuVersion = "11.0.3"
// https://modrinth.com/mod/suggestion-tweaker/versions?l=fabric
val suggestionTweakerVersion = "1.20.6-1.5.2+fabric"
// https://modrinth.com/mod/cloth-config/versions?l=fabric
val clothConfigVersion = "15.0.140+fabric"
// buildscript
plugins {
id("fabric-loom") version "1.9.+"
id("maven-publish")
}
base.archivesName = "modid"
group = "io.github.tropheusj"
val buildNum = providers.environmentVariable("GITHUB_RUN_NUMBER")
.filter(String::isNotEmpty)
.map { "build.$it" }
.orElse("local")
.get()
version = "0.1.0+$buildNum-mc$minecraftVersion"
repositories {
maven("https://maven.parchmentmc.org")
maven("https://api.modrinth.com/maven")
}
dependencies {
// dev environment
minecraft("com.mojang:minecraft:$minecraftVersion")
mappings(loom.layered {
officialMojangMappings { nameSyntheticMembers = false }
parchment("org.parchmentmc.data:parchment-$minecraftVersion:$parchmentVersion@zip")
})
modImplementation("net.fabricmc:fabric-loader:$loaderVersion")
// dependencies
modImplementation("net.fabricmc.fabric-api:fabric-api:$fapiVersion")
// dev env
modLocalRuntime("maven.modrinth:sodium:$sodiumVersion")
modLocalRuntime("maven.modrinth:jade:$jadeVersion")
modLocalRuntime("maven.modrinth:modmenu:$modmenuVersion")
modLocalRuntime("maven.modrinth:suggestion-tweaker:$suggestionTweakerVersion")
modLocalRuntime("maven.modrinth:cloth-config:$clothConfigVersion")
}
tasks.withType(ProcessResources::class) {
val properties: Map<String, Any> = mapOf(
"version" to version,
"loader_version" to loaderVersion,
"fapi_version" to fapiVersion,
"minecraft_dependency" to minecraftDep
)
inputs.properties(properties)
filesMatching("fabric.mod.json") {
expand(properties)
}
}
val testmod: SourceSet by sourceSets.creating {
val main: SourceSet = sourceSets["main"]
compileClasspath += main.compileClasspath
compileClasspath += main.output
runtimeClasspath += main.runtimeClasspath
runtimeClasspath += main.output
}
loom {
runs {
register("testmodClient") {
client()
name("Testmod Client")
source(testmod)
}
register("testmodServer") {
server()
name("Testmod Server")
source(testmod)
}
register("gametest") {
server()
source(testmod)
ideConfigGenerated(false) // this is meant for CI
property("fabric-api.gametest")
property("fabric-api.gametest.report-file=${layout.buildDirectory}/junit.xml")
runDir("run/gametest_server")
}
}
}
java {
withSourcesJar()
}
publishing {
publications {
register<MavenPublication>("mavenJava") {
from(components["java"])
}
}
repositories {
maven("https://mvn.devos.one/snapshots") {
name = "devOsSnapshots"
credentials(PasswordCredentials::class)
}
maven("https://mvn.devos.one/releases") {
name = "devOsReleases"
credentials(PasswordCredentials::class)
}
}
}