Compare commits

...
2 Commits
Author SHA1 Message Date
MeAlam1 4a7c88f48b Cleanup 2026-12-04 18:14:49 +01:00
MeAlam1 02e0c1df2e Removed Arch + Bunch of other Gradle Stuff 2026-12-04 18:08:07 +01:00
24 changed files with 618 additions and 494 deletions

No files matched your search

+6
View File
@@ -34,6 +34,12 @@
### Developer
- Fixed JsonArray to MoValue conversion not working properly.
- Removed Architectury from the build. `common` now compiles against vanilla Minecraft through NeoForge ModDevGradle, `fabric` uses Fabric Loom and `neoforge` uses ModDevGradle.
- The `com.cobblemon:mod` (common) Maven artifact is now published in Mojang mappings instead of intermediary, and no longer contains `architectury.common.json`. The Fabric and NeoForge artifacts are unchanged.
- The NeoForge access transformer is now generated from `cobblemon-common.accesswidener` at build time, so the access widener remains the single source for both loaders.
- Updated the build to Gradle 9.9.3 and Fabric Loom 1.17.
- Replaced the Shadow plugin with `com.gradleup.shadow` 9.6.1 and the license header plugin with `net.neoforged.licenser` 0.7.5 for Gradle 9 compatibility.
- Parchment versions now live in `gradle/libs.versions.toml`.
### Molang & Datapacks
- `q.is_standing_on_blocks` now properly checks for non-full blocks like slabs, Mud or Soul Sand.
+2 -2
View File
@@ -4,9 +4,9 @@ An open-source Pokémon mod for Minecraft Java Edition, written in Kotlin for Fa
## Getting started
To set up the development workspace, first clone the project and open the build.gradle with Intellij. Make sure that you clone it to a folder that has no spaces in its path (for example, C:/Development/Cobblemon Stuff/cobblemon/ is bad) since Architectury Plugin seems to dislike it.
To set up the development workspace, first clone the project and open the build.gradle.kts with Intellij. The project is a plain multi-loader Gradle build: `common` (vanilla Minecraft via NeoForge ModDevGradle), `fabric` (Fabric Loom) and `neoforge` (ModDevGradle).
After it takes ages to load, you should hopefully have runnable configurations of the project in the top right, such as Minecraft Client (:fabric). If not, try running `./gradlew genEclipseRuns`.
After it takes ages to load, you should hopefully have runnable configurations of the project in the top right, such as Minecraft Client (:fabric). You can also run `./gradlew :fabric:runClient` or `./gradlew :neoforge:runClient`.
Troubleshooting:
- Try running `./gradlew --refresh-dependencies`
+90 -74
View File
@@ -1,8 +1,4 @@
import utilities.isSnapshot
import utilities.version
import utilities.gitBranch
import utilities.gitCommit
import utilities.*
/*
*
@@ -15,103 +11,123 @@ import utilities.gitCommit
*/
plugins {
id("cobblemon.base-conventions")
id("cobblemon.publish-conventions")
id("cobblemon.base-conventions")
id("cobblemon.publish-conventions")
id("net.neoforged.moddev")
id("net.kyori.blossom")
id("org.jetbrains.gradle.plugin.idea-ext")
id("net.kyori.blossom")
id("org.jetbrains.gradle.plugin.idea-ext")
}
architectury {
common("neoforge", "fabric")
val generateAccessTransformer by tasks.registering(AccessWidenerToTransformer::class) {
description = "AW to AT"
accessWidener = file(ACCESS_WIDENER)
accessTransformer = layout.buildDirectory.file("generated/accesstransformer/accesstransformer.cfg")
}
neoForge {
enable {
neoFormVersion = libs.versions.neoform.get()
isDisableRecompilation = true
}
parchment {
minecraftVersion = libs.versions.parchment.minecraft.get()
mappingsVersion = libs.versions.parchment.mappings.get()
}
accessTransformers.from(generateAccessTransformer.flatMap { it.accessTransformer })
interfaceInjectionData.from(file("interfaces.json"))
addModdingDependenciesTo(sourceSets.test.get())
}
repositories {
maven(url = "${rootProject.projectDir}/deps")
maven(url = "https://api.modrinth.com/maven")
maven(url = "https://maven.neoforged.net/releases")
maven(url = "https://maven.gegy.dev")
mavenLocal()
maven(url = "${rootProject.projectDir}/deps")
maven(url = "https://api.modrinth.com/maven")
maven(url = "https://maven.neoforged.net/releases")
maven(url = "https://maven.gegy.dev")
maven(url = "https://maven.fabricmc.net/")
mavenLocal()
}
dependencies {
implementation(libs.bundles.kotlin)
modImplementation(libs.fabric.loader)
modApi(libs.molang)
implementation(libs.bundles.kotlin)
compileOnly(libs.fabric.loader)
compileOnly(libs.bundles.common.compileOnly)
api(libs.molang)
// Integrations
compileOnlyApi(libs.jei.api)
modCompileOnly(libs.bundles.common.integrations.compileOnly) {
isTransitive = false
}
// LambDynamicLights is handled differently because we need the Mojang-mappings version of it.
modCompileOnly(libs.lambDynamicLights) {
capabilities {
requireCapability("dev.lambdaurora.lambdynamiclights:api-mojmap")
}
}
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
// modCompileOnly(libs.flywheelFabric)
// Integrations
compileOnlyApi(libs.jei.api)
compileOnly(libs.bundles.common.integrations.compileOnly) {
isTransitive = false
}
// LambDynamicLights is handled differently because we need the Mojang-mappings version of it.
compileOnly(libs.lambDynamicLights) {
capabilities {
requireCapability("dev.lambdaurora.lambdynamiclights:api-mojmap")
}
}
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
// modCompileOnly(libs.flywheelFabric)
// Showdown
modCompileOnly(libs.graal.core)
// Showdown
compileOnly(libs.graal.core)
// Data Storage
modCompileOnly(libs.bundles.mongo)
// Data Storage
compileOnly(libs.bundles.mongo)
// Unit Testing
testImplementation(libs.bundles.unitTesting)
// Unit Testing
testImplementation(libs.bundles.unitTesting)
testRuntimeOnly(libs.junit.platform.launcher)
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
setEvents(listOf("failed"))
setExceptionFormat("full")
}
useJUnitPlatform()
testLogging {
setEvents(listOf("failed"))
setExceptionFormat("full")
}
}
// Git info lives in its own output dir (not processResources) so a new commit only rewrites this one file.
val writeGitInfo by tasks.registering(WriteProperties::class) {
destinationFile = layout.buildDirectory.file("generated/gitInfo/cobblemon-git.properties")
property("commit", gitCommit())
property("branch", gitBranch())
description = ""
destinationFile = layout.buildDirectory.file("generated/gitInfo/cobblemon-git.properties")
property("commit", gitCommit())
property("branch", gitBranch())
}
sourceSets.main { output.dir(mapOf("builtBy" to writeGitInfo), layout.buildDirectory.dir("generated/gitInfo")) }
tasks.processResources {
exclude("data/**/README.md")
exclude("data/**/README.md")
}
sourceSets {
main {
blossom {
kotlinSources {
fun generateLicenseHeader() : String {
val builder = StringBuilder()
builder.append("/*\n")
rootProject.file("HEADER").forEachLine {
if(it.isEmpty()) {
builder.append(" *").append("\n")
} else {
builder.append(" * ").append(it).append("\n")
}
}
main {
blossom {
kotlinSources {
fun generateLicenseHeader(): String {
val builder = StringBuilder()
builder.append("/*\n")
rootProject.file("HEADER").forEachLine {
if (it.isEmpty()) {
builder.append(" *").append("\n")
} else {
builder.append(" * ").append(it).append("\n")
}
}
return builder.append(" */").append("\n").toString()
}
return builder.append(" */").append("\n").toString()
}
property("license", generateLicenseHeader())
property("modid", "cobblemon")
property("version", project.version())
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
}
}
}
property("license", generateLicenseHeader())
property("modid", "cobblemon")
property("version", project.version())
property("isSnapshot", if (rootProject.isSnapshot()) "true" else "false")
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
}
}
}
}
// The platform jars are built from :common:jar, so the remapped common jars are only needed by `publish`
tasks.assemble {
setDependsOn(dependsOn.filterNot { (it as? TaskProvider<*>)?.name in setOf("remapJar", "remapSourcesJar") })
publishing.publications.named<MavenPublication>(project.name) {
artifact(tasks.jar)
artifact(tasks.named("sourcesJar"))
}
+3
View File
@@ -0,0 +1,3 @@
{
"net/minecraft/client/model/geom/ModelPart": ["com/cobblemon/mod/common/client/render/models/blockbench/pose/Bone"]
}
@@ -1,6 +0,0 @@
{
"accessWidener": "cobblemon-common.accesswidener",
"injected_interfaces": {
"net/minecraft/class_630": ["com/cobblemon/mod/common/client/render/models/blockbench/pose/Bone"]
}
}
+130 -97
View File
@@ -8,139 +8,172 @@
*
*/
import utilities.ACCESS_WIDENER
import utilities.DEV_CLIENT_ARGS
import utilities.copyJarToRootLibs
configurations.all {
resolutionStrategy {
force(libs.fabric.loader)
}
resolutionStrategy {
force(libs.fabric.loader)
}
}
plugins {
id("cobblemon.platform-conventions")
id("cobblemon.publish-conventions")
id("cobblemon.platform-conventions")
id("cobblemon.publish-conventions")
id("fabric-loom")
}
architectury {
platformSetupLoomIde()
fabric()
loom {
accessWidenerPath.set(project(":common").file(ACCESS_WIDENER))
mixin.useLegacyMixinAp.set(false)
runConfigs.configureEach { isIdeConfigGenerated = true }
runConfigs.named("client") {
runDir = "runClient"
// vmArg("-Dmixin.debug=true")
programArgs(DEV_CLIENT_ARGS)
}
runConfigs.named("server") {
runDir = "runServer"
}
mods.maybeCreate("main").apply {
sourceSet(sourceSets.main.get())
sourceSet("main", project(":common"))
}
}
val generatedResources = file("src/generated/resources")
sourceSets.main {
resources {
srcDir(generatedResources)
}
resources {
srcDir(generatedResources)
}
}
repositories {
maven(url = "${rootProject.projectDir}/deps")
mavenLocal()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven(url = "https://api.modrinth.com/maven")
maven(url = "https://maven.terraformersmc.com/releases/")
maven(url = "${rootProject.projectDir}/deps")
mavenLocal()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven(url = "https://api.modrinth.com/maven")
maven(url = "https://maven.terraformersmc.com/releases/")
}
dependencies {
implementation(project(":common", configuration = "namedElements")) {
isTransitive = false
}
bundle(project(path = ":common", configuration = "transformProductionFabric")) {
isTransitive = false
}
modLocalRuntime(libs.fabric.debugutils)
modImplementation(libs.fabric.loader)
modApi(libs.fabric.api)
modApi(libs.bundles.fabric)
minecraft("net.minecraft:minecraft:${rootProject.property("mc_version")}")
mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip")
})
modLocalRuntime(libs.fabric.debugutils)
modImplementation(libs.fabric.loader)
modApi(libs.fabric.api)
modApi(libs.bundles.fabric)
modCompileOnly(libs.bundles.common.integrations.compileOnly) {
isTransitive = false
}
modCompileOnly(libs.bundles.common.integrations.compileOnly) {
isTransitive = false
}
modImplementation(libs.bundles.fabric.integrations.implementation)
modRuntimeOnly(libs.bundles.fabric.integrations.runtimeOnly)
modRuntimeOnly(libs.bundles.mongo)
modImplementation(libs.bundles.fabric.integrations.implementation)
modRuntimeOnly(libs.bundles.fabric.integrations.runtimeOnly)
modRuntimeOnly(libs.bundles.mongo)
// modImplementation(libs.flywheelFabric)
// include(libs.flywheelFabric)
listOf(
libs.fabric.kotlin,
libs.bundles.graal,
libs.bundles.mongo
).forEach {
include(it)
}
listOf(
libs.fabric.kotlin,
libs.bundles.graal,
libs.bundles.mongo
).forEach {
include(it)
}
// Added to make graal available in dev
modRuntimeOnly(libs.bundles.graal)
modRuntimeOnly(libs.bundles.graal)
include(libs.fabric.kotlin)
include(libs.fabric.kotlin)
listOf(
libs.molang
).forEach {
bundle(it)
runtimeOnly(it)
}
listOf(
libs.molang
).forEach {
bundle(it)
runtimeOnly(it)
}
minecraftServerLibraries(libs.icu4j)
minecraftServerLibraries(libs.icu4j)
// fabric version of AppleSkin api is broken, so we modCompileOnly the mod
modCompileOnly(libs.appleskin.api.fabric) {
exclude(module = "modmenu")
}
// fabric version of AppleSkin api is broken, so we modCompileOnly the mod
modCompileOnly(libs.appleskin.api.fabric) {
exclude(module = "modmenu")
}
}
publishing {
publications.named<MavenPublication>(project.name) {
pom.withXml {
val root = asNode()
val depsNode = (root["dependencies"] as? groovy.util.NodeList)
?.firstOrNull() as? groovy.util.Node
?: root.appendNode("dependencies")
publications.named<MavenPublication>(project.name) {
artifact(tasks.remapJar)
artifact(tasks.remapSourcesJar)
configurations.getByName("include").allDependencies
.filterIsInstance<ExternalModuleDependency>()
.forEach { dep ->
depsNode.appendNode("dependency").apply {
appendNode("groupId", dep.group)
appendNode("artifactId", dep.name)
appendNode("version", dep.version)
appendNode("scope", "compile")
}
}
}
}
@Suppress("UnstableApiUsage")
loom.disableDeprecatedPomGeneration(this)
pom.withXml {
val root = asNode()
val depsNode = (root["dependencies"] as? groovy.util.NodeList)
?.firstOrNull() as? groovy.util.Node
?: root.appendNode("dependencies")
configurations.getByName("include").allDependencies
.filterIsInstance<ExternalModuleDependency>()
.forEach { dep ->
depsNode.appendNode("dependency").apply {
appendNode("groupId", dep.group)
appendNode("artifactId", dep.name)
appendNode("version", dep.version)
appendNode("scope", "compile")
}
}
}
}
}
tasks {
// The AW file is needed in :fabric project resources when the game is run.
val copyAccessWidener by registering(Copy::class) {
from(loom.accessWidenerPath)
into(generatedResources)
dependsOn(checkLicenseMain)
}
val copyAccessWidener by registering(Copy::class) {
description = ""
from(loom.accessWidenerPath)
into(generatedResources)
dependsOn(checkLicenseMain)
}
processResources {
dependsOn(copyAccessWidener)
inputs.property("version", rootProject.version)
inputs.property("fabric_loader_version", libs.fabric.loader.get().version)
inputs.property("fabric_api_version", libs.fabric.api.get().version)
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
inputs.property("java_version", rootProject.property("java_version").toString())
processResources {
dependsOn(copyAccessWidener)
inputs.property("version", rootProject.version)
inputs.property("fabric_loader_version", libs.versions.fabric.loader.get())
inputs.property("fabric_api_version", libs.versions.fabric.api.get())
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
inputs.property("java_version", rootProject.property("java_version").toString())
filesMatching("fabric.mod.json") {
expand(
"version" to rootProject.version,
"fabric_loader_version" to libs.fabric.loader.get().version,
"fabric_api_version" to libs.fabric.api.get().version,
"minecraft_version" to rootProject.property("mc_version").toString(),
"java_version" to rootProject.property("java_version").toString()
)
}
}
filesMatching("fabric.mod.json") {
expand(
"version" to rootProject.version,
"fabric_loader_version" to libs.versions.fabric.loader.get(),
"fabric_api_version" to libs.versions.fabric.api.get(),
"minecraft_version" to rootProject.property("mc_version").toString(),
"java_version" to rootProject.property("java_version").toString()
)
}
}
sourcesJar {
dependsOn(copyAccessWidener)
}
sourcesJar {
dependsOn(copyAccessWidener)
}
remapJar {
dependsOn(shadowJar)
inputFile.set(shadowJar.flatMap { it.archiveFile })
archiveBaseName.set("Cobblemon-${project.name}")
archiveVersion.set("${rootProject.version}")
}
}
copyJarToRootLibs(tasks.remapJar)
-1
View File
@@ -9,7 +9,6 @@ group=com.cobblemon.mod
# API
mc_version = 1.21.1
parchment_version = 2024.07.28@zip
# Used in mod files
java_version = 21
+2 -3
View File
@@ -4,9 +4,8 @@ plugins {
repositories {
gradlePluginPortal()
maven("https://maven.architectury.dev/")
maven("https://maven.fabricmc.net/")
maven("https://maven.minecraftforge.net/")
maven("https://maven.neoforged.net/releases/")
maven("https://maven.terraformersmc.com/releases/")
}
@@ -16,7 +15,7 @@ dependencies {
implementation(libs.licenser)
implementation(libs.shadow)
implementation(libs.loom)
implementation(libs.architectury)
implementation(libs.neoforge.moddev)
implementation(libs.blossom)
implementation(libs.ideaExt)
+1 -2
View File
@@ -4,9 +4,8 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven("https://maven.architectury.dev/")
maven("https://maven.fabricmc.net/")
maven("https://maven.minecraftforge.net/")
maven("https://maven.neoforged.net/releases/")
maven("https://repo.papermc.io/repository/maven-public/")
}
}
@@ -10,16 +10,13 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import utilities.ACCESS_WIDENER
plugins {
id("java")
id("java-library")
id("java")
id("java-library")
id("org.cadixdev.licenser")
id("dev.architectury.loom")
id("architectury-plugin")
kotlin("jvm")
id("net.neoforged.licenser")
kotlin("jvm")
}
group = rootProject.group
@@ -27,68 +24,46 @@ version = rootProject.version
description = rootProject.description
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
repositories {
mavenCentral()
//JEI
maven("https://maven.blamejared.com/")
maven("https://maven.parchmentmc.org")
mavenCentral()
//JEI
maven("https://maven.blamejared.com/")
maven("https://maven.parchmentmc.org")
// AppleSkin
maven("https://maven.ryanliptak.com/")
// AppleSkin
maven("https://maven.ryanliptak.com/")
}
license {
header(rootProject.file("HEADER"))
include("**/*.kt", "**/*.java")
}
architectury {
minecraft = project.property("mc_version").toString()
compileOnly()
}
loom {
silentMojangMappingsLicense()
accessWidenerPath.set(project(":common").file(ACCESS_WIDENER))
}
dependencies {
minecraft("net.minecraft:minecraft:${rootProject.property("mc_version")}")
mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.21:${rootProject.property("parchment_version")}")
})
header(rootProject.file("HEADER"))
include("**/*.kt", "**/*.java")
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
options.compilerArgs.add("-Xlint:-processing,-classfile,-serial")
}
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
options.compilerArgs.add("-Xlint:-processing,-classfile,-serial")
}
withType<KotlinCompile> {
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
}
withType<KotlinCompile> {
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
}
withType<Jar> {
from(rootProject.file("LICENSE"))
}
withType<Jar> {
from(rootProject.file("LICENSE"))
}
// Dev/intermediate jars only feed remapJar, which writes the compressed release jar.
// Deflating ~250MB of already-compressed assets at every stage is wasted time.
named<Jar>("jar") {
entryCompression = ZipEntryCompression.STORED
}
named<Jar>("jar") {
entryCompression = ZipEntryCompression.STORED
}
// Assets/data are ~250MB and already ship in the main jar; copying and remapping them
// into sources jars cost minutes per build.
withType<Jar>().named { it == "sourcesJar" }.configureEach {
exclude("assets/**", "data/**")
}
withType<Jar>().named { it == "sourcesJar" }.configureEach {
exclude("assets/**", "data/**")
}
}
@@ -2,73 +2,42 @@ import utilities.VersionType
import utilities.writeVersion
plugins {
id("cobblemon.base-conventions")
id("com.github.johnrengelman.shadow")
id("cobblemon.base-conventions")
id("com.gradleup.shadow")
}
writeVersion(type = VersionType.FULL)
evaluationDependsOn(":common")
val commonMain: SourceSet = project(":common").sourceSets.main.get()
val bundle: Configuration by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
isCanBeConsumed = false
isCanBeResolved = true
}
loom {
val clientConfig = runConfigs.getByName("client")
clientConfig.runDir = "runClient"
// clientConfig.vmArg("-Dmixin.debug=true")
clientConfig.programArg("--username=AshKetchum")
//This is AshKetchum's UUID so you get an Ash Ketchum skin
clientConfig.programArg("--uuid=93e4e551-589a-41cb-ab2d-435266c8e035")
val serverConfig = runConfigs.getByName("server")
serverConfig.runDir = "runServer"
// Forge established the "main" name convention we're using here. Since NeoForged already defines it we must use
// `maybeCreate`
mods.maybeCreate("main")
// This configurations ensures that the code and resources in :common are available to the platform-specific builds
// in specifically the development mode. This code does nothing for the final packed jar since that one uses shadow
// bundling / jar-in-jar magic to make sure the platform-specific jar has all relevant files available.
mods.named("main") {
sourceSet(project.sourceSets.main.get())
sourceSet(project(":common").sourceSets.main.get())
}
dependencies {
"compileOnly"(project(":common"))
"runtimeOnly"(files(commonMain.output))
}
tasks {
jar {
archiveBaseName.set("Cobblemon-${project.name}")
archiveClassifier.set("dev-slim")
from(commonMain.output)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
jar {
archiveBaseName.set("Cobblemon-${project.name}")
archiveClassifier.set("dev-slim")
}
shadowJar {
archiveClassifier.set("dev-shadow")
entryCompression = ZipEntryCompression.STORED
archiveBaseName.set("Cobblemon-${project.name}")
configurations = listOf(bundle)
mergeServiceFiles()
relocate ("com.oracle", "com.cobblemon.mod.relocations.oracle")
}
remapJar {
dependsOn(shadowJar)
inputFile.set(shadowJar.flatMap { it.archiveFile })
archiveBaseName.set("Cobblemon-${project.name}")
archiveVersion.set("${rootProject.version}")
}
val copyJar by registering(CopyFile::class) {
val productionJar = tasks.remapJar.flatMap { it.archiveFile }
fileToCopy = productionJar
destination = productionJar.flatMap {
rootProject.layout.buildDirectory.file("libs/${it.asFile.name}")
}
}
assemble {
dependsOn(copyJar)
}
shadowJar {
archiveClassifier.set("dev-shadow")
entryCompression = ZipEntryCompression.STORED
archiveBaseName.set("Cobblemon-${project.name}")
from(commonMain.output)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations.set(listOf(bundle))
mergeServiceFiles()
relocate("com.oracle", "com.cobblemon.mod.relocations.oracle")
}
}
@@ -1,61 +1,54 @@
import utilities.VersionType
import utilities.isSnapshot
import utilities.gitCommit
import utilities.isSnapshot
import utilities.writeVersion
plugins {
id("java")
id("java-library")
id("maven-publish")
id("dev.architectury.loom")
id("java")
id("java-library")
id("maven-publish")
}
java {
withSourcesJar()
withJavadocJar()
withSourcesJar()
withJavadocJar()
}
publishing {
repositories {
maven("https://maven.impactdev.net/repository/development/") {
name = "ImpactDev-Public"
credentials {
username = System.getenv("COBBLEMON_MAVEN_USER")
password = System.getenv("COBBLEMON_MAVEN_PASSWORD")
}
}
repositories {
maven("https://maven.impactdev.net/repository/development/") {
name = "ImpactDev-Public"
credentials {
username = System.getenv("COBBLEMON_MAVEN_USER")
password = System.getenv("COBBLEMON_MAVEN_PASSWORD")
}
}
maven {
val snapshot = project.isSnapshot()
maven {
val snapshot = project.isSnapshot()
val releases = uri("https://artefacts.cobblemon.com/releases")
val snapshots = uri("https://artefacts.cobblemon.com/snapshots")
val releases = uri("https://artefacts.cobblemon.com/releases")
val snapshots = uri("https://artefacts.cobblemon.com/snapshots")
url = if (snapshot) snapshots else releases
name = "Reposilite.${if (snapshot) "Snapshots" else "Releases"}"
credentials {
username = System.getenv("COBBLEMON_REPOSILITE_USERNAME")
password = System.getenv("COBBLEMON_REPOSILITE_PASSWORD")
}
}
}
url = if (snapshot) snapshots else releases
name = "Reposilite.${if (snapshot) "Snapshots" else "Releases"}"
credentials {
username = System.getenv("COBBLEMON_REPOSILITE_USERNAME")
password = System.getenv("COBBLEMON_REPOSILITE_PASSWORD")
}
}
}
publications {
create<MavenPublication>(project.name) {
artifact(tasks.remapJar)
artifact(tasks.remapSourcesJar)
@Suppress("UnstableApiUsage")
loom.disableDeprecatedPomGeneration(this)
groupId = "com.cobblemon"
artifactId = project.findProperty("maven.artifactId")?.toString() ?: project.name
version = project.writeVersion(VersionType.PUBLISHING)
pom {
properties = mapOf(
"gitCommit" to project.gitCommit()
)
}
}
}
publications {
create<MavenPublication>(project.name) {
groupId = "com.cobblemon"
artifactId = project.findProperty("maven.artifactId")?.toString() ?: project.name
version = project.writeVersion(VersionType.PUBLISHING)
pom {
properties = mapOf(
"gitCommit" to project.gitCommit()
)
}
}
}
}
@@ -0,0 +1,51 @@
package utilities
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.*
/**
* Converts a named-namespace access widener into a NeoForge access transformer, so the AW stays the single source of
* truth for both loaders.
*/
@CacheableTask
abstract class AccessWidenerToTransformer : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.NONE)
abstract val accessWidener: RegularFileProperty
@get:OutputFile
abstract val accessTransformer: RegularFileProperty
@TaskAction
fun convert() {
val lines = convert(accessWidener.get().asFile.readLines())
accessTransformer.get().asFile.apply { parentFile.mkdirs() }.writeText(lines.joinToString("\n", postfix = "\n"))
}
companion object {
fun convert(awLines: List<String>): List<String> {
val entries = LinkedHashMap<String, Boolean>()
for (raw in awLines.drop(1)) {
val parts = raw.substringBefore('#').trim().split(Regex("\\s+")).filter { it.isNotEmpty() }
if (parts.isEmpty()) continue
val access = parts[0].removePrefix("transitive-")
val owner = parts[2].replace('/', '.')
val target = when (parts[1]) {
"class" -> owner
"method" -> "$owner ${parts[3]}${parts[4]}"
"field" -> "$owner ${parts[3]}"
else -> error("Unknown access widener target '${parts[1]}' in: $raw")
}
entries[target] = when (access) {
"accessible" -> entries[target] ?: false
"extendable" -> true
else -> error("Unsupported access widener access '$access' in: $raw")
}
}
return entries.map { (target, extendable) ->
"${if (extendable) "public-f" else "public"} $target"
}
}
}
}
@@ -0,0 +1,5 @@
package utilities
const val ACCESS_WIDENER = "src/main/resources/cobblemon-common.accesswidener"
val DEV_CLIENT_ARGS = listOf("--username=AshKetchum", "--uuid=93e4e551-589a-41cb-ab2d-435266c8e035")
@@ -1,21 +1,36 @@
package utilities
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.bundling.AbstractArchiveTask
import org.gradle.work.DisableCachingByDefault
@DisableCachingByDefault(because = "Not worth caching")
abstract class CopyFile : DefaultTask() {
@get:InputFile
abstract val fileToCopy: RegularFileProperty
@get:InputFile
abstract val fileToCopy: RegularFileProperty
@get:OutputFile
abstract val destination: RegularFileProperty
@get:OutputFile
abstract val destination: RegularFileProperty
@TaskAction
fun copyFile() {
destination.get().asFile.parentFile.mkdirs()
fileToCopy.get().asFile.copyTo(destination.get().asFile, overwrite = true)
}
}
@TaskAction
fun copyFile() {
destination.get().asFile.parentFile.mkdirs()
fileToCopy.get().asFile.copyTo(destination.get().asFile, overwrite = true)
}
}
/** Copies the release jar into the root project's build/libs as part of `assemble`. */
fun Project.copyJarToRootLibs(productionJarTask: TaskProvider<out AbstractArchiveTask>) {
val copyJar = tasks.register("copyJar", CopyFile::class.java) {
val productionJar = productionJarTask.flatMap { it.archiveFile }
fileToCopy.set(productionJar)
destination.set(productionJar.flatMap { rootProject.layout.buildDirectory.file("libs/${it.asFile.name}") })
}
tasks.named("assemble") { dependsOn(copyJar) }
}
@@ -1,3 +0,0 @@
package utilities
const val ACCESS_WIDENER = "src/main/resources/cobblemon-common.accesswidener"
+18 -11
View File
@@ -3,17 +3,21 @@
kotlin = "2.2.20"
# Plugins
licenser = "0.6.1"
shadow = "8.1.1"
licenser = "0.7.5"
shadow = "9.6.1"
blossom = "2.1.0"
idea-ext = "1.1.7"
# Minecraft Development
loom = "1.11-SNAPSHOT"
architectury-plugin = "3.4-SNAPSHOT"
moddev = "1.0.11"
loom = "1.17-SNAPSHOT"
moddev = "2.0.149"
neoform = "1.21.1-20240808.144430"
parchment-minecraft = "1.21.1"
parchment-mappings = "2024.11.17"
# Common
sponge-mixin = "0.16.3+mixin.0.8.7"
mixinextras = "0.5.5"
molang = "1.1.21"
jei-api = "19.22.1.316"
appleskin-api = "mc1.21-3.0.5"
@@ -52,13 +56,12 @@ classgraph = "4.8.179"
[libraries]
# General Buildscript Plugins
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
loom = { group = "dev.architectury", name = "architectury-loom", version.ref = "loom" }
loom = { group = "net.fabricmc", name = "fabric-loom", version.ref = "loom" }
neoforge-moddev = { group = "net.neoforged", name = "moddev-gradle", version.ref = "moddev" }
architectury = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" }
shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
shadow = { group = "com.gradleup.shadow", name = "shadow-gradle-plugin", version.ref = "shadow" }
blossom = { group = "net.kyori", name = "blossom", version.ref = "blossom" }
ideaExt = { group = "org.jetbrains.gradle.plugin.idea-ext", name = "org.jetbrains.gradle.plugin.idea-ext.gradle.plugin", version.ref = "idea-ext"}
licenser = { group = "gradle.plugin.org.cadixdev.gradle", name = "licenser", version.ref = "licenser" }
licenser = { group = "net.neoforged.licenser", name = "net.neoforged.licenser.gradle.plugin", version.ref = "licenser" }
# Kotlin
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
@@ -66,6 +69,8 @@ kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", vers
# Common
jei-api = { group = "mezz.jei", name = "jei-1.21.1-common-api", version.ref = "jei-api"}
sponge-mixin = { group = "net.fabricmc", name = "sponge-mixin", version.ref = "sponge-mixin" }
mixinextras-common = { group = "io.github.llamalad7", name = "mixinextras-common", version.ref = "mixinextras" }
molang = { group = "local.com.bedrockk", name = "molang", version.ref = "molang" }
# Graal
@@ -101,13 +106,15 @@ mongo-driver-core = { group = "org.mongodb", name = "mongodb-driver-core", versi
mongo-driver-sync = { group = "org.mongodb", name = "mongodb-driver-sync", version.ref = "mongo" }
# Testing
junit-fabric = { group = "net.fabricmc", name = "fabric-loader-junit", version.ref = "fabric-loader" }
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher" }
junit-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" }
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
mock-kotlin = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
[bundles]
common-compileOnly = [ "sponge-mixin", "mixinextras-common" ]
kotlin = [ "kotlin-stdlib", "kotlin-reflect" ]
fabric = [ "fabric-kotlin", "fabric-permissions" ]
common-integrations-compileOnly = [ "adorn-fabric", "jei-api" ]
@@ -115,6 +122,6 @@ fabric-integrations-implementation = [ "mod-menu" ]
fabric-integrations-runtimeOnly = [ "jei-fabric", "c2me-fabric" ]
neoforge-integrations-runtimeOnly = [ "jei-neoforge", "c2me-neoforge" ]
mongo = [ "mongo-driver-core", "mongo-driver-sync" ]
unitTesting = [ "junit-fabric", "junit-params", "mockito-core", "mock-kotlin", "classgraph" ]
unitTesting = [ "junit-jupiter", "junit-params", "mockito-core", "mock-kotlin", "classgraph" ]
graal = [ "graal-core", "graal-sdk", "graal-regex", "graal-truffle", "icu4j" ]
Binary file not shown.
+3 -1
View File
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.3-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+9 -10
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,10 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
# gradlew start up script for POSIX generated by Gradle.
#
# Important for running:
#
@@ -27,7 +29,7 @@
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
# ksh gradlew
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -112,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -170,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -203,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+54 -34
View File
@@ -13,16 +13,45 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem gradlew startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
@rem Catch executions from older scripts and ensure they exit cleanly.
@rem This can be removed once we can be reasonably confident that few people
@rem will be migrating directly to this new wrapper.
goto afterSafetyNet
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto exitWithErrorLevel
:afterSafetyNet
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@@ -43,13 +72,14 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
1>&2 echo.
1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
1>&2 echo.
1>&2 echo Please set the JAVA_HOME variable in your environment to match the
1>&2 echo location of your Java installation.
goto fail
"%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -57,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
1>&2 echo.
1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
1>&2 echo.
1>&2 echo Please set the JAVA_HOME variable in your environment to match the
1>&2 echo location of your Java installation.
goto fail
"%COMSPEC%" /c exit 1
goto exitWithErrorLevel
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
@rem Execute gradlew
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem This label must not be changed. We rely on old scripts being able to jump to this point.
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
+122 -78
View File
@@ -8,111 +8,155 @@
*
*/
import utilities.ACCESS_WIDENER
import utilities.AccessWidenerToTransformer
import utilities.DEV_CLIENT_ARGS
import utilities.copyJarToRootLibs
plugins {
id("cobblemon.platform-conventions")
id("cobblemon.publish-conventions")
id("cobblemon.platform-conventions")
id("cobblemon.publish-conventions")
id("net.neoforged.moddev")
}
architectury {
platformSetupLoomIde()
neoForge()
val generateAccessTransformer by tasks.registering(AccessWidenerToTransformer::class) {
description = "AW to AT"
accessWidener = project(":common").file(ACCESS_WIDENER)
accessTransformer = layout.buildDirectory.file("generated/accesstransformer/META-INF/accesstransformer.cfg")
}
loom {
neoForge {
val localRuntime: Configuration by configurations.creating
configurations.runtimeClasspath { extendsFrom(localRuntime) }
}
neoForge {
enable {
version = libs.versions.neoforge.get()
isDisableRecompilation = true
}
parchment {
minecraftVersion = libs.versions.parchment.minecraft.get()
mappingsVersion = libs.versions.parchment.mappings.get()
}
accessTransformers.from(generateAccessTransformer.flatMap { it.accessTransformer })
runs {
create("client") {
client()
gameDirectory = file("runClient")
// jvmArgument("-Dmixin.debug=true")
programArguments.addAll(DEV_CLIENT_ARGS)
}
create("server") {
server()
gameDirectory = file("runServer")
}
}
mods {
create("cobblemon") {
sourceSet(sourceSets.main.get())
sourceSet(project(":common").sourceSets.main.get())
}
}
}
repositories {
maven(url = "${rootProject.projectDir}/deps")
maven(url = "https://thedarkcolour.github.io/KotlinForForge/")
maven(url = "https://api.modrinth.com/maven")
maven(url = "https://maven.neoforged.net/releases")
mavenLocal()
maven(url = "${rootProject.projectDir}/deps")
maven(url = "https://thedarkcolour.github.io/KotlinForForge/")
maven(url = "https://api.modrinth.com/maven")
maven(url = "https://maven.neoforged.net/releases")
mavenLocal()
}
dependencies {
neoForge(libs.neoforge.api)
//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'
//modImplementation(libs.flywheelForge)
//include(libs.flywheelForge)
modLocalRuntime(libs.neoforge.debugutils)
modRuntimeOnly(libs.bundles.neoforge.integrations.runtimeOnly)
modRuntimeOnly(libs.bundles.mongo)
forgeRuntimeLibrary(libs.bundles.mongo)
//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'
//modImplementation(libs.flywheelForge)
//include(libs.flywheelForge)
localRuntime(libs.neoforge.debugutils)
runtimeOnly(libs.bundles.neoforge.integrations.runtimeOnly)
runtimeOnly(libs.bundles.mongo)
"additionalRuntimeClasspath"(libs.bundles.mongo)
implementation(libs.neo.kotlin.forge)
implementation(libs.neo.kotlin.forge)
implementation(project(":common", configuration = "namedElements")) {
isTransitive = false
}
bundle(project(path = ":common", configuration = "transformProductionNeoForge")) {
isTransitive = false
}
testImplementation(project(":common", configuration = "namedElements"))
testImplementation(project(":common"))
listOf(
libs.bundles.mongo
).forEach {
include(it)
}
modRuntimeOnly(libs.bundles.graal)
forgeRuntimeLibrary(libs.bundles.graal)
jarJar(libs.bundles.mongo)
runtimeOnly(libs.bundles.graal)
listOf(
libs.bundles.graal,
libs.molang
).forEach {
forgeRuntimeLibrary(it)
bundle(it)
}
listOf(
libs.bundles.graal,
libs.molang
).forEach {
"additionalRuntimeClasspath"(it)
bundle(it)
}
// AppleSkin stores api under `api` classifier in their coordinates
// Because of that, we cannot just add it to integrations bundle
modCompileOnly(variantOf(libs.appleskin.api.neoforge) { classifier("api") })
// AppleSkin stores api under `api` classifier in their coordinates
// Because of that, we cannot just add it to integrations bundle
compileOnly(variantOf(libs.appleskin.api.neoforge) { classifier("api") })
}
tasks {
shadowJar {
exclude("architectury-common.accessWidener")
exclude("architectury.common.json")
jar {
destinationDirectory = layout.buildDirectory.dir("devlibs")
}
relocate ("org.graalvm", "com.cobblemon.mod.relocations.graalvm")
relocate ("com.ibm.icu", "com.cobblemon.mod.relocations.ibm.icu")
}
shadowJar {
from(generateAccessTransformer.flatMap { it.accessTransformer }) {
into("META-INF")
}
processResources {
inputs.property("version", rootProject.version)
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
inputs.property("java_version", rootProject.property("java_version").toString())
relocate("org.graalvm", "com.cobblemon.mod.relocations.graalvm")
relocate("com.ibm.icu", "com.cobblemon.mod.relocations.ibm.icu")
}
filesMatching("META-INF/neoforge.mods.toml") {
expand(
"version" to rootProject.version,
"minecraft_version" to rootProject.property("mc_version").toString(),
"java_version" to rootProject.property("java_version").toString()
)
}
}
processResources {
inputs.property("version", rootProject.version)
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
inputs.property("java_version", rootProject.property("java_version").toString())
filesMatching("META-INF/neoforge.mods.toml") {
expand(
"version" to rootProject.version,
"minecraft_version" to rootProject.property("mc_version").toString(),
"java_version" to rootProject.property("java_version").toString()
)
}
}
register<Jar>("productionJar") {
description = ""
archiveBaseName.set("Cobblemon-${project.name}")
archiveVersion.set("${rootProject.version}")
from(shadowJar.flatMap { it.archiveFile }.map { zipTree(it) })
from(jarJar)
manifest.from(shadowJar.get().manifest)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude("cobblemon-common.accesswidener", "**/module-info.class")
includeEmptyDirs = false
}
assemble {
dependsOn("productionJar")
}
sourcesJar {
val depSources = project(":common").tasks.sourcesJar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(depSources)
from(depSources.get().archiveFile.map { zipTree(it) })
}
}
tasks {
sourcesJar {
val depSources = project(":common").tasks.sourcesJar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(depSources)
from(depSources.get().archiveFile.map { zipTree(it) }) {
exclude("architectury.accessWidener")
}
}
}
//Stole from architect discord, replaces loom.forge.convertAccessWideners
tasks.remapJar {
atAccessWideners.add("cobblemon-common.accesswidener")
publishing {
publications.named<MavenPublication>(project.name) {
artifact(tasks.named("productionJar"))
artifact(tasks.sourcesJar)
}
}
copyJarToRootLibs(tasks.named<Jar>("productionJar"))
//jar {
// classifier("dev")
-1
View File
@@ -1 +0,0 @@
loom.platform = neoforge
+1 -2
View File
@@ -6,8 +6,7 @@ pluginManagement {
mavenCentral()
maven("https://maven.fabricmc.net/")
maven("https://maven.architectury.dev/")
maven("https://maven.minecraftforge.net/")
maven("https://maven.neoforged.net/releases/")
}
includeBuild("gradle/build-logic")