Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin Gradle #4831

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
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
181 changes: 0 additions & 181 deletions build.gradle

This file was deleted.

188 changes: 188 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
plugins {
id("fabric-loom") version "1.7-SNAPSHOT"
id("maven-publish")
id("com.github.johnrengelman.shadow") version "8.1.1"
}

val devBuild: String = (project.findProperty("devbuild") ?: "").toString()
val commit: String = (project.findProperty("commit") ?: "").toString()

base {
archivesName = project.property("archives_base_name").toString()
version = project.property("mod_version").toString()
if (devBuild.isNotEmpty()) version = "$version-$devBuild"
group = project.property("maven_group").toString()
}

repositories {
maven("https://maven.meteordev.org/releases") {
name = "meteor-maven"
}
maven("https://maven.meteordev.org/snapshots") {
name = "meteor-maven-snapshots"
}
maven("https://api.modrinth.com/maven") {
name = "modrinth"
content {
includeGroup("maven.modrinth")
}
}
maven("https://maven.vram.io//") {
name = "vram"
}
maven("https://repo.viaversion.com") {
name = "viaversion"
}
}

dependencies {
// Fabric
minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}:v2")
modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")

include(fabricApi.module("fabric-resource-loader-v0", project.property("fapi_version").toString()))
modRuntimeOnly(fabricApi.module("fabric-resource-loader-v0", project.property("fapi_version").toString()))

// Compat fixes
modCompileOnly(fabricApi.module("fabric-renderer-indigo", project.property("fapi_version").toString()))
modCompileOnly("maven.modrinth:sodium:${project.property("sodium_version")}") { isTransitive = false }
modCompileOnly("maven.modrinth:lithium:${project.property("lithium_version")}") { isTransitive = false }
modCompileOnly("maven.modrinth:iris:${project.property("iris_version")}") { isTransitive = false }
modCompileOnly("maven.modrinth:indium:${project.property("indium_version")}") { isTransitive = false }
modCompileOnly("de.florianmichael:ViaFabricPlus:${project.property("viafabricplus_version")}") { isTransitive = false }

// Baritone
modCompileOnly("meteordevelopment:baritone:${project.property("baritone_version")}")

// Libraries

implementation("meteordevelopment:orbit:${project.property("orbit_version")}")
shadow("meteordevelopment:orbit:${project.property("orbit_version")}")

implementation("meteordevelopment:starscript:${project.property("starscript_version")}")
shadow("meteordevelopment:starscript:${project.property("starscript_version")}")

implementation("meteordevelopment:discord-ipc:${project.property("discordipc_version")}")
shadow("meteordevelopment:discord-ipc:${project.property("discordipc_version")}")

implementation("org.reflections:reflections:${project.property("reflections_version")}")
shadow("org.reflections:reflections:${project.property("reflections_version")}")

implementation("io.netty:netty-handler-proxy:${project.property("netty_version")}") { isTransitive = false }
shadow("io.netty:netty-handler-proxy:${project.property("netty_version")}") { isTransitive = false }

implementation("io.netty:netty-codec-socks:${project.property("netty_version")}") { isTransitive = false }
shadow("io.netty:netty-codec-socks:${project.property("netty_version")}") { isTransitive = false }

implementation("de.florianmichael:WaybackAuthLib:${project.property("waybackauthlib_version")}")
shadow("de.florianmichael:WaybackAuthLib:${project.property("waybackauthlib_version")}")

// Launch sub project
shadow(project(":launch"))
}

loom {
accessWidenerPath = file("src/main/resources/meteor-client.accesswidener")
}

afterEvaluate {
tasks.migrateMappings.configure {
setOutputDir("src/main/java")
}
}

tasks {
processResources {
val propertiesMap = mapOf(
"version" to project.version,
"devbuild" to devBuild,
"commit" to commit,
"minecraft_version" to project.property("minecraft_version"),
"loader_version" to project.property("loader_version")
)

inputs.properties(propertiesMap)
filesMatching("fabric.mod.json") {
expand(propertiesMap)
}
}

jar {
from("LICENSE") {
rename{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a space (rename {) and make into single line, like in the shadowJar task

"${it}_${project.base.archivesName}"
}
}

manifest {
attributes["Main-Class"] = "meteordevelopment.meteorclient.main"
}
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

withSourcesJar()
withJavadocJar()
}

shadowJar {
configurations = listOf(project.configurations.shadow.get())

from("LICENSE") {
rename { "${it}_${project.base.archivesName}" }
}

dependencies {
exclude {
it.moduleGroup == "org.slf4j"
}
}
}

remapJar {
dependsOn(shadowJar)
inputFile.set(shadowJar.get().archiveFile)
}

javadoc {
with (options as StandardJavadocDocletOptions) {
addStringOption("Xdoclint:none", "-quiet")
addStringOption("encoding", "UTF-8")
addStringOption("charSet", "UTF-8")
}
}

build {
dependsOn("javadocJar")
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifactId = "meteor-client"

version = project.property("mod_version").toString()
if (project.hasProperty("devbuild")) version += "-SNAPSHOT"
}
}

repositories {
maven(if (project.hasProperty("devbuild")) "https://maven.meteordev.org/snapshots" else "https://maven.meteordev.org/releases") {
name = "meteor-maven"

credentials {
username = System.getenv("MAVEN_METEOR_ALIAS")
password = System.getenv("MAVEN_METEOR_TOKEN")
}

authentication {
create<BasicAuthentication>("basic")
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ archives_base_name=meteor-client
# Dependency Versions

# Baritone (https://github.com/MeteorDevelopment/baritone)
baritone_version=1.21
baritone_version=1.21-SNAPSHOT

# Sodium (https://github.com/CaffeineMC/sodium-fabric)
sodium_version=mc1.21-0.5.11
Expand Down
8 changes: 0 additions & 8 deletions launch/build.gradle

This file was deleted.

Loading
Loading