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

Commit

Permalink
Merge pull request #84 from homchom/gradle
Browse files Browse the repository at this point in the history
gradle multiproject build, convention plugins
  • Loading branch information
homchom authored Aug 30, 2024
2 parents 585705b + 6b35579 commit 9fa4d8a
Show file tree
Hide file tree
Showing 373 changed files with 321 additions and 238 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#Gradle
# Gradle
.gradle/
build/
out/
classes/
gradle/wrapper/gradle-wrapper.properties

#IDEA
# IDEA
.idea/
*.iml
*.ipr
*.iws

#vscode
# VSCode
.settings/
.vscode/
bin/
.classpath
.project

#fabric
# Fabric
run/
logs/
*.launch
225 changes: 0 additions & 225 deletions build.gradle.kts

This file was deleted.

28 changes: 28 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
}

dependencies {
fun pluginImplementation(plugin: Provider<PluginDependency>) {
val dep = plugin.get()
implementation(group = dep.pluginId, name = "${dep.pluginId}.gradle.plugin") {
version {
strictly(dep.version.strictVersion)
require(dep.version.requiredVersion)
prefer(dep.version.preferredVersion)
for (version in dep.version.rejectedVersions) reject(version)
}
}
}

pluginImplementation(libs.plugins.kotlin.jvm)
pluginImplementation(libs.plugins.fabric.loom)
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
8 changes: 8 additions & 0 deletions buildSrc/src/main/kotlin/recode.fabric-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id("recode.kotlin-conventions")
id("fabric-loom")
}

java {
withSourcesJar()
}
30 changes: 30 additions & 0 deletions buildSrc/src/main/kotlin/recode.kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm")
}

object JvmVersions {
val java get() = JavaVersion.VERSION_17
val kotlin get() = JvmTarget.JVM_17
}

java {
sourceCompatibility = JvmVersions.java
targetCompatibility = JvmVersions.java
}

tasks.withType<JavaCompile>().configureEach {
options.release = JvmVersions.java.majorVersion.toInt()
options.encoding = "UTF-8"
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget = JvmVersions.kotlin
freeCompilerArgs = listOf(
"-Xjvm-default=all"
)
}
}
9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ org.gradle.jvmargs = -Xmx1G

# https://fabricmc.net/develop/

modName = recode
mavenGroup = io.github.homchom

# the mod version, without metadata
modVersion = 0.1.0-beta.10

Expand Down Expand Up @@ -34,8 +37,4 @@ optional.modmenu.artifact = com.terraformersmc:modmenu
optional.modmenu.version = 9.0.0

optional.sodium.artifact = maven.modrinth:sodium
optional.sodium.version = mc1.20.4-0.5.8

# mod properties
modName = recode
mavenGroup = io.github.homchom
optional.sodium.version = mc1.20.4-0.5.8
21 changes: 21 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[libraries]

# required; change versions every minecraft update
minecraft = { module = "com.mojang:minecraft", version = "1.20.4" }
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version = "0.96.1+1.20.4" }

adventure-platform-fabric = { module = "net.kyori:adventure-platform-fabric", version = "5.12.0" }
libgui = { module = "io.github.cottonmc:LibGui", version = "9.2.2+1.20.2" }
clothConfig = { module = "me.shedaniel.cloth:cloth-config-fabric", version = "13.0.121" }

# optional; change versions every minecraft update
modmenu = { module = "com.terraformersmc:modmenu", version = "9.0.0" }
sodium = { module = "maven.modrinth:sodium", version = "mc1.20.4-0.5.8" }

# change versions as needed
fabric-loader = { module = "net.fabricmc:fabric-loader", version = "0.15.2" }
fabric-language-kotlin = { module = "net.fabricmc:fabric-language-kotlin", version = "1.11.0+kotlin.2.0.0" }

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.0.0" }
fabric-loom = { id = "fabric-loom", version = "1.7-SNAPSHOT" }
Loading

0 comments on commit 9fa4d8a

Please sign in to comment.