Skip to content

Commit

Permalink
Merge pull request #55 from Global-Tags/chore/labyProcessingStructure
Browse files Browse the repository at this point in the history
Update gradle project structure
  • Loading branch information
RappyTV authored Sep 13, 2024
2 parents 9c3551f + 734762b commit 420947d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 118 deletions.
26 changes: 5 additions & 21 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
}
82 changes: 15 additions & 67 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
}
26 changes: 5 additions & 21 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
}
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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
13 changes: 6 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 420947d

Please sign in to comment.