i still haven't learned groovy

This commit is contained in:
Ell 2023-07-08 10:58:43 +02:00
parent 6cb3e6e57e
commit edb7e9b8b7

View file

@ -5,6 +5,9 @@ plugins {
id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'net.minecraftforge.gradle' version '[6.0,6.2)'
} }
// Enable the Jar-in-Jar system for your mod
jarJar.enable()
version = mod_version version = mod_version
group = mod_group_id group = mod_group_id
@ -105,23 +108,12 @@ minecraft {
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
} }
all {
lazyToken('minecraft_classpath') {
configurations.embed.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
}
} }
} }
// Include resources generated by data generators. // Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' } sourceSets.main.resources { srcDir 'src/generated/resources' }
configurations {
embed
implementation.extendsFrom(embed)
}
repositories { repositories {
// Put repositories for dependencies here // Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you // ForgeGradle automatically adds the Forge maven and Maven Central for you
@ -150,7 +142,9 @@ dependencies {
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
embed "org.jgrapht:jgrapht-core:${jgt_version}"
minecraftLibrary "org.jgrapht:jgrapht-core:${jgt_version}"
jarJar(group: "org.jgrapht", name: "jgrapht-core", version: "[${jgt_version}]")
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
@ -200,10 +194,6 @@ tasks.named('jar', Jar).configure {
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
]) ])
} }
// TODO figure out if leaving this out causes jgrapht to be left out of the jar
// from configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }
// This is the preferred method to reobfuscate your jar file // This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar' finalizedBy 'reobfJar'
} }
@ -217,6 +207,8 @@ tasks.named('jar', Jar).configure {
publishing { publishing {
publications { publications {
register('mavenJava', MavenPublication) { register('mavenJava', MavenPublication) {
groupId mod_group_id
artifactId mod_name
artifact jar artifact jar
pom.withXml { pom.withXml {
def node = asNode() def node = asNode()