Skip to content

Commit

Permalink
Remove Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Aug 2, 2024
1 parent b045aec commit f548aed
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 60 deletions.
5 changes: 0 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ max_line_length = 160
ij_continuation_indent_size = 4
ij_java_class_count_to_use_import_on_demand = 1000

[*.{kt,kts}]
# 2147483647 = some max int (infinity)
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647

[*.{json,mcmeta,json5}]
indent_size = 2
ij_json_keep_blank_lines_in_code = 1
Expand Down
34 changes: 1 addition & 33 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.api.LoomGradleExtensionAPI
import net.fabricmc.loom.task.RemapJarTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jmailen.gradle.kotlinter.KotlinterExtension

plugins {
// Apply the base plugin which mostly defines useful "build lifecycle" tasks like
// assemble, check and build. The root project doesn't contain any Java or Kotlin code,
// assemble, check and build. The root project doesn't contain any code,
// so we won't apply those plugins here. Only the assemble task is used in the root project.
// See https://docs.gradle.org/current/userguide/base_plugin.html.
base

// Set up specific versions of the plugins we're using.
// Note that of all these plugins, only the Architectury plugin needs to be applied.
kotlin("jvm") version "1.9.21" apply false

id("architectury-plugin") version "3.4.+"
id("dev.architectury.loom") version "1.4.+" apply false

id("org.jmailen.kotlinter") version "3.12.0" apply false
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
}

Expand Down Expand Up @@ -62,10 +57,8 @@ tasks {

// Do the shared set up for the Minecraft subprojects.
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "dev.architectury.loom")
apply(plugin = "architectury-plugin")
apply(plugin = "org.jmailen.kotlinter")

// Set Java version.
extensions.configure<JavaPluginExtension> {
Expand Down Expand Up @@ -151,37 +144,12 @@ subprojects {
})
}

extensions.configure<KotlinterExtension> {
disabledRules = arrayOf(
// Disable these since we often do grouping on the parameters and args:
// x: Int, y: Int, z: Int
// width: Int, height: Int, depth: Int
"parameter-list-wrapping",
"argument-list-wrapping",
// Used for minimising diffs on listOf
"trailing-comma-on-call-site",
)
}

tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
}

withType<KotlinCompile> {
// Set the Kotlin JVM target to match the Java version
// for all Kotlin compilation tasks.
kotlinOptions.jvmTarget = "21"

kotlinOptions.freeCompilerArgs = listOf(
// Compile lambdas to invokedynamic.
"-Xlambdas=indy",
// Compile interface functions with bodies to default methods.
"-Xjvm-default=all",
)
}

// Include the license in the jar files.
// See the dependencies section above for why this is in quotes.
"jar"(Jar::class) {
Expand Down
2 changes: 0 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ loom {
}

dependencies {
// Add dependencies on the required Kotlin modules.
implementation(kotlin("stdlib-jdk8"))
implementation("blue.endless:jankson:${rootProject.property("jankson")}")

// Just for @Environment and mixin deps :)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package juuxel.adorn.compat.jei;

import com.google.common.collect.Lists;
import juuxel.adorn.AdornCommon;
import juuxel.adorn.block.AdornBlocks;
import juuxel.adorn.client.gui.screen.TradingStationScreen;
import juuxel.adorn.recipe.AdornRecipes;
import kotlin.collections.CollectionsKt;
import me.shedaniel.rei.plugincompatibilities.api.REIPluginCompatIgnore;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
Expand Down Expand Up @@ -43,7 +43,7 @@ public void registerRecipes(IRecipeRegistration registration) {
private <C extends Inventory, T extends Recipe<C>> void registerRecipes(
IRecipeRegistration registration, RecipeType<T> type, mezz.jei.api.recipe.RecipeType<T> jeiType) {
RecipeManager manager = MinecraftClient.getInstance().world.getRecipeManager();
registration.addRecipes(jeiType, CollectionsKt.map(manager.listAllOfType(type), RecipeEntry::value));
registration.addRecipes(jeiType, Lists.transform(manager.listAllOfType(type), RecipeEntry::value));
}

@Override
Expand Down
4 changes: 0 additions & 4 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ dependencies {
// Standard Fabric mod setup.
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric-loader")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${rootProject.property("fabric-api")}")
modApi("net.fabricmc:fabric-language-kotlin:${rootProject.property("fabric-kotlin")}") {
// TODO: Check if this has been updated
exclude(group = "net.fabricmc", module = "fabric-loader")
}

// Bundle Jankson in the mod and use it as a regular "implementation" library.
bundle(implementation("blue.endless:jankson:${rootProject.property("jankson")}")!!)
Expand Down
1 change: 0 additions & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"depends": {
"minecraft": "~1.20.4",
"fabricloader": ">=0.15.2",
"fabric-language-kotlin": "^1.10.16",
"fabric-api": ">=0.91.2"
},
"conflicts": {
Expand Down
7 changes: 0 additions & 7 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ dependencies {
// Add dependency on NeoForge. This is mainly used for generating the patched Minecraft jar with NeoForge classes.
neoForge("net.neoforged:neoforge:${rootProject.property("neoforge-version")}")

// Add Kotlin.
implementation(kotlin("stdlib"))
forgeRuntimeLibrary(kotlin("stdlib", version = kotlin.coreLibrariesVersion))
(bundle(kotlin("stdlib")) as ModuleDependency)
.exclude(group = "org.jetbrains", module = "annotations")

// Depend on the common project. The "namedElements" configuration contains the non-remapped
// classes and resources of the project.
// It follows Gradle's own convention of xyzElements for "outgoing" configurations like apiElements.
Expand Down Expand Up @@ -66,7 +60,6 @@ dependencies {

tasks {
shadowJar {
relocate("kotlin", "juuxel.adorn.relocated.kotlin")
relocate("blue.endless.jankson", "juuxel.adorn.relocated.jankson")
}

Expand Down
6 changes: 0 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ org.gradle.jvmargs=-Xmx3G -XX:+UseG1GC
# Enable parallel task execution, this makes a multiproject
# a bit faster.
org.gradle.parallel=true
kotlin.code.style = official
# Disable the default dependency on the Kotlin stdlib.
# This is needed for Fabric mods since we want the Kotlin version
# from Fabric Language Kotlin.
kotlin.stdlib.default.dependency = false

# Adorn
mod-version = 5.3.0
Expand All @@ -19,7 +14,6 @@ menu-mappings = 1.19.3+1
# Fabric
fabric-loader = 0.15.2
fabric-api = 0.91.2+1.20.4
fabric-kotlin = 1.10.16+kotlin.1.9.21

# NeoForge
neoforge-version = 20.4.200
Expand Down

0 comments on commit f548aed

Please sign in to comment.