Skip to content

Commit

Permalink
Update addon to new Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
HerXayah committed Sep 12, 2024
1 parent f0a534b commit 716b92c
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 231 deletions.
16 changes: 4 additions & 12 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
version = "0.1.0"

plugins {
id("java-library")
}
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType

dependencies {
labyProcessor()
labyApi("api")
}

labyModProcessor {
referenceType = net.labymod.gradle.core.processor.ReferenceType.INTERFACE
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
labyModAnnotationProcessor {
referenceType = ReferenceType.INTERFACE
}
87 changes: 16 additions & 71 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
plugins {
id("java-library")
id("net.labymod.gradle")
id("net.labymod.gradle.addon")
id("net.labymod.labygradle")
id("net.labymod.labygradle.addon")
}


val versions = providers.gradleProperty("net.labymod.minecraft-versions").get().split(";")

group = "de.funkeln.pronouns"
version = System.getenv().getOrDefault("VERSION", "1.0.6")
version = providers.environmentVariable("VERSION").getOrElse("1.0.7")

labyMod {
defaultPackageName = "de.funkeln.pronouns" //change this to your main package name (used by all modules)
Expand All @@ -19,78 +21,21 @@ labyMod {
}

minecraft {
registerVersions(
"1.8.9",
"1.12.2",
"1.16.5",
"1.17.1",
"1.18.2",
"1.19.2",
"1.19.3",
"1.19.4",
"1.20.1",
"1.20.2",
"1.20.4",
"1.20.5",
"1.20.6",
"1.21"
) { version, provider ->
configureRun(provider, version)
}

subprojects.forEach {
if (it.name != "game-runner") {
filter(it.name)
registerVersion(versions.toTypedArray()) {
runs {
getByName("client") {
// When the property is set to true, you can log in with a Minecraft account
// devLogin = true
}
}
}
}

addonDev {
productionRelease()
}
}

subprojects {
plugins.apply("java-library")
plugins.apply("net.labymod.gradle")
plugins.apply("net.labymod.gradle.addon")
plugins.apply("net.labymod.labygradle")
plugins.apply("net.labymod.labygradle.addon")

repositories {
maven("https://libraries.minecraft.net/")
maven("https://repo.spongepowered.org/repository/maven-public/")
}
}

fun configureRun(provider: net.labymod.gradle.core.minecraft.provider.VersionProvider, gameVersion: String) {
provider.runConfiguration {
mainClass = "net.minecraft.launchwrapper.Launch"
jvmArgs("-Dnet.labymod.running-version=${gameVersion}")
jvmArgs("-Dmixin.debug=true")
jvmArgs("-Dnet.labymod.debugging.all=true")
jvmArgs("-Dmixin.env.disableRefMap=true")

args("--tweakClass", "net.labymod.core.loader.vanilla.launchwrapper.LabyModLaunchWrapperTweaker")
args("--labymod-dev-environment", "true")
args("--addon-dev-environment", "true")
}

provider.javaVersion = when (gameVersion) {
else -> {
JavaVersion.VERSION_21
}
}

provider.mixin {
val mixinMinVersion = when (gameVersion) {
"1.8.9", "1.12.2", "1.16.5" -> {
"0.6.6"
}

else -> {
"0.8.2"
}
}

minVersion = mixinMinVersion
}
group = rootProject.group
version = rootProject.version
}
21 changes: 9 additions & 12 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
version = "0.1.6"

plugins {
id("java-library")
}
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType

dependencies {
labyProcessor()
api(project(":api"))
maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.14")
addonMavenDependency("org.apache.httpcomponents:httpclient:4.5.14")

// An example of how to add an external dependency that is used by the addon.
// addonMavenDependency("org.jeasy:easy-random:5.0.0")
}

labyModProcessor {
referenceType = net.labymod.gradle.core.processor.ReferenceType.DEFAULT
labyModAnnotationProcessor {
referenceType = ReferenceType.DEFAULT
}

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

1 change: 1 addition & 0 deletions game-runner/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lg_versioned_module=true
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx4096m
org.gradle.jvmargs=-Xmx4096m
net.labymod.minecraft-versions=1.8.9;1.12.2;1.16.5;1.17.1;1.18.2;1.19.2;1.19.3;1.19.4;1.20.1;1.20.2;1.20.4;1.20.5;1.20.6;1.21;1.21.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 716b92c

Please sign in to comment.