Skip to content

Commit

Permalink
Change to Architectury Loom buildscript
Browse files Browse the repository at this point in the history
  • Loading branch information
VixidDev committed Jun 19, 2024
1 parent 171f8a2 commit 5f4c04d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 21 deletions.
57 changes: 37 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
java
id("fabric-loom") version "1.6-SNAPSHOT"
id("dev.architectury.loom") version "1.6.397"
id("maven-publish")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("org.jetbrains.kotlin.jvm") version "2.0.0"
}

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

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "21"
}

version = rootProject.property("mod_version").toString()
group = rootProject.property("maven_group").toString()

repositories {
mavenCentral()

maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
maven("https://maven.notenoughupdates.org/releases/")
}
Expand All @@ -27,17 +35,19 @@ val shadowModImpl: Configuration by configurations.creating {
}

dependencies {
// To change the versions see the gradle.properties file
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft_version")}")
"mappings"("net.fabricmc:yarn:${rootProject.property("yarn_mappings")}:v2")
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("loader_version")}")

modApi("net.fabricmc.fabric-api:fabric-api:${rootProject.property("fabric_version")}")
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("loader_version")}")
modImplementation("net.fabricmc:fabric-language-kotlin:${rootProject.property("fabric_kotlin_version")}")
modApi("net.fabricmc.fabric-api:fabric-api:${rootProject.property("fabric_version")}")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

shadowImpl("com.github.kwhat:jnativehook:2.2.2")
shadowModImpl("org.notenoughupdates.moulconfig:modern:3.0.0-beta.11")
modImplementation("org.notenoughupdates.moulconfig:modern:3.0.0-beta.11")
include("org.notenoughupdates.moulconfig:modern:3.0.0-beta.11")

implementation("com.github.kwhat:jnativehook:2.2.2")
include("com.github.kwhat:jnativehook:2.2.2")
}

loom {
Expand All @@ -49,9 +59,26 @@ loom {
}
}

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

tasks.jar {
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
archiveClassifier.set("without-deps")
}

tasks.shadowJar {
configurations = listOf(shadowModImpl)
relocate("io.github.notenoughupdates.moulconfig", "dev.vixid.vsm.deps.moulconfig")
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
archiveClassifier.set("all-dev")
configurations = listOf()
}

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

tasks.processResources {
Expand All @@ -60,14 +87,4 @@ tasks.processResources {
filesMatching("fabric.mod.json") {
expand(inputs.properties)
}
}

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "21"
}

java {
withSourcesJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true

# Fabric Properties
Expand Down
8 changes: 8 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ pluginManagement {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Architectury'
url = 'https://maven.architectury.dev/'
}
maven {
name = 'ForgeMC'
url = 'https://maven.minecraftforge.net/'
}
mavenCentral()
gradlePluginPortal()
}
Expand Down

0 comments on commit 5f4c04d

Please sign in to comment.