Skip to content

Commit

Permalink
Update gradle multiloader stuff, project imports now
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Nov 11, 2023
1 parent 0cc8f87 commit 3b3c264
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 273 deletions.
70 changes: 49 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT' apply(false)
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply(false)
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply(false)
id 'net.darkhax.curseforgegradle' version '1.0.14' apply(false)
id "com.modrinth.minotaur" version "2.+" apply(false)
}

subprojects {
apply plugin: 'java'

java.toolchain.languageVersion = JavaLanguageVersion.of(java_version)
java.withSourcesJar()
java.withJavadocJar()

tasks.withType(GenerateModuleMetadata).tap {
configureEach {
enabled = false // Do not publish dependencies in pom
}
}

configurations {
testImplementation.extendsFrom compileOnly
}

jar {
manifest {
attributes([
Expand All @@ -23,14 +21,14 @@ subprojects {
"Specification-Version" : "1",
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "BlayTheNinth",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
"Implementation-Vendor" : "BlayTheNinth"
])
if (forge_mixins.toBoolean()) {
attributes([
"MixinConfigs": mod_id + ".mixins.json"
])
}
}
}

sourcesJar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
}

Expand Down Expand Up @@ -62,12 +60,42 @@ subprojects {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.release = java_version as int
it.options.getRelease().set(java_version.toInteger())
}

tasks.withType(Javadoc).configureEach {
failOnError false
}

tasks.withType(Javadoc).tap {
configureEach {
failOnError false
processResources {
def expandProps = [
"version": version,
"group": project.group, //Else we target the task's group.
"minecraft_version": minecraft_version,
"forge_version": forge_version,
"forge_loader_version_range": forge_loader_version_range,
"forge_version_range": forge_version_range,
"minecraft_version_range": minecraft_version_range,
"fabric_version": fabric_version,
"fabric_loader_version": fabric_loader_version,
"mod_name": mod_name,
"mod_id": mod_id,
"license": license,
"description": project.description,
"neoforge_version": neoforge_version,
"neoforge_loader_version_range": neoforge_loader_version_range
]

filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}

// 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(GenerateModuleMetadata).configureEach {
enabled = false
}
}
59 changes: 27 additions & 32 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom'
id 'maven-publish'
id 'idea'
id 'net.darkhax.curseforgegradle' version '1.0.14'
id "com.modrinth.minotaur" version "2.+"
id 'net.darkhax.curseforgegradle'
id "com.modrinth.minotaur"
}

group = mod_group
archivesBaseName = "${mod_id}-fabric-${minecraft_version}"
version = mod_version
base {
archivesName = "${mod_id}-fabric-${minecraft_version}"
}

dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()

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

implementation project(":shared")
implementation project(":shared-bridge")

compileOnly "org.jetbrains:annotations:22.0.0"

modCompileOnly "mezz.jei:jei-$jei_minecraft_version-fabric-api:$jei_version"
if (jei_minecraft_version == minecraft_version) {
modRuntimeOnly "mezz.jei:jei-$jei_minecraft_version-fabric:$jei_version"
}
}

apply from: 'dependencies.gradle'

loom {
if (project(":shared").file("src/main/resources/${mod_id}.accesswidener").exists()) {
accessWidenerPath.set(project(":shared").file("src/main/resources/${mod_id}.accesswidener"))
}

mixin {
defaultRefmapName.set("${mod_id}.refmap.json")
}

runs {
client {
client()
Expand All @@ -56,32 +60,23 @@ loom {
}
}

sourceSets {
main {
resources {
srcDirs 'src/generated/resources'
}
}
}

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

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
sourceSets.main.resources.srcDir('src/generated/resources')

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
source(project(":shared").sourceSets.main.allSource)
source(project(":shared-bridge").sourceSets.main.allSource)
}
tasks.withType(Javadoc).configureEach {
source(project(":shared").sourceSets.main.allJava)
source(project(":shared-bridge").sourceSets.main.allJava)
}
tasks.named("sourcesJar", Jar) {
from(project(":shared").sourceSets.main.allSource)
from(project(":shared-bridge").sourceSets.main.allSource)
}

jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
processResources {
from project(":shared").sourceSets.main.resources
}

publishing {
Expand Down
5 changes: 5 additions & 0 deletions fabric/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ repositories {
}

dependencies {
modCompileOnly "mezz.jei:jei-$jei_minecraft_version-fabric-api:$jei_version"
if (jei_minecraft_version == minecraft_version) {
modRuntimeOnly "mezz.jei:jei-$jei_minecraft_version-fabric:$jei_version"
}

modCompileOnly "me.shedaniel.cloth:cloth-config-fabric:11.0.99"
modCompileOnly "com.terraformersmc:modmenu:$modmenu_version"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "net.blay09.mods.balm.mixin",
"refmap": "${mod_id}.refmap.json",
"compatibilityLevel": "JAVA_17",
"mixins": [
"ChunkMapMixin",
Expand Down
13 changes: 7 additions & 6 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id": "balm-fabric",
"version": "${version}",

"name": "Balm",
"description": "Abstraction Layer (but not really)™ for Blay's multiplatform mods",
"name": "${mod_name}",
"description": "${description}",
"authors": [
"BlayTheNinth"
],
Expand All @@ -14,8 +14,8 @@
"issues": "https://github.com/TwelveIterationMods/Balm/issues"
},

"license": "All Rights Reserved",
"icon": "balm-icon.png",
"license": "${license}",
"icon": "${mod_id}.png",

"environment": "*",
"entrypoints": {
Expand All @@ -30,11 +30,12 @@
]
},
"mixins": [
"balm.mixins.json"
"${mod_id}.mixins.json",
"${mod_id}.fabric.mixins.json"
],

"depends": {
"fabricloader": ">=0.14.21",
"fabricloader": ">=0.14",
"fabric-api": "*",
"minecraft": ">=1.20.2",
"java": ">=17"
Expand Down
Loading

0 comments on commit 3b3c264

Please sign in to comment.