generated from devOS-Sanity-Edition/fabric-nautical-template-kt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
168 lines (138 loc) · 4.99 KB
/
build.gradle.kts
File metadata and controls
168 lines (138 loc) · 4.99 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
plugins {
kotlin("jvm") version "2.2.0"
`maven-publish`
java
alias(libs.plugins.grgit)
alias(libs.plugins.fabric.loom)
}
val archivesBaseName = "${project.property("archives_base_name").toString()}+mc${libs.versions.minecraft.get()}"
version = getModVersion()
group = project.property("maven_group")!!
repositories {
maven("https://api.modrinth.com/maven")
maven("https://maven.terraformersmc.com/")
maven("https://maven.parchmentmc.org")
maven("https://mvn.devos.one/snapshots")
maven("https://maven.bawnorton.com/releases") // MixinSquared
maven("https://maven.ladysnake.org/releases")
maven("https://cursemaven.com") // ech. curseforge.
maven("https://repo.essential.gg/repository/maven-public") // Essential's Vigilance Config
maven("https://jitpack.io")
}
//All dependencies and their versions are in ./gradle/libs.versions.toml
dependencies {
minecraft(libs.minecraft)
mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.21.1:2024.11.17@zip")
})
// Fabric
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.api)
modImplementation(libs.fabric.language.kotlin)
// Mods
modImplementation(libs.bundles.dependencies)
modLocalRuntime(libs.bundles.dev.mods)
// Config
include(implementation(libs.essential.vigilance.get())!!)
include(modImplementation(libs.essential.universalcraft.get())!!)
// modImplementation(files("localLibs/centered-crosshair+1.21-1.0.8.jar"))
include(modImplementation(libs.fmw.get())!!) // just to avoid the basic long metadata calls
include(implementation(annotationProcessor(libs.mixinsquared.get())!!)!!)
include(implementation(libs.mixinconstraints.get())!!)
include(implementation(libs.brigadier.kotlin.get())!!)
include(implementation(libs.ini4j.get())!!)
include(implementation(libs.qoi.main.get())!!)
include(implementation(libs.qoi.awt.get())!!)
include(implementation(libs.brotli.get())!!)
include(implementation(libs.jna.main.get())!!)
include(implementation(libs.jna.platform.get())!!)
modImplementation(libs.grappling.hook)
modImplementation(libs.lattice)
modCompileOnly(libs.xaeros.minimap)
modImplementation(libs.journeymap)
modImplementation(libs.multikeybindings)
// modImplementation(libs.yungs.api) // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
modImplementation(libs.cloth.config)
modImplementation(libs.better.end.island)
modImplementation(libs.cicada)
modImplementation(libs.`do`.a.barrel.roll)
modImplementation(libs.fabric.permissions.api) // DABR needs this but it doesnt bundle it which is dumb. so you crash on world join w/ this
modCompileOnly(libs.enderscape)
modImplementation(libs.bundles.techreborn)
modImplementation(libs.bundles.polymorph)
}
// Write the version to the fabric.mod.json
tasks.processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") {
expand(mutableMapOf("version" to project.version))
}
}
tasks.withType<JavaCompile>().configureEach {
options.release.set(21)
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}
// This will attempt to publish the mod to the devOS Maven, otherwise it will build the mod locally
// This is auto run by GitHub Actions
task("buildOrPublish") {
group = "build"
var mavenUser = System.getenv().get("MAVEN_USER")
if (!mavenUser.isNullOrEmpty()) {
dependsOn(tasks.getByName("publish"))
println("prepared for publish")
} else {
dependsOn(tasks.getByName("build"))
println("prepared for build")
}
}
// TODO: Uncomment for a non template mod!
publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = project.property("maven_group").toString()
artifactId = project.property("archives_base_name").toString()
version = getModVersion()
from(components.get("java"))
}
}
repositories {
maven {
url = uri("https://mvn.devos.one/${System.getenv()["PUBLISH_SUFFIX"]}/")
credentials {
username = System.getenv()["MAVEN_USER"]
password = System.getenv()["MAVEN_PASS"]
}
}
}
}
fun getModVersion(): String {
val modVersion = project.property("mod_version")
val buildId = System.getenv("GITHUB_RUN_NUMBER")
// CI builds only
if (buildId != null) {
return "${modVersion}+build.${buildId}"
}
// If a git repo can't be found, grgit won't work, this non-null check exists so you don't run grgit stuff without a git repo
if (grgitService.service.get().grgit.head() != null) {
var id = grgitService.service.get().grgit.head().abbreviatedId ?: "NO-COMMIT-HASH"
// Flag the build if the build tree is not clean
// (aka you have uncommitted changes)
if (!grgitService.service.get().grgit.status().isClean()) {
id += "-dirty"
}
// ex: 1.0.0+rev.91949fa or 1.0.0+rev.91949fa-dirty
return "${modVersion}+rev.${id}"
}
// No tracking information could be found about the build
return "${modVersion}+unknown"
}