Skip to content

Commit

Permalink
Fix forge weirdness, add publishers, cleanup
Browse files Browse the repository at this point in the history
Had the most frustrating experience with JIJ. Apparently, using the version catalog MinimalExternalModuleDependency does not work with the extension block added to the outside implementation config. It has to be added on jarJar. Works fine if it's a String though.
Also had fun with mappings, forgot to tell it that it was using namedElements.
Other cleanup, adding configureEach, copyIdeResources, test config extends compileOnly, etc.
  • Loading branch information
dhyces committed Dec 24, 2023
1 parent 1f5f1f7 commit 2e758d6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 46 deletions.
42 changes: 16 additions & 26 deletions Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ plugins {
id 'idea'
id 'java'
id 'maven-publish'
alias libs.plugins.curseforgegradle
alias libs.plugins.minotaur
alias libs.plugins.forgegradle
alias libs.plugins.librarian
alias libs.plugins.mixingradle
}

archivesBaseName = "${mod_id}-forge-${libs.versions.minecraft}"
base {
archivesName = "${mod_id}-forge-${libs.versions.minecraft.release.get()}"
}

configurations {
testCompileOnly.extendsFrom(compileOnly)
}

sourceSets {
main
Expand All @@ -23,6 +31,8 @@ minecraft {

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

copyIdeResources = true

runs {
client {
workingDirectory file('run')
Expand Down Expand Up @@ -80,11 +90,11 @@ dependencies {
minecraft libs.forge

compileOnly(annotationProcessor(libs.mixinextras.common.get()))
implementation(jarJar(libs.mixinextras.forge.get())) {
implementation(jarJar(libs.mixinextras.forge.get()) {
jarJar.ranged(it, "[${libs.versions.mixinextras.get()},)")
}
})

compileOnly(project(":Common"))
compileOnly(project(path: ":Common", configuration: "namedElements"))

annotationProcessor "${libs.sponge.mixin.get()}:processor"
}
Expand All @@ -104,7 +114,7 @@ tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

tasks.withType(GenerateModuleMetadata) {
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}

Expand All @@ -119,7 +129,7 @@ java {
}
}

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

Expand All @@ -128,26 +138,6 @@ processResources {
exclude("trimmed.accesswidener")
}

jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestamp' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : libs.versions.minecraft.release
])
}
}

tasks.named('publish').configure {
dependsOn 'reobfJar'
}
Expand Down
22 changes: 2 additions & 20 deletions Neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id 'idea'
id 'java'
id 'maven-publish'
alias libs.plugins.curseforgegradle
alias libs.plugins.minotaur
alias libs.plugins.archloom
}

Expand Down Expand Up @@ -78,26 +80,6 @@ processResources {
exclude("trimmed.accesswidener")
}

jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestamp' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : libs.versions.minecraft.release
])
}
}

publishing {
publications {
register('mavenJava', MavenPublication) {
Expand Down

0 comments on commit 2e758d6

Please sign in to comment.