Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
284 changes: 43 additions & 241 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,91 +1,24 @@
import net.darkhax.curseforgegradle.Constants
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import java.time.LocalDateTime

val repository: String by extra
val mod_name: String by extra
val mod_author: String by extra
val mod_id: String by extra
val release_type: String by extra
val modrinth_project_id: String by extra
val curseforge_project_id: String by extra
val minecraft_version: String by extra
val parchment_version: String by extra
val maven_group: String by extra
val neoforge_version: String by extra

val mod_version = System.getenv("RELEASE_VERSION") ?: extra["mod_version"] as String

plugins {
java
`maven-publish`
alias(libs.plugins.neoforge)
alias(libs.plugins.spotless)
alias(libs.plugins.sonarqube)
alias(libs.plugins.minotaur)
alias(libs.plugins.cursegradle)
}

base {
archivesName = "$mod_name $minecraft_version-$mod_version"
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
withSourcesJar()
id("com.possible-triangle.neoforge")
}

minecraft {
accessTransformers {
file("src/main/resources/META-INF/accesstransformer.cfg")
}
mod {
mods.include(libs.galena.hats)
}

subsystems {
parchment {
minecraftVersion = minecraft_version
mappingsVersion = parchment_version
}
}

runs {
create("client")

create("server") {
workingDirectory("run/server")
}

create("data") {
workingDirectory("run/data")

val existingMods = listOf(
"blueprint",
"shieldexp",
"dye_depot",
)

arguments(
listOf(
"--mod",
mod_id,
"--all",
"--output",
file("src/generated/resources/").path,
"--existing",
file("src/main/resources/").path,
) + existingMods.flatMap {
listOf("--existing-mod", it)
})
neoforge {
dataGen {
existing("blueprint")
existing("shieldexp")
existing("dye_depot")
}
}

sourceSets.main {
resources.srcDir("src/generated/resources")
base {
archivesName = "${mod.name.get()} ${mod.minecraftVersion.get()}-${mod.version.get()}"
}

repositories {
mavenLocal()

maven {
url = uri("https://maven.teamabnormals.com/")
content {
Expand All @@ -98,12 +31,6 @@ repositories {
includeGroup("mezz.jei")
}
}
maven {
url = uri("https://api.modrinth.com/maven")
content {
includeGroup("maven.modrinth")
}
}
maven {
url = uri("https://maven.tterrag.com/")
content {
Expand All @@ -119,8 +46,7 @@ repositories {
}
}

maven {
url = uri("https://registry.somethingcatchy.net/repository/maven-public/")
nexus {
content {
includeGroup("dev.galena")
includeGroup("com.possible-triangle")
Expand All @@ -129,183 +55,59 @@ repositories {
}
}

jarJar.enable()

dependencies {
implementation("net.neoforged:neoforge:${neoforge_version}")
implementation(libs.blueprint)
modApi(libs.blueprint)

implementation(jarJar(libs.galena.hats.get().copy()) {
version {
strictly("[${version},)")
prefer(version!!)
}
})

implementation(libs.multikulti.datagen)
modImplementation(libs.multikulti.datagen)

// Compatibilities
implementation(pack.modrinth.farmers.delight)
// implementation(pack.modrinth.nethers.delight)
// implementation(pack.modrinth.shield.expansion)
implementation(variantOf(libs.create) {
classifier("all")
}) {
modImplementation(pack.modrinth.farmers.delight)
// modApi(pack.modrinth.nethers.delight)
// modApi(pack.modrinth.shield.expansion)
modImplementation(
variantOf(libs.create) {
classifier("all")
},
) {
isTransitive = false
}
implementation(pack.modrinth.supplementaries)
modImplementation(pack.modrinth.supplementaries)

// For dev testing
// runtimeOnly(pack.modrinth.scannable)
// runtimeOnly(pack.modrinth.architectury.api)
runtimeOnly(pack.modrinth.moonlight)
runtimeOnly(libs.dye.depot)
runtimeOnly(pack.modrinth.jade)
runtimeOnly(pack.modrinth.biolith)
runtimeOnly(pack.modrinth.no.mans.land)
modRuntimeOnly(pack.modrinth.moonlight)
modRuntimeOnly(libs.dye.depot)
modRuntimeOnly(pack.modrinth.jade)
modRuntimeOnly(pack.modrinth.biolith)
modRuntimeOnly(pack.modrinth.no.mans.land)

compileOnly(libs.jei.common.api)
compileOnly(libs.jei.neoforge.api)
runtimeOnly(libs.jei.neoforge)
modCompileOnly(libs.jei.common.api)
modCompileOnly(libs.jei.neoforge.api)
modRuntimeOnly(libs.jei.neoforge)
}

tasks.withType<Jar> {
val now = LocalDateTime.now().toString()
manifest {
attributes(
mapOf(
"Specification-Title" to mod_name,
"Specification-Vendor" to mod_author,
"Specification-Version" to mod_version,
"Implementation-Title" to mod_name,
"Implementation-Version" to mod_version,
"Implementation-Vendor" to mod_author,
"Implementation-Timestamp" to now,
"Built-On-Java" to "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})",
"Build-On-Minecraft" to minecraft_version
)
)
}
}

tasks.withType<ProcessResources> {
filesMatching(
listOfNotNull(
"META-INF/mods.toml",
"META-INF/neoforge.mods.toml",
"pack.mcmeta",
"fabric.mod.json",
"${mod_id}*.mixins.json",
)
) {
expand(
mapOf(
"mod_version" to mod_version,
"mod_name" to mod_name,
"mod_id" to mod_id,
"mod_author" to mod_author,
"repository" to repository,
)
)
upload {
maven {
nexus()
}
}

tasks.jar {
archiveClassifier.set("slim")
}

tasks.jarJar {
archiveClassifier.set("")
}

val upload = tasks.jarJar.get().archiveFile.get()

publishing {
publications {
create<MavenPublication>("maven") {
groupId = maven_group
artifactId = mod_id
version = mod_version

artifact(tasks.getByName("sourcesJar"))
artifact(tasks.jar)
artifact(tasks.jarJar)

pom.withXml {
val node = asNode()
val list = node.get("dependencies") as groovy.util.NodeList
list.forEach { node.remove(it as groovy.util.Node) }
}
modrinth {
dependencies {
required("blueprint")
}
}
repositories {
mavenLocal()

val nexusToken = System.getenv("NEXUS_TOKEN")
val nexusUser = System.getenv("NEXUS_USER")
if (nexusToken != null && nexusUser != null) {
maven {
url = uri("https://registry.somethingcatchy.net/repository/maven-releases/")
credentials {
username = nexusUser
password = nexusToken
}
}
curseforge {
dependencies {
required("blueprint", 382216)
}
}
}

tasks.withType<GenerateModuleMetadata> {
enabled = false
}

spotless {
java {
importOrder()
removeUnusedImports()
}

kotlinGradle {
ktlint()
suppressLintsFor { shortCode = "standard:property-naming" }
}

json {
target("src/main/**/*.json")
gson().indentWithSpaces(2)
}
}

sonar {
properties {
property("sonar.projectKey", mod_id)
property("sonar.gradle.skipCompile", "true")
property("sonar.links.scm", "https://github.com/${repository}")
forEach {
versionName = "${mod.name.get()} ${mod.version.get()}"
}
}

modrinth {
projectId = modrinth_project_id
versionNumber = mod_version
versionName = "$mod_name $mod_version"
versionType = release_type
uploadFile = upload
gameVersions = listOf(minecraft_version)
changelog = System.getenv("CHANGELOG")
dependencies {
required.project("blueprint")
}
}

tasks.register<TaskPublishCurseForge>("curseforge") {
apiToken = System.getenv("CURSEFORGE_TOKEN")
upload(curseforge_project_id, upload) {
changelogType = Constants.CHANGELOG_MARKDOWN
changelog = System.getenv("CHANGELOG")
releaseType = release_type
displayName = "$mod_name $mod_version"
addGameVersion(minecraft_version)
addModLoader("NeoForge")
addRelation("blueprint", Constants.RELATION_REQUIRED, "382216")
}
}
enableSpotless()
enableSonarQube()
9 changes: 1 addition & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,4 @@ create = { group = "com.simibubi.create", name = "create-1.21.1", version = "6.0

jei-common-api = { group = "mezz.jei", name = "jei-1.21.1-common-api", version.ref = "jei" }
jei-neoforge-api = { group = "mezz.jei", name = "jei-1.21.1-neoforge-api", version.ref = "jei" }
jei-neoforge = { group = "mezz.jei", name = "jei-1.21.1-neoforge", version.ref = "jei" }

[plugins]
neoforge = { id = "net.neoforged.gradle.userdev", version = "7.0.184" }
spotless = { id = "com.diffplug.spotless", version = "7.0.4" }
sonarqube = { id = "org.sonarqube", version = "6.2.0.5505" }
minotaur = { id = "com.modrinth.minotaur", version = "2.+" }
cursegradle = { id = "com.possible-triangle.curseforgegradle", version = "1.2.5" }
jei-neoforge = { group = "mezz.jei", name = "jei-1.21.1-neoforge", version.ref = "jei" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ pluginManagement {
}

plugins {
id("com.possible-triangle.packwiz") version ("1.0.43")
id("com.possible-triangle.helper") version ("1.0.54")
id("com.possible-triangle.packwiz") version ("1.0.54")
}