From 734762b99fd90dd615e66a39d72d5c15065775b3 Mon Sep 17 00:00:00 2001 From: RappyTV Date: Fri, 13 Sep 2024 19:09:37 +0200 Subject: [PATCH] Update gradle project structure --- api/build.gradle.kts | 26 ++------ build.gradle.kts | 82 +++++------------------- core/build.gradle.kts | 26 ++------ game-runner/gradle.properties | 1 + gradle.properties | 3 +- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle.kts | 13 ++-- 7 files changed, 35 insertions(+), 118 deletions(-) create mode 100644 game-runner/gradle.properties diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 947fa5fe..765f8e3a 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,27 +1,11 @@ -version = "0.1.0" - -plugins { - id("java-library") -} +import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType dependencies { + labyProcessor() labyApi("api") - maven(mavenCentral(), "com.rappytv.globaltags:GlobalTagsJava:1.0.10") - - // If you want to use external libraries, you can do that here. - // The dependencies that are specified here are loaded into your project but will also - // automatically be downloaded by labymod, but only if the repository is public. - // If it is private, you have to add and compile the dependency manually. - // You have to specify the repository, there are getters for maven central and sonatype, every - // other repository has to be specified with their url. Example: - // maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.13") -} - -labyModProcessor { - referenceType = net.labymod.gradle.core.processor.ReferenceType.INTERFACE + addonMavenDependency("com.rappytv.globaltags:GlobalTagsJava:1.0.10") } -java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 +labyModAnnotationProcessor { + referenceType = ReferenceType.INTERFACE } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index eefa127c..97a26464 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ 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 = "org.example" -version = "1.0.0" +version = providers.environmentVariable("VERSION").getOrElse("1.2.9") labyMod { defaultPackageName = "com.rappytv.globaltags" //change this to your main package name (used by all modules) @@ -15,75 +15,23 @@ labyMod { author = "RappyTV" description = "Get yourself a custom Globaltag that's publicly visible to anyone using this addon." minecraftVersion = "*" - version = System.getenv().getOrDefault("VERSION", "1.2.9") + version = rootProject.version.toString() } 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" - ) { version, provider -> - configureRun(provider, version) - } - - subprojects.forEach { - if (it.name != "game-runner") { - filter(it.name) + registerVersion(versions.toTypedArray()) { + runs { + getByName("client") { + devLogin = true + } } } } - - addonDev { - productionRelease() - } } subprojects { - plugins.apply("java-library") - plugins.apply("net.labymod.gradle") - plugins.apply("net.labymod.gradle.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 = 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 - } -} + plugins.apply("net.labymod.labygradle") + plugins.apply("net.labymod.labygradle.addon") + group = rootProject.group + version = rootProject.version +} \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index cda5da5a..e86ede62 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,27 +1,11 @@ -version = "0.1.0" - -plugins { - id("java-library") -} +import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType dependencies { + labyProcessor() api(project(":api")) - maven(mavenCentral(), "com.rappytv.globaltags:GlobalTagsJava:1.0.10") - - // If you want to use external libraries, you can do that here. - // The dependencies that are specified here are loaded into your project but will also - // automatically be downloaded by labymod, but only if the repository is public. - // If it is private, you have to add and compile the dependency manually. - // You have to specify the repository, there are getters for maven central and sonatype, every - // other repository has to be specified with their url. Example: - // maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.13") -} - -labyModProcessor { - referenceType = net.labymod.gradle.core.processor.ReferenceType.DEFAULT + addonMavenDependency("com.rappytv.globaltags:GlobalTagsJava:1.0.10") } -java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 +labyModAnnotationProcessor { + referenceType = ReferenceType.DEFAULT } \ No newline at end of file diff --git a/game-runner/gradle.properties b/game-runner/gradle.properties new file mode 100644 index 00000000..982be3fc --- /dev/null +++ b/game-runner/gradle.properties @@ -0,0 +1 @@ +lg_versioned_module=true \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 609a9ced..8f550f57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ -org.gradle.jvmargs=-Xmx4096m \ No newline at end of file +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 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 48c0a02c..e1adfb49 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ 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 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 01845ed9..86fd36e4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,25 +1,24 @@ rootProject.name = "GlobalTags" pluginManagement { - val labyGradlePluginVersion = "0.4.5" - plugins { - id("net.labymod.gradle") version (labyGradlePluginVersion) - } + val labyGradlePluginVersion = "0.5.3" buildscript { repositories { maven("https://dist.labymod.net/api/v1/maven/release/") - maven("https://repo.spongepowered.org/repository/maven-public") + maven("https://maven.neoforged.net/releases/") + maven("https://maven.fabricmc.net/") + gradlePluginPortal() mavenCentral() } dependencies { - classpath("net.labymod.gradle", "addon", labyGradlePluginVersion) + classpath("net.labymod.gradle", "common", labyGradlePluginVersion) } } } -plugins.apply("net.labymod.gradle") +plugins.apply("net.labymod.labygradle.settings") include(":api") include(":core")