From 6061ac7d5c0635d5ee3b05638d44fb36bc525c72 Mon Sep 17 00:00:00 2001 From: Erdragh Date: Sat, 8 Feb 2025 09:53:55 +0100 Subject: [PATCH] Improve Gradle build setup --- .gitignore | 1 + build.gradle.kts | 356 +----------------- buildSrc/build.gradle.kts | 14 + buildSrc/settings.gradle.kts | 7 + .../src/main/groovy/multiloader-common.gradle | 204 ++++++++++ .../src/main/groovy/multiloader-loader.gradle | 99 +++++ common/build.gradle.kts | 50 ++- .../astralbot/config/AstralBotConfig.kt | 4 +- ...mmon.mixins.json => astralbot.mixins.json} | 1 + fabric/build.gradle.kts | 74 ++-- ...xins.json => astralbot.fabric.mixins.json} | 1 + fabric/src/main/resources/fabric.mod.json | 8 +- forge/build.gradle.kts | 120 +++--- .../dev/erdragh/astralbot/forge/BotMod.kt | 6 +- forge/src/main/resources/META-INF/mods.toml | 10 +- ...ixins.json => astralbot.forge.mixins.json} | 1 + gradle.properties | 28 +- gradle/dcwebhooks.versions.toml | 7 + gradle/exposed.versions.toml | 7 + gradle/jda.versions.toml | 23 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- libs.versions.toml | 59 +++ settings.gradle.kts | 19 +- 23 files changed, 602 insertions(+), 499 deletions(-) create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/settings.gradle.kts create mode 100644 buildSrc/src/main/groovy/multiloader-common.gradle create mode 100644 buildSrc/src/main/groovy/multiloader-loader.gradle rename common/src/main/resources/{astralbot-common.mixins.json => astralbot.mixins.json} (86%) rename fabric/src/main/resources/{astralbot.mixins.json => astralbot.fabric.mixins.json} (85%) rename forge/src/main/resources/{astralbot.mixins.json => astralbot.forge.mixins.json} (85%) create mode 100644 gradle/dcwebhooks.versions.toml create mode 100644 gradle/exposed.versions.toml create mode 100644 gradle/jda.versions.toml create mode 100644 libs.versions.toml diff --git a/.gitignore b/.gitignore index f95b34b..5380871 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ faq # Minecraft **/run +**/runs # Architectury .architectury-transformer \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 9f45c9c..ba23668 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,356 +1,12 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import org.jetbrains.kotlin.gradle.utils.extendsFrom -import java.nio.charset.StandardCharsets -import java.text.SimpleDateFormat -import java.util.* -import dev.architectury.plugin.ArchitectPluginExtension -import net.fabricmc.loom.api.LoomGradleExtensionAPI -import net.fabricmc.loom.task.RemapJarTask - plugins { - // This is an Architectury repository, as such the relevant plugins are needed - id("architectury-plugin") version "3.4-SNAPSHOT" - id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false - // The shadow plugin is used by the fabric subproject to include dependencies - // I'm temporarily using a fork of the original plugin to resolve "Unsupported java classfile major version 65" - // see: https://github.com/johnrengelman/shadow/issues/911 - id("io.github.goooler.shadow") version "8.1.8" apply false - // Since this mod/bot is written in Kotlin and expected to run on Minecraft and as such - // the JVM, the Kotlin plugin is needed - kotlin("jvm") version "2.0.10" - // For generating documentation based on comments in the code - id("org.jetbrains.dokka") version "1.9.10" - java - // For publishing the mod - id("me.modmuss50.mod-publish-plugin") version "0.5.1" -} - -val minecraftVersion: String by project - -architectury { - minecraft = minecraftVersion -} - -repositories { - mavenCentral() -} - -subprojects { - apply(plugin = "dev.architectury.loom") - apply(plugin = "architectury-plugin") - apply(plugin = "java") - apply(plugin = "kotlin") - apply(plugin = "org.jetbrains.dokka") - apply(plugin = "me.modmuss50.mod-publish-plugin") - - // Gets some values from the gradle.properties files in the - // sub- and root projects - val modLoader = project.name - val modId: String by project - val modName = rootProject.name - val modAuthor: String by project - val isCommon = modLoader == rootProject.projects.common.name - - base { - // This will be the final name of the exported JAR file - archivesName.set("$modId-$modLoader-$minecraftVersion") - } - - configure { - silentMojangMappingsLicense() - } - - extensions.configure { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) - withSourcesJar() - } - - repositories { - mavenCentral() - maven(url = "https://maven.architectury.dev/") - maven("https://repo.spongepowered.org/repository/maven-public/") { name = "Sponge / Mixin" } - maven("https://maven.blamejared.com") { name = "BlameJared Maven (JEI / CraftTweaker / Bookshelf)" } - // For the parchment mappings - maven(url = "https://maven.parchmentmc.org") - maven(url = "https://maven.resourcefulbees.com/repository/maven-public/") - maven { - name = "Kotlin for Forge" - setUrl("https://thedarkcolour.github.io/KotlinForForge/") - } - // Forge Config API port - maven { - name = "Fuzs Mod Resources" - setUrl("https://raw.githubusercontent.com/Fuzss/modresources/main/maven/") - } - } - - // Bot dependencies - val jdaVersion: String by project - val dcWebhooksVersion: String by project - val exposedVersion: String by project - val sqliteJDBCVersion: String by project - val commonmarkVersion: String by project - - // Configuration for shaded dependencies, get relocated to dev.erdragh.astralbot.shadowed - val shadowBotDep by configurations.creating { - isTransitive = true - } - // This shadowCommon configuration is used to shade the - // common project - val shadowCommon by configurations.creating { - isCanBeConsumed = false - isCanBeResolved = true - } - // Configuration for libraries that are needed at runtime - val runtimeLib by configurations.creating { - isTransitive = true - } - configurations.implementation.extendsFrom(configurations.named("shadowBotDep")) - configurations.implementation.extendsFrom(configurations.named("runtimeLib")) - - dependencies { - // Minecraft Mod dependencies - "minecraft"("::$minecraftVersion") - - @Suppress("UnstableApiUsage") - "mappings"(project.the().layered { - val parchmentVersion: String by project - - officialMojangMappings() - - parchment( - create( - group = "org.parchmentmc.data", - name = "parchment-$minecraftVersion", - version = parchmentVersion - ) - ) - }) - - runtimeLib("org.xerial:sqlite-jdbc:$sqliteJDBCVersion") - if (!isCommon) "include"("org.xerial:sqlite-jdbc:$sqliteJDBCVersion") - - runtimeLib("org.commonmark:commonmark:$commonmarkVersion") - if (!isCommon) "include"("org.commonmark:commonmark:$commonmarkVersion") - - arrayOf( - // Library used to communicate with Discord, see https://jda.wiki - "net.dv8tion:JDA:$jdaVersion", - // Library used for sending messages via Discord Webhooks - "club.minnced:discord-webhooks:$dcWebhooksVersion", - - // Library to interact with the SQLite database, - // see: https://github.com/JetBrains/Exposed - "org.jetbrains.exposed:exposed-core:$exposedVersion", - "org.jetbrains.exposed:exposed-dao:$exposedVersion", - "org.jetbrains.exposed:exposed-jdbc:$exposedVersion", - ).forEach { - implementation(it) { - exclude(module = "opus-java") - exclude(group = "org.slf4j") - } - runtimeLib(it) { - exclude(module = "opus-java") - exclude(group = "org.slf4j") - exclude(group = "org.jetbrains.kotlin") - exclude(group = "org.jetbrains.kotlinx") - } - shadowBotDep(it) { - // opus-java is for audio, which this bot doesn't need - exclude(module = "opus-java") - // Kotlin would be included as a transitive dependency - // on JDA and Exposed, but is already provided by the - // respective Kotlin implementation of the mod loaders - exclude(group = "org.jetbrains.kotlin") - exclude(group = "org.jetbrains.kotlinx") - // Minecraft already ships with a logging system - exclude(group = "org.slf4j") - } - } - } - - java { - withSourcesJar() - modularity.inferModulePath = true - } - - tasks.jar { - // Results in the not remapped jars having a -dev at the end - archiveClassifier.set("dev") - - from(rootProject.file("LICENSE")) { - rename { "${it}_$modId" } - } - - manifest { - attributes( - "Specification-Title" to modId, - "Specification-Vendor" to modAuthor, - "Specification-Version" to archiveVersion, - "Implementation-Title" to project.name, - "Implementation-Version" to archiveVersion, - "Implementation-Vendor" to modAuthor, - "Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()), - "Timestamp" to System.currentTimeMillis(), - "Built-On-Java" to "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})", - "Built-On-Minecraft" to minecraftVersion - ) - } - } - - tasks.processResources { - val version: String by project - val group: String by project - val fabricApiVersion: String by project - val fabricLoaderVersion: String by project - val fabricKotlinVersion: String by project - val license: String by project - val description: String by project - val credits: String by project - val title: String by project - - val expandProps = mapOf( - "version" to version, - "group" to group, //Else we target the task's group. - "minecraft_version" to minecraftVersion, - "fabric_version" to fabricApiVersion, - "fabric_loader_version" to fabricLoaderVersion, - "fabric_kotlin_version" to fabricKotlinVersion, - "mod_name" to modName, - "mod_author" to modAuthor, - "mod_id" to modId, - "license" to license, - "description" to description, - "credits" to credits, - "title" to title - ) - - filesMatching(listOf("pack.mcmeta", "*.mixins.json", "META-INF/mods.toml", "fabric.mod.json")) { - expand(expandProps) - } - inputs.properties(expandProps) - } - - if (!isCommon) { - apply(plugin = "io.github.goooler.shadow") - - configure { - platformSetupLoomIde() - } - - tasks.named("shadowJar") { - // The shadowBotDep configuration was explicitly made to be shaded in, this is where that happens - configurations.clear() - configurations = listOf(shadowBotDep, shadowCommon) - - // This transforms the service files to make relocated Exposed work (see: https://github.com/JetBrains/Exposed/issues/1353) - mergeServiceFiles() - - // Forge restricts loading certain classes for security reasons. - // Luckily, shadow can relocate them to a different package. - relocate("org.apache.commons.collections4", "dev.erdragh.shadowed.org.apache.commons.collections4") - - // Relocating Exposed somewhere different so other mods not doing that don't run into issues (e.g. Ledger) - relocate("org.jetbrains.exposed", "dev.erdragh.shadowed.org.jetbrains.exposed") - - // Relocating jackson to prevent incompatibilities with other mods also bundling it (e.g. GroovyModLoader on Forge) - relocate("com.fasterxml.jackson", "dev.erdragh.shadowed.com.fasterxml.jackson") - - // relocate discord interaction stuff to maybe allow other discord integrations mods to work - relocate("club.minnced.discord", "dev.erdragh.shadowed.club.minnced.discord") - relocate("net.dv8tion.jda", "dev.erdragh.shadowed.net.dv8tion.jda") - - // relocate dependencies of discord stuff - relocate("okhttp3", "dev.erdragh.shadowed.okhttp3") - relocate("okio", "dev.erdragh.shadowed.okio") - relocate("gnu.trove", "dev.erdragh.shadowed.gnu.trove") - relocate("com.iwebpp.crypto", "dev.erdragh.shadowed.com.iwebpp.crypto") - relocate("com.neovisionaries.ws", "dev.erdragh.shadowed.com.neovisionaries.ws") - relocate("org.json", "dev.erdragh.shadowed.org.json") - relocate("net.bytebuddy", "dev.erdragh.shadowed.net.bytebuddy") - - relocate("com.google", "dev.erdragh.shadowed.com.google") - relocate("google", "dev.erdragh.shadowed.google") - relocate("javax.annotation", "dev.erdragh.shadowed.javax.annotation") - - exclude("**/org/slf4j/**") - - exclude("**/org/jetbrains/annotations/*") - exclude("**/org/intellij/**") - } - - tasks.named("remapJar") { - inputFile.set(tasks.named("shadowJar").get().archiveFile) - dependsOn("shadowJar") - // Results in the remapped jar not having any extra bit in - // its file name, identifying it as the main distribution - archiveClassifier.set(null as String?) - } - } - - // Disables Gradle's custom module metadata from being published to maven. The - // metadata includes mapped dependencies which are not reasonably consumable by - // other mod developers. - tasks.withType { - enabled = false - } - - tasks.withType { - options.encoding = "UTF-8" - targetCompatibility = JavaVersion.VERSION_17.majorVersion - sourceCompatibility = JavaVersion.VERSION_17.majorVersion - } - - // Publishing settings - if (!isCommon) { - publishMods { - // These titles get used based on subproject name - val titles by extra { - mapOf( - "fabric" to "Fabric", - "neoforge" to "NeoForge", - "forge" to "Forge", - "quilt" to "Quilt" - ) - } - val curseforgePublish by extra { - curseforgeOptions { - accessToken = providers.environmentVariable("CURSEFORGE_TOKEN") - minecraftVersions.add(minecraftVersion) - projectId = providers.environmentVariable("CURSEFORGE_ID") - embeds("sqlite-jdbc") - } - } - val modrinthPublish by extra { - modrinthOptions { - accessToken = providers.environmentVariable("MODRINTH_TOKEN") - minecraftVersions.add(minecraftVersion) - projectId = providers.environmentVariable("MODRINTH_ID") - embeds("sqlite-jdbc") - } - } - val changelog by extra { - // Only gets the lines for the latest version from the Changelog - // file. This allows me to keep all previous changes in the file - // without having to worry about them being included on new file - // uploads. - File(rootDir, "CHANGELOG.md") - .readText(StandardCharsets.UTF_8) - .replace(Regex("[^^](#(#|\\n|.)+)|(^#.+)"), "") - .trim() - } - val type by extra { - STABLE - } - } - } -} - -kotlin { - jvmToolchain(17) + // see https://fabricmc.net/develop/ for new versions + alias(libs.plugins.loom) apply false + // see https://projects.neoforged.net/neoforged/moddevgradle for new versions + alias(libs.plugins.moddev) apply false + // so we can enable soruce download + idea } - // IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. idea { module { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..f80c745 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + id("groovy-gradle-plugin") +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.get()}") + implementation("org.jetbrains.dokka:dokka-gradle-plugin:${libs.versions.dokka.get()}") + implementation("me.modmuss50:mod-publish-plugin:${libs.versions.publish.get()}") +} + +repositories { + mavenCentral() + gradlePluginPortal() +} \ No newline at end of file diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 0000000..36adc8e --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,7 @@ +dependencyResolutionManagement { + versionCatalogs { + register("libs") { + from(files("../libs.versions.toml")) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/multiloader-common.gradle b/buildSrc/src/main/groovy/multiloader-common.gradle new file mode 100644 index 0000000..f9ab7af --- /dev/null +++ b/buildSrc/src/main/groovy/multiloader-common.gradle @@ -0,0 +1,204 @@ +import org.jetbrains.dokka.gradle.DokkaTaskPartial + +plugins { + id 'java-library' + id 'maven-publish' + id "org.jetbrains.kotlin.jvm" + id "org.jetbrains.dokka" +} + +base { + archivesName = "${modId}-${project.name}-${libs.versions.minecraft.get()}" +} + +java { + toolchain.languageVersion = JavaLanguageVersion.of(libs.versions.java.get()) + withSourcesJar() + withJavadocJar() +} + +kotlin { + jvmToolchain(Integer.parseInt(libs.versions.java.get())) +} + +repositories { + mavenCentral() + exclusiveContent { + forRepositories( + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org/' + }, + maven { + name = "Forge" + url = 'https://maven.minecraftforge.net' + } + ) + filter { includeGroup('org.parchmentmc.data') } + } + maven { + name = 'BlameJared' + url = 'https://maven.blamejared.com' + } + maven { + name = "kotlinforforge" + url = uri("https://thedarkcolour.github.io/KotlinForForge/") + } + maven { + name = "Sponge / Mixin" + url = "https://repo.spongepowered.org/repository/maven-public/" + } + // Forge Config API port + maven { + name = "Fuzs Mod Resources" + setUrl("https://raw.githubusercontent.com/Fuzss/modresources/main/maven/") + } +} + +// Declare capabilities on the outgoing configurations. +// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component +['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> + configurations."$variant".outgoing { + capability("$group:${base.archivesName.get()}:$version") + capability("$group:$modId-${project.name}-${libs.versions.minecraft.get()}:$version") + capability("$group:$modId:$version") + } + publishing.publications.configureEach { + suppressPomMetadataWarningsFor(variant) + } +} + +sourcesJar { + from(rootProject.file('LICENSE')) { + rename { "${it}_${modId}" } + } +} + +jar { + from(rootProject.file('LICENSE')) { + rename { "${it}_${modId}" } + } + + manifest { + attributes([ + 'Specification-Title' : modName, + 'Specification-Vendor' : modAuthor, + 'Specification-Version' : project.jar.archiveVersion, + 'Implementation-Title' : project.name, + 'Implementation-Version': project.jar.archiveVersion, + 'Implementation-Vendor' : modAuthor, + 'Built-On-Minecraft' : libs.versions.minecraft.get() + ]) + } +} + +tasks.withType(DokkaTaskPartial).configureEach { + dokkaSourceSets.configureEach { + includeNonPublic = false + skipDeprecated = false + reportUndocumented = false + jdkVersion = Integer.parseInt(libs.versions.java.get()) + sourceRoots.from(sourceSets.main.allSource) + } +} + +// Prevent the default javadoc task from running, as Dokka is +// responsible for generating the docs now +tasks.named("javadoc", Javadoc) { + enabled = false +} + +// Make the javadoc jar take in the Dokka output +tasks.named("javadocJar", Jar) { + dependsOn(tasks.named("dokkaJavadoc")) + from(tasks.named("dokkaJavadoc")) +} + +processResources { + var expandProps = [ + 'version' : version, + 'group' : project.group, //Else we target the task's group. + 'minecraft_version' : libs.versions.minecraft.get(), + 'minecraft_version_range' : libs.versions.minecraftRange.get(), + 'fabric_version' : libs.versions.fabricApi.get(), + 'fabric_loader_version' : libs.versions.fabricLoader.get(), + 'flk_version' : libs.versions.flk.get(), + 'mod_name' : modName, + 'mod_author' : modAuthor, + 'mod_id' : modId, + 'license' : license, + 'description' : project.description, + 'forge_version' : libs.versions.forge.get(), + 'forge_range' : libs.versions.forgeRange.get(), + 'kff_version' : libs.versions.kff.get(), + 'kff_version_range' : libs.versions.kffRange.get(), + 'credits' : credits, + 'java_version' : libs.versions.java.get(), + 'fcapi_version' : libs.versions.fcapi.get() + ] + + filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/*mods.toml', '*.mixins.json']) { + expand expandProps + } + inputs.properties(expandProps) +} + +publishing { + publications { + register('mavenJava', MavenPublication) { + artifactId base.archivesName.get() + from components.java + } + } + repositories { + maven { + url System.getenv('local_maven_url') + } + } +} + + +configurations { + botLib { + transitive = false + } + implementation.extendsFrom(botLib) +} + +dependencies { + [ + // Library to build a connection with the sqlite database + libs.sqlite, + // Library used to parse and convert markdown + libs.commonmark, + + // Library used to communicate with Discord, see https://jda.wiki + jda.jda, + // JDA's dependencies + jda.commons.collections, + jda.trove4j, + jda.jackson.annotations, + jda.jackson.core, + jda.jackson.databind, + jda.websocket, + jda.okhttp, + jda.okio, + jda.tink, + // Library used for sending messages via Discord Webhooks + dcwebhooks.webhooks, + dcwebhooks.json, + + // Library to interact with the SQLite database, + // see: https://github.com/JetBrains/Exposed + exposed.core, + exposed.dao, + exposed.jdbc, + ].forEach { + botLib(it) { + exclude group: "org.slf4j" + exclude group: "org.jetbrains.kotlin" + exclude group: "org.jetbrains.kotlinx" + exclude module: "opus-java" + } + } +} diff --git a/buildSrc/src/main/groovy/multiloader-loader.gradle b/buildSrc/src/main/groovy/multiloader-loader.gradle new file mode 100644 index 0000000..3ef4358 --- /dev/null +++ b/buildSrc/src/main/groovy/multiloader-loader.gradle @@ -0,0 +1,99 @@ +import org.jetbrains.dokka.gradle.DokkaTask + +import java.nio.file.Files + +plugins { + id 'multiloader-common' + id "org.jetbrains.kotlin.jvm" + id "me.modmuss50.mod-publish-plugin" +} + +configurations { + commonJava { + canBeResolved = true + } + commonKotlin { + canBeResolved = true + } + commonResources { + canBeResolved = true + } +} + +dependencies { + compileOnly(project(':common')) { + capabilities { + requireCapability "$group:$modId" + } + } + commonJava project(path: ':common', configuration: 'commonJava') + commonKotlin project(path: ':common', configuration: 'commonKotlin') + commonResources project(path: ':common', configuration: 'commonResources') +} + +tasks.named('compileJava', JavaCompile) { + dependsOn(configurations.commonJava) + source(configurations.commonJava) +} + +tasks.named('compileKotlin') { + dependsOn(configurations.commonKotlin) + dependsOn(configurations.commonJava) + source(configurations.commonJava) + source(configurations.commonKotlin) +} + +processResources { + dependsOn(configurations.commonResources) + from(configurations.commonResources) +} + +tasks.named('sourcesJar', Jar) { + dependsOn(configurations.commonJava) + from(configurations.commonJava) + dependsOn(configurations.commonKotlin) + from(configurations.commonKotlin) + dependsOn(configurations.commonResources) + from(configurations.commonResources) +} + +// Use dokka to generate javadoc for both Java and Kotlin sources +// instead of using the builtin javadoc tools. This allows mixing +// Kotlin and Java +tasks.named("dokkaJavadoc", DokkaTask) { + dependsOn(configurations.commonJava) + dependsOn(configurations.commonKotlin) + dokkaSourceSets.configureEach { + sourceRoots.from(configurations.commonJava.singleFile, configurations.commonKotlin.singleFile) + } +} + + +// These titles get used based on subproject name +ext.titles = [ + "fabric" : "Fabric", + "neoforge" : "NeoForge", + "forge" : "Forge" +] +ext.curseforgePublish = publishMods.curseforgeOptions { + accessToken = providers.environmentVariable("CURSEFORGE_TOKEN") + minecraftVersions.add(libs.versions.minecraft.get()) + projectId = providers.environmentVariable("CURSEFORGE_ID") + embeds("sqlite-jdbc") +} +ext.modrinthPublish = publishMods.modrinthOptions { + accessToken = providers.environmentVariable("MODRINTH_TOKEN") + minecraftVersions.add(libs.versions.minecraft.get()) + projectId = providers.environmentVariable("MODRINTH_ID") + embeds("sqlite-jdbc") +} + +// Only gets the lines for the latest version from the Changelog +// file. This allows me to keep all previous changes in the file +// without having to worry about them being included on new file +// uploads. +ext.changelog = Files.readString(rootDir.toPath().resolve("CHANGELOG.md")) + .replaceAll("[^^](#(#|\\n|.)+)|(^#.+)", "") + .trim() + +ext.type = publishMods.STABLE \ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 74e9fcb..d492c2f 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,14 +1,46 @@ -architectury { - val enabledPlatforms: String by rootProject - common(enabledPlatforms.split(",")) +plugins { + id("multiloader-common") + alias(libs.plugins.moddev) +} + +legacyForge { + mcpVersion = libs.versions.mcp.get() + // Automatically enable AccessTransformers if the file exists + val at = file("src/main/resources/META-INF/accesstransformer.cfg") + if (at.exists()) { + accessTransformers.from(at.absolutePath) + } + parchment { + minecraftVersion = libs.versions.parchmentMC.get() + mappingsVersion = libs.versions.parchment.get() + } } dependencies { - val fabricLoaderVersion: String by project - val forgeConfigAPIVersion: String by project - // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies - // Do NOT use other classes from fabric loader - modImplementation("net.fabricmc:fabric-loader:${fabricLoaderVersion}") + api(libs.slf4j) + compileOnly(libs.kotlinx.coroutines) + compileOnly(libs.mixin) + + api(libs.fcapi.common) +} + +configurations { + create("commonJava") { + isCanBeResolved = false + isCanBeConsumed = true + } + create("commonKotlin") { + isCanBeResolved = false + isCanBeConsumed = true + } + create("commonResources") { + isCanBeResolved = false + isCanBeConsumed = true + } +} - api("fuzs.forgeconfigapiport:forgeconfigapiport-common:$forgeConfigAPIVersion") +artifacts { + add("commonJava", sourceSets.main.get().java.sourceDirectories.singleFile) + add("commonKotlin", sourceSets.main.get().kotlin.sourceDirectories.filter { !it.name.endsWith("java") }.singleFile) + add("commonResources", sourceSets.main.get().resources.sourceDirectories.singleFile) } \ No newline at end of file diff --git a/common/src/main/kotlin/dev/erdragh/astralbot/config/AstralBotConfig.kt b/common/src/main/kotlin/dev/erdragh/astralbot/config/AstralBotConfig.kt index 66b0194..881a77e 100644 --- a/common/src/main/kotlin/dev/erdragh/astralbot/config/AstralBotConfig.kt +++ b/common/src/main/kotlin/dev/erdragh/astralbot/config/AstralBotConfig.kt @@ -141,9 +141,9 @@ object AstralBotConfig { DISCORD_CHANNEL = builder.comment("Channel ID where the chat messages are synced") .defineInRange("discordChannel", 0L, 0L, Long.MAX_VALUE) DISCORD_GUILD = builder.comment("Guild (server) ID where the chat messages etc. are synced") - .defineInRange("discordChannel", 0L, 0L, Long.MAX_VALUE) + .defineInRange("discordGuild", 0L, 0L, Long.MAX_VALUE) DISCORD_ROLE = builder.comment("ID of the role given to linked users") - .defineInRange("discordChannel", 0L, 0L, Long.MAX_VALUE) + .defineInRange("discordRole", 0L, 0L, Long.MAX_VALUE) CLICKABLE_MESSAGES = builder.comment("Whether to make messages sent into the Minecraft chat open the Discord chat when clicked") diff --git a/common/src/main/resources/astralbot-common.mixins.json b/common/src/main/resources/astralbot.mixins.json similarity index 86% rename from common/src/main/resources/astralbot-common.mixins.json rename to common/src/main/resources/astralbot.mixins.json index 215a460..021f3c9 100644 --- a/common/src/main/resources/astralbot-common.mixins.json +++ b/common/src/main/resources/astralbot.mixins.json @@ -2,6 +2,7 @@ "required": true, "minVersion": "0.8", "package": "dev.erdragh.astralbot.mixins", + "refmap": "${mod_id}.refmap.json", "compatibilityLevel": "JAVA_17", "server": [ "PlayerListMixin", diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 1dcb324..ba625b1 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -1,43 +1,61 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import me.modmuss50.mpp.ReleaseType import me.modmuss50.mpp.platforms.curseforge.CurseforgeOptions import me.modmuss50.mpp.platforms.modrinth.ModrinthOptions -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -architectury { - fabric() +plugins { + id("multiloader-loader") + alias(libs.plugins.loom) } -val common: Configuration by configurations.creating { - configurations.compileClasspath.get().extendsFrom(this) - configurations.runtimeClasspath.get().extendsFrom(this) - configurations["developmentFabric"].extendsFrom(this) -} +val modId: String by project + +val botLib: Configuration by configurations.getting dependencies { - common(project(":common", configuration = "namedElements")) { - isTransitive = false - } - shadowCommon(project(path = ":common", configuration = "transformProductionFabric")) { - isTransitive = false - } + minecraft(libs.minecraft) + mappings(loom.layered { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${libs.versions.parchmentMC.get()}:${libs.versions.parchment.get()}@zip") + }) + modImplementation(libs.fabricLoader) + modImplementation(libs.fabricApi) - val minecraftVersion: String by project - val fabricLoaderVersion: String by project - val fabricApiVersion: String by project - val fabricKotlinVersion: String by project - val forgeConfigAPIVersion: String by project + modImplementation(libs.flk) - modImplementation(group = "net.fabricmc", name = "fabric-loader", version = fabricLoaderVersion) - modApi(group = "net.fabricmc.fabric-api", name = "fabric-api", version = "$fabricApiVersion+$minecraftVersion") - modImplementation("net.fabricmc:fabric-language-kotlin:${fabricKotlinVersion}") + modApi(libs.fcapi.fabric) - modApi("fuzs.forgeconfigapiport:forgeconfigapiport-fabric:$forgeConfigAPIVersion") + botLib.dependencies.forEach { include(it) } +} + +loom { + val aw = project(":common").file("src/main/resources/${modId}.accesswidener") + if (aw.exists()) { + accessWidenerPath.set(aw) + } + mixin { + defaultRefmapName.set("${modId}.refmap.json") + } + runs { + named("client") { + client() + setConfigName("Fabric Client") + ideConfigGenerated(true) + mkdir("runs/server") + runDir("runs/client") + } + named("server") { + server() + setConfigName("Fabric Server") + ideConfigGenerated(true) + mkdir("runs/server") + runDir("runs/server") + } + } } publishMods { - val minecraftVersion: String by project - val title: String by project + val minecraftVersion = libs.versions.minecraft.get() + val modName: String by project val version: String by project val titles: Map by extra @@ -52,7 +70,7 @@ publishMods { modLoaders.add(project.name) file.set(tasks.remapJar.get().archiveFile) additionalFiles.plus(tasks.sourcesJar.get().archiveFile) - displayName = "$title $version ${titles[project.name]} $minecraftVersion" + displayName = "$modName $version ${titles[project.name]} $minecraftVersion" this.version = "$version-mc$minecraftVersion-${project.name}" requires("fabric-language-kotlin", "forge-config-api-port-fabric", "fabric-api") } @@ -62,7 +80,7 @@ publishMods { modLoaders.add(project.name) file.set(tasks.remapJar.get().archiveFile) additionalFiles.plus(tasks.sourcesJar.get().archiveFile) - displayName = "$title $version ${titles[project.name]} $minecraftVersion" + displayName = "$modName $version ${titles[project.name]} $minecraftVersion" this.version = "$version-mc$minecraftVersion-${project.name}" requires("fabric-language-kotlin", "forge-config-api-port", "fabric-api") } diff --git a/fabric/src/main/resources/astralbot.mixins.json b/fabric/src/main/resources/astralbot.fabric.mixins.json similarity index 85% rename from fabric/src/main/resources/astralbot.mixins.json rename to fabric/src/main/resources/astralbot.fabric.mixins.json index 5dfcea1..2e68eba 100644 --- a/fabric/src/main/resources/astralbot.mixins.json +++ b/fabric/src/main/resources/astralbot.fabric.mixins.json @@ -3,6 +3,7 @@ "minVersion": "0.8", "package": "dev.erdragh.astralbot.mixins.fabric", "compatibilityLevel": "JAVA_17", + "refmap": "${mod_id}.refmap.json", "mixins": [ ], "client": [ diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 7e1d446..d162068 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -24,14 +24,14 @@ ] }, "mixins": [ - "astralbot-common.mixins.json", - "astralbot.mixins.json" + "astralbot.mixins.json", + "astralbot.fabric.mixins.json" ], "depends": { "fabric": "*", "minecraft": ">=${minecraft_version}", "java": ">=17", - "fabric-language-kotlin": ">=${fabric_kotlin_version}", - "forgeconfigapiport": ">=8.0.0" + "fabric-language-kotlin": ">=${flk_version}", + "forgeconfigapiport": ">=${fcapi_version}" } } \ No newline at end of file diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index c8fb2a8..c3ed467 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -1,85 +1,63 @@ -import me.modmuss50.mpp.ReleaseType -import me.modmuss50.mpp.platforms.curseforge.CurseforgeOptions -import me.modmuss50.mpp.platforms.modrinth.ModrinthOptions +import org.gradle.internal.extensions.stdlib.capitalized +import org.jetbrains.kotlin.gradle.utils.extendsFrom -architectury { - forge() +plugins { + id("multiloader-loader") + alias(libs.plugins.moddev) } -loom { - forge { - mixinConfig("astralbot-common.mixins.json") - mixinConfig("astralbot.mixins.json") +val modId: String by project + +mixin { + add(sourceSets.main.get(), "${modId}.refmap.json") + config("${modId}.mixins.json") + config("${modId}.forge.mixins.json") +} +tasks.jar { + manifest { + attributes["MixinConfigs"] = "${modId}.mixins.json,${modId}.forge.mixins.json" + } +} + +legacyForge { + version = libs.versions.forge.get() + // Automatically enable neoforge AccessTransformers if the file exists + val at = project(":common").file("src/main/resources/META-INF/accesstransformer.cfg") + if (at.exists()) { + accessTransformers.from(at.absolutePath) + } + parchment { + minecraftVersion = libs.versions.parchmentMC.get() + mappingsVersion = libs.versions.parchment.get() } - // This sets up data generation. At the time of writing this - // Comment, this is useless, as there are no resources to be - // generated. I want to keep it in as a reference tho. runs { - create("data") { + configureEach { + systemProperty("forge.enabledGameTestNamespaces", modId) + ideName = "Forge ${name.capitalized()} (${project.path})" // Unify the run config names with fabric + } + register("client") { + client() + } + register("data") { data() - programArgs("--all", "--mod", "astralbot") - programArgs("--output", project(":common").file("src/main/generated/resources").absolutePath) - programArgs("--existing", project(":common").file("src/main/resources").absolutePath) + } + register("server") { + server() } } -} - -val common: Configuration by configurations.creating { - configurations.compileClasspath.get().extendsFrom(this) - configurations.runtimeClasspath.get().extendsFrom(this) - configurations["developmentForge"].extendsFrom(this) -} - -val runtimeLib by configurations.getting - -dependencies { - common(project(":common", configuration = "namedElements")) { - isTransitive = false - } - shadowCommon(project(path = ":common", configuration = "transformProductionForge")) { - isTransitive = false + mods { + register(modId) { + sourceSet(sourceSets.main.get()) + } } - - val minecraftVersion: String by project - val forgeVersion: String by project - val kotlinForgeVersion: String by project - - forge(group = "net.minecraftforge", name = "forge", version = "$minecraftVersion-$forgeVersion") - // Adds KFF as dependency and Kotlin libs - implementation("thedarkcolour:kotlinforforge:$kotlinForgeVersion") - - // This *should* theoretically fix the Forge development environment not having - // access to certain classes, but I haven't gotten it to work just yet. - runtimeLib.dependencies.forEach(::forgeRuntimeLibrary) } -publishMods { - val minecraftVersion: String by project - val title: String by project - val version: String by project - - val titles: Map by extra - val curseforgePublish: Provider by extra - val modrinthPublish: Provider by extra - - changelog = extra.get("changelog") as String - type = extra.get("type") as ReleaseType +sourceSets.main.get().resources { srcDir("src/generated/resources") } - curseforge("curseForge") { - from(curseforgePublish) - modLoaders.add(project.name) - file.set(tasks.remapJar.get().archiveFile) - displayName = "$title $version ${titles[project.name]} $minecraftVersion" - this.version = "$version-mc$minecraftVersion-${project.name}" - requires("kotlin-for-forge") - } +dependencies { + implementation(libs.kff) + annotationProcessor(variantOf(libs.mixin) { classifier("processor") }) - modrinth("modrinthForge") { - from(modrinthPublish) - modLoaders.add(project.name) - file.set(tasks.remapJar.get().archiveFile) - displayName = "$title $version ${titles[project.name]} $minecraftVersion" - this.version = "$version-mc$minecraftVersion-${project.name}" - requires("kotlin-for-forge") - } + configurations.named("additionalRuntimeClasspath").extendsFrom(configurations.botLib) + configurations.jarJar.extendsFrom(configurations.botLib) } \ No newline at end of file diff --git a/forge/src/main/kotlin/dev/erdragh/astralbot/forge/BotMod.kt b/forge/src/main/kotlin/dev/erdragh/astralbot/forge/BotMod.kt index 6b7189a..511b0a4 100644 --- a/forge/src/main/kotlin/dev/erdragh/astralbot/forge/BotMod.kt +++ b/forge/src/main/kotlin/dev/erdragh/astralbot/forge/BotMod.kt @@ -11,8 +11,6 @@ import dev.erdragh.astralbot.startAstralbot import dev.erdragh.astralbot.stopAstralbot import dev.erdragh.astralbot.forge.event.CommandMessageEvent import net.minecraft.server.level.ServerPlayer -import thedarkcolour.kotlinforforge.forge.FORGE_BUS -import thedarkcolour.kotlinforforge.forge.MOD_BUS import net.minecraftforge.event.RegisterCommandsEvent import net.minecraftforge.event.ServerChatEvent import net.minecraftforge.event.entity.player.PlayerEvent @@ -22,9 +20,11 @@ import net.minecraftforge.fml.ModLoadingContext import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.config.ModConfig import net.minecraftforge.fml.event.config.ModConfigEvent +import thedarkcolour.kotlinforforge.forge.FORGE_BUS +import thedarkcolour.kotlinforforge.forge.MOD_BUS @Mod("astralbot") -object BotMod { +class BotMod () { init { ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, AstralBotConfig.SPEC) ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, AstralBotTextConfig.SPEC, "astralbot-text.toml") diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 3baa40f..0a40245 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -6,22 +6,22 @@ issueTrackerURL = "https://github.com/Erdragh/AstralBot/issues" [[mods]] modId = "${mod_id}" version = "${version}" -displayName = "${title}" +displayName = "${mod_name}" displayURL = "https://modrinth.com/mod/astralbot" logoFile = "icon.png" authors = "${credits}" description = "${description}" -[[dependencies.${mod_id}]] +[[dependencies."${mod_id}"]] modId = "forge" mandatory = true -versionRange = "[47,)" +versionRange = "${forge_range}" ordering = "NONE" side = "BOTH" -[[dependencies.${mod_id}]] +[[dependencies."${mod_id}"]] modId = "minecraft" mandatory = true -versionRange = "[1.20.1,1.20.2)" +versionRange = "${minecraft_version_range}" ordering = "NONE" side = "BOTH" \ No newline at end of file diff --git a/forge/src/main/resources/astralbot.mixins.json b/forge/src/main/resources/astralbot.forge.mixins.json similarity index 85% rename from forge/src/main/resources/astralbot.mixins.json rename to forge/src/main/resources/astralbot.forge.mixins.json index 4b9f0a4..52e4cf5 100644 --- a/forge/src/main/resources/astralbot.mixins.json +++ b/forge/src/main/resources/astralbot.forge.mixins.json @@ -2,6 +2,7 @@ "required": true, "minVersion": "0.8", "package": "dev.erdragh.astralbot.mixins.forge", + "refmap": "${mod_id}.refmap.json", "compatibilityLevel": "JAVA_17", "server": [ "PlayerListMixin" diff --git a/gradle.properties b/gradle.properties index 0e739ee..a4644a7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,36 +2,14 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx3G -XX:ThreadStackSize=4096 -XX:CompilerThreadStackSize=4096 # Minecraft things -enabledPlatforms=fabric,forge - -# Fabric -fabricLoaderVersion=0.16.3 -fabricApiVersion=0.91.0 -fabricKotlinVersion=1.12.1+kotlin.2.0.20 - +enabledPlatforms=fabric,neoforge version=1.5.3 group=dev.erdragh.astralbot +modName=AstralBot modId=astralbot modAuthor=Erdragh license=MIT -title=AstralBot description=Discord Bot and Minecraft Mod in one bundle. -credits=Erdragh - -minecraftVersion=1.20.1 -parchmentVersion=2023.09.03 - -forgeConfigAPIVersion=8.0.0 - -# Discord Interactions -jdaVersion=5.1.0 -dcWebhooksVersion=0.8.4 - -# Database Interactions -exposedVersion=0.54.0 -sqliteJDBCVersion=3.46.1.0 - -# Message parsing -commonmarkVersion=0.22.0 \ No newline at end of file +credits=Erdragh \ No newline at end of file diff --git a/gradle/dcwebhooks.versions.toml b/gradle/dcwebhooks.versions.toml new file mode 100644 index 0000000..9a06a7b --- /dev/null +++ b/gradle/dcwebhooks.versions.toml @@ -0,0 +1,7 @@ +[versions] +webhooks = "0.8.4" +json = "20230618" + +[libraries] +webhooks = { group = "club.minnced", name = "discord-webhooks", version.ref = "webhooks" } +json = { group = "org.json", name = "json", version.ref = "json" } \ No newline at end of file diff --git a/gradle/exposed.versions.toml b/gradle/exposed.versions.toml new file mode 100644 index 0000000..3961eee --- /dev/null +++ b/gradle/exposed.versions.toml @@ -0,0 +1,7 @@ +[versions] +exposed = "0.55.0" + +[libraries] +core = { group = "org.jetbrains.exposed", name = "exposed-core", version.ref = "exposed" } +dao = { group = "org.jetbrains.exposed", name = "exposed-dao", version.ref = "exposed" } +jdbc = { group = "org.jetbrains.exposed", name = "exposed-jdbc", version.ref = "exposed" } \ No newline at end of file diff --git a/gradle/jda.versions.toml b/gradle/jda.versions.toml new file mode 100644 index 0000000..d6967bf --- /dev/null +++ b/gradle/jda.versions.toml @@ -0,0 +1,23 @@ +[versions] +jda = "5.1.2" + +websocket = "2.14" +okhttp = "4.12.0" +okio = "3.9.1" +trove4j = "3.1.0" +commons-collections = "4.4" +jackson = "2.17.2" +tink = "1.14.1" + +[libraries] +jda = { group = "net.dv8tion", name = "JDA", version.ref = "jda" } + +commons-collections = { group = "org.apache.commons", name = "commons-collections4", version.ref = "commons-collections" } +trove4j = { group = "net.sf.trove4j", name = "core", version.ref = "trove4j" } +jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations", version.ref = "jackson" } +jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core", version.ref = "jackson" } +jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" } +websocket = { group = "com.neovisionaries", name = "nv-websocket-client", version.ref = "websocket" } +okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } +okio = { group = "com.squareup.okio", name = "okio-jvm", version.ref = "okio" } +tink = { group = "com.google.crypto.tink", name = "tink", version.ref = "tink" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..cea7a79 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/libs.versions.toml b/libs.versions.toml new file mode 100644 index 0000000..59578be --- /dev/null +++ b/libs.versions.toml @@ -0,0 +1,59 @@ +[versions] +java = "17" +kotlin = "2.1.10" +moddev = "2.0.78" +loom = "1.9-SNAPSHOT" +dokka = "2.0.0" + +kotlinx-coroutines = "1.8.1" + +minecraft = "1.20.1" +minecraftRange = "[1.20.1, 1.20.2)" + +# The version of ParchmentMC that is used, see https://parchmentmc.org/docs/getting-started#choose-a-version for new versions +parchment = "2023.09.03" +parchmentMC = "1.20.1" + +forge = "1.20.1-47.3.29" +forgeRange = "[47.1, 48)" +## This is the version of minecraft that the 'common' project uses, you can find a list of all versions here +## https://projects.neoforged.net/neoforged/neoform +mcp = "1.20.1" +kff = "4.11.0" +kffRange = "[4, )" + +slf4j = "2.0.9" + +fcapi = "8.0.1" + +fabricLoader = "0.16.10" +fabricApi = "0.92.3+1.20.1" +flk = "1.13.1+kotlin.2.1.10" +publish = "0.8.4" + +sqlite = "3.49.0.0" +commonmark = "0.24.0" + +mixin = "0.8.5" + +[libraries] +minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" } +fabricLoader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabricLoader" } +fabricApi = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabricApi" } +flk = { group = "net.fabricmc", name = "fabric-language-kotlin", version.ref = "flk" } +kff = { group = "thedarkcolour", name = "kotlinforforge", version.ref = "kff" } +mixin = { group = "org.spongepowered", name = "mixin", version.ref = "mixin" } +sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" } +commonmark = { group = "org.commonmark", name = "commonmark", version.ref = "commonmark" } +fcapi-fabric = { group = "fuzs.forgeconfigapiport", name = "forgeconfigapiport-fabric", version.ref = "fcapi" } +fcapi-common = { group = "fuzs.forgeconfigapiport", name = "forgeconfigapiport-common", version.ref = "fcapi" } +parchment = { group = "org.parchmentmc.data", name = "parchment-1.20.1", version.ref = "parchment" } +slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } +kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } + +[plugins] +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +moddev = { id = "net.neoforged.moddev.legacyforge", version.ref = "moddev" } +loom = { id = "fabric-loom", version.ref = "loom" } +publish = { id = "me.modmuss50.mod-publish-plugin", version.ref = "publish" } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 1ca0574..5c3f199 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,8 +5,8 @@ rootProject.name = "AstralBot" pluginManagement { repositories { mavenCentral() - maven(url = "https://maven.architectury.dev/") maven("https://maven.fabricmc.net/") { name = "Fabric" } + maven("https://maven.neoforged.net/releases/") { name = "NeoForge" } maven("https://repo.spongepowered.org/repository/maven-public/") { name = "Sponge Snapshots" } gradlePluginPortal() } @@ -16,4 +16,21 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" } +dependencyResolutionManagement { + versionCatalogs { + register("libs") { + from(files("libs.versions.toml")) + } + register("jda") { + from(files("gradle/jda.versions.toml")) + } + register("dcwebhooks") { + from(files("gradle/dcwebhooks.versions.toml")) + } + register("exposed") { + from(files("gradle/exposed.versions.toml")) + } + } +} + include("common", "fabric", "forge") \ No newline at end of file