Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Kotlin DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
CrypticVerse committed Jun 20, 2024
1 parent ef829bb commit fa265ba
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 199 deletions.
197 changes: 0 additions & 197 deletions build.gradle

This file was deleted.

192 changes: 192 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
import net.darkhax.curseforgegradle.TaskPublishCurseForge
plugins {
id("fabric-loom") version("1.6.+")
`maven-publish`
id("com.modrinth.minotaur") version("2.+")
id("net.darkhax.curseforgegradle") version("1.1.18")
id("com.github.breadmoirai.github-release") version("2.+")
id("com.diffplug.spotless") version("6.25.0")
id("signing")
}

// Gradle Properties
val mod_version: String by project
val mod_name: String by project
val maven_group: String by project
val archives_base_name: String by project
val minecraft_version: String by project
val loader_version: String by project
val fabric_version: String by project
val terrablender_version: String by project
val terraform_wood_api_version: String by project

version = mod_version
group = maven_group

base {
archivesName = archives_base_name
}
spotless {
java {
removeUnusedImports()
importOrder("java", "javax", "", "net.minecraft", "net.crypticverse")
trimTrailingWhitespace()
}
}

loom {
accessWidenerPath = file("src/main/resources/betterbiomes.accesswidener")
runs {
create("datagen") {
server()
name("Data Generation")
vmArg("-Dfabric-api.datagen")
vmArg("-Dfabric-api.datagen.output-dir=${file("src/main/generated")}")
vmArg("-Dfabric-api.datagen.modid=betterbiomes")

runDir("build/datagen")
}
}
}

sourceSets {
main {
resources {
srcDirs("src/main/generated")
}
}
}

repositories {
mavenLocal()
maven {
name = "MinecraftForge"
url = uri("https://maven.minecraftforge.net/")
}
maven { url = uri("https://maven.shedaniel.me") }
maven {
name = "TerraformersMC"
url = uri("https://maven.terraformersmc.com/")
}
maven {
url = uri("https://cursemaven.com")
content {
includeGroup("curse.maven")
}
}
maven {url = uri("https://maven.parchmentmc.org")}
maven {
name = "Modrinth"
url = uri("https://api.modrinth.com/maven")
content {
includeGroup("maven.modrinth")
}
}
}

dependencies {
minecraft("com.mojang:minecraft:${minecraft_version}")
mappings(loom.officialMojangMappings())

modImplementation("net.fabricmc:fabric-loader:${loader_version}")

include("net.fabricmc.fabric-api:fabric-api:${fabric_version}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${fabric_version}")

include("com.github.glitchfiend:TerraBlender-fabric:${terrablender_version}")
modImplementation("com.github.glitchfiend:TerraBlender-fabric:${terrablender_version}")

include("com.terraformersmc.terraform-api:terraform-wood-api-v1:${terraform_wood_api_version}")
modImplementation("com.terraformersmc.terraform-api:terraform-wood-api-v1:${terraform_wood_api_version}")

// Wait for 1.21 REI. Sorry!!!

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}

tasks.withType<ProcessResources> {
inputs.property("version", mod_version)

filesMatching("fabric.mod.json") {
expand(
"version" to mod_version,
)
}
}

java {
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

tasks.withType<Jar> {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}" }
}
}

publishing {
publications {
register<MavenPublication>("mavenJava") {
artifact(tasks.remapJar.get())
artifact(tasks.remapSourcesJar.get())
}
}
repositories {
val deployDir = "file://${project.rootDir}/m2/"
maven(deployDir)
}
}

modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "Qs2o8KiI"
versionNumber = "fabric-${mod_version}"
versionType = "beta"
uploadFile = tasks.remapJar.get()
gameVersions.addAll("1.21")
loaders.addAll("fabric", "quilt")
changelog = provider { rootProject.file("CHANGELOG.md").readText() }
dependencies {
required.project("fabric-api")
required.project("terrablender")
}
}

tasks.register<TaskPublishCurseForge>("curseforge") {
apiToken = System.getenv("CURSEFORGE_TOKEN")

val mainFile = upload(938715, tasks.remapJar.get().archiveFile)
mainFile.releaseType = "beta"
mainFile.displayName = "Better Biomes Fabric ${mod_name}"
mainFile.addGameVersion("1.21")
mainFile.addModLoader("Quilt")
mainFile.addJavaVersion("Java 21")
mainFile.changelog = project.file("CHANGELOG.md").readText()
mainFile.changelogType = "markdown"
mainFile.addRequirement("fabric-api")
mainFile.addRequirement("terrablender-fabric")
}

githubRelease {
owner = "CrypticVerse"
repo = "BetterBiomes"
tagName = "fabric-${mod_version}"
targetCommitish = "3.x-1.21"
prerelease = false
draft = false
releaseAssets(tasks.remapJar.get())
body = provider { rootProject.file("CHANGELOG.md").readText() }
token(System.getenv("GITHUB_TOKEN"))
}
tasks.register("publishMods") {
dependsOn(tasks.modrinth)
dependsOn(tasks.named("curseforge"))
dependsOn(tasks.githubRelease)
dependsOn(tasks.publish)
}
Loading

0 comments on commit fa265ba

Please sign in to comment.