Skip to content

Commit

Permalink
Update Gradle scripts
Browse files Browse the repository at this point in the history
- tentatively synced with multiloader template for 1.21.1 (except with more recent versions of various suggested dependencies)
- applied more generic property expansion to pack.mcmeta, loader-specific mod metadata files, mixin configurations, and Patchouli book.json
- Gradle wrapper updated to 8.12; removed usages of deprecated features
- Spotless plugin updated to 7.0.2 (TODO: check everything still works as expected)
- PDM tool version updated only to 6.55.0 (TODO: once everything compiles, we need to make sure we don't use any deprecated features and then upgrade to version 7.x)
- updated mod dependencies to reasonably recent 1.21.1 versions
- converted Xplat accesswidener config to accesstransformer
  • Loading branch information
TheRealWormbo committed Jan 19, 2025
1 parent 75b1ade commit cb4b813
Show file tree
Hide file tree
Showing 21 changed files with 422 additions and 441 deletions.
88 changes: 9 additions & 79 deletions Fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
plugins {
id 'multiloader-loader'
id 'fabric-loom'
}

version = "${minecraft_version}-${build_number}-FABRIC"
if (System.getenv().RELEASE_MODE != "1") {
version += '-SNAPSHOT'
}

loom {
accessWidenerPath = file("src/main/resources/botania.accesswidener")
mixin.defaultRefmapName = "botania.refmap.json"
Expand Down Expand Up @@ -40,23 +36,11 @@ loom {

}

sourceSets.main.resources {
srcDir 'src/generated/resources'
}

repositories {
maven {
name = "Modmuss"
url = "https://maven.modmuss50.me/"
}
maven {
name = "Jared"
url = "https://maven.blamejared.com/" // for JEI and Patchouli
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/" // for trinkets and emi
}
maven {
name = "Ladysnake Libs"
url = 'https://maven.ladysnake.org/releases'
Expand All @@ -66,26 +50,19 @@ repositories {
url = "https://mod-buildcraft.com/maven"
}
maven {
name "entity reach"
url "https://maven.jamieswhiteshirt.com/libs-release/"
name = "entity reach"
url = "https://maven.jamieswhiteshirt.com/libs-release/"
}
maven {
url "https://jitpack.io" // for step height eam
url = "https://jitpack.io" // for step height eam
}
maven {
url "https://maven.shedaniel.me/" // for rei
url = "https://maven.shedaniel.me/" // for rei
}
maven {
name = "ParchmentMC"
url = "https://maven.parchmentmc.net/"
}
maven {
name = "Unascribed"
url "https://repo.unascribed.com" // for ears
content {
includeGroup "com.unascribed"
}
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven" // for "here be no dragons"
Expand All @@ -99,13 +76,11 @@ dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${parchment_version}@zip")
parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip")
}

modImplementation "net.fabricmc:fabric-loader:${fabric_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"

compileOnly project(":Xplat")
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"

modImplementation "vazkii.patchouli:Patchouli:${patchouli_version}-FABRIC"

Expand All @@ -114,7 +89,7 @@ dependencies {
modCompileOnly "dev.emi:emi-fabric:${emi_version}:api"
modLocalRuntime "dev.emi:emi-fabric:${emi_version}"

modImplementation "me.zeroeightsix:fiber:0.23.0-2"
modImplementation "me.zeroeightsix:fiber:0.23.0-2"
include "me.zeroeightsix:fiber:0.23.0-2"

// Don't include base and entity as Trinkets includes it already
Expand All @@ -141,48 +116,3 @@ dependencies {

modRuntimeOnly "maven.modrinth:here-be-no-dragons:1.0.0"
}

compileJava {
source(project(":Xplat").sourceSets.main.allSource)
options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation,-serial" << "-Werror"

}

sourcesJar {
from project(":Xplat").sourceSets.main.allJava
}

processResources {
from project(":Xplat").sourceSets.main.resources
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}

// Exclude datagenerator .cache directory
exclude '.cache'

filesMatching('data/botania/patchouli_books/lexicon/book.json') {
filter {
it.replaceAll("buildNumber", build_number)
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
from components.java
}
}

repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"required": true,
"minVersion": "0.8",
"compatibilityLevel": "JAVA_17",
"package": "vazkii.botania.fabric.mixin",
"refmap": "${mod_id}.refmap.json",
"compatibilityLevel": "JAVA_21",
"mixins": [
"AbstractFurnaceBlockEntityFabricAccessor",
"AbstractMinecartFabricMixin",
Expand Down Expand Up @@ -37,6 +38,7 @@
"client.MinecraftFabricMixin",
"client.ParticleEngineFabricMixin"
],
"server": [],
"injectors": {
"defaultRequire": 1
}
Expand Down
27 changes: 14 additions & 13 deletions Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"schemaVersion": 1,
"id": "botania",
"id": "${mod_id}",
"version": "${version}",

"name": "Botania",
"description": "Botania is a tech mod themed around natural magic",
"name": "${mod_name}",
"description": "${description}",
"authors": [
"Vazkii",
"wiiv",
Expand All @@ -19,12 +19,12 @@
"contact": {
"irc": "ircs://irc.esper.net:6697/#vazkii",
"email": "~williewillus/[email protected]",
"homepage": "https://botaniamod.net",
"sources": "https://github.com/VazkiiMods/Botania",
"issues": "https://github.com/VazkiiMods/Botania/issues"
"homepage": "${website_url}",
"sources": "${sources_url}",
"issues": "${issues_url}"
},

"license": "Botania license",
"license": "${license}",
"icon": "logo.png",

"environment": "*",
Expand Down Expand Up @@ -75,16 +75,17 @@
]
},
"mixins": [
"botania_xplat.mixins.json",
"botania_fabric.mixins.json"
"botania.xplat.mixins.json",
"botania.fabric.mixins.json"
],
"accessWidener": "botania.accesswidener",

"depends": {
"fabricloader": ">=0.16.0",
"fabric-api": ">=0.97",
"minecraft": "=1.20.4",
"trinkets" : ">=3.8",
"fabricloader": ">=${fabric_loader_version}",
"fabric-api": "*",
"minecraft": "${minecraft_version}",
"java": "${java_version}",
"trinkets" : "*",
"patchouli": "*"
},

Expand Down
118 changes: 15 additions & 103 deletions NeoForge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,59 +1,42 @@
plugins {
id 'java-library'
id 'idea'
id 'multiloader-loader'
id 'net.neoforged.moddev'
id 'eclipse'
}

version = "${minecraft_version}-${build_number}-NEOFORGE"
if (System.getenv().RELEASE_MODE != "1") {
version += '-SNAPSHOT'
}

repositories {
maven {
name = "Jared"
url = "https://maven.blamejared.com/"
}
maven {
name = "C4"
url = "https://maven.theillusivec4.top/"
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/" // for emi
}
maven {
name = "Unascribed"
url "https://repo.unascribed.com" // for ears
content {
includeGroup "com.unascribed"
}
}
}

neoForge {
version = neoforge_version
// Automatically enable neoforge AccessTransformers if the file exists
def at = project(':Xplat').file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.from(at.absolutePath)
}

parchment {
var parchment_components = parchment_version.split(":")
minecraftVersion = parchment_components[0]
mappingsVersion = parchment_components[1]
minecraftVersion = parchment_minecraft
mappingsVersion = parchment_version
}

runs {
configureEach {
gameDirectory = project.file('../run')
systemProperty 'forge.logging.console.level', 'debug'
systemProperty 'fml.earlyprogresswindow', 'false'
systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric
}

client {
client()
}
data {
data()
}
server {
server()
programArgument '--nogui'
}
}

Expand All @@ -65,86 +48,15 @@ neoForge {
}

dependencies {
implementation project(":Xplat")

implementation "vazkii.patchouli:Patchouli:${patchouli_version}-NEOFORGE"
compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"
// runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"

compileOnly "dev.emi:emi-neoforge:${emi_version}:api"
runtimeOnly "dev.emi:emi-neoforge:${emi_version}"

// compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api"
// runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}"

// compileOnly 'com.blamejared.crafttweaker:CraftTweaker-forge-1.18.2:9.1.123'
compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api"
runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}"

compileOnly "com.unascribed:ears-api:${ears_version}"
}

TaskCollection.metaClass.excludingNeoTasks = { ->
delegate.matching { !it.name.startsWith("neo") }
}

tasks.withType(JavaCompile).excludingNeoTasks().configureEach {
source(project(":Xplat").sourceSets.main.allSource)
}

tasks.withType(Javadoc).excludingNeoTasks().configureEach {
source(project(":Xplat").sourceSets.main.allJava)
}

tasks.named("sourcesJar", Jar) {
from(project(":Xplat").sourceSets.main.allSource)
}

tasks.withType(ProcessResources).excludingNeoTasks().configureEach {
from project(":Xplat").sourceSets.main.resources
}

jar {
manifest {
attributes([
"Specification-Title": "${mod_name}",
"Specification-Vendor": "vazkii",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": "${mod_name}",
"Implementation-Version": "${archiveVersion.get()}",
"Implementation-Vendor" :"vazkii"
])
}
}

task apiJar(type: Jar, dependsOn: classes) {
// Sources included because of MinecraftForge/ForgeGradle#369
from project(":Xplat").sourceSets.main.allJava
from(sourceSets.main.allJava)
from(sourceSets.main.output)

include 'vazkii/botania/api/**'

archiveClassifier = 'api'
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
artifact jar
artifact sourcesJar
artifact apiJar
pom.withXml {
def node = asNode()
if(node.dependencies.size() > 0)
node.remove(node.dependencies) // Remove deps, as they are all mappings-dependent and/or forge
}
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}
Loading

0 comments on commit cb4b813

Please sign in to comment.