import net.minecraftforge.gradleutils.PomUtils plugins { id 'java-library' id 'maven-publish' id 'net.minecraftforge.licenser' id 'net.minecraftforge.gradleutils' alias(libs.plugins.apt) } apply from: rootProject.file('build_shared.gradle') configurations.forEach{ it.transitive = false } dependencies { compileOnly(libs.jetbrains.annotations) api(libs.bundles.asm) // Needed by all the black magic api(libs.forgespi) api(libs.mergetool.api) api(libs.log4j.api) api(libs.slf4j.api) api(libs.guava) api(libs.gson) api(libs.maven.artifact) api(libs.apache.commons) api(libs.bundles.night.config) api(libs.modlauncher) api(libs.coremods) api(libs.mojang.logging) api(libs.jarjar.selector) api(libs.jarjar.meta) implementation(libs.jopt.simple) implementation(libs.securemodules) implementation(libs.accesstransformers) implementation(libs.terminalconsoleappender) implementation(libs.jimfs) // Needed because we have a custom log4j plugin, and they removed package scanning and require a data file to be generated implementation(libs.log4j.core) annotationProcessor(libs.bundles.log4j) testCompileOnly(libs.jetbrains.annotations) testRuntimeOnly(libs.bootstrap) } java { toolchain.languageVersion = JavaLanguageVersion.of(JAVA_VERSION) withSourcesJar() } tasks.named('jar', Jar).configure { manifest { attributes([ 'Automatic-Module-Name': 'net.minecraftforge.fmlloader', 'Forge-Module-Layer': 'boot' ] as LinkedHashMap) attributes([ 'Specification-Title': 'FMLLoader', 'Specification-Vendor': 'Forge Development LLC', 'Specification-Version': '1', 'Implementation-Title': 'FMLLoader', 'Implementation-Vendor': 'Forge Development LLC', 'Implementation-Version': FORGE_VERSION ] as LinkedHashMap, 'net/minecraftforge/fml/loading/') } } tasks.withType(JavaCompile).configureEach { options.compilerArgs << '-Xlint:unchecked' } license { header = rootProject.file('LICENSE-header.txt') } publishing { publications.register('mavenJava', MavenPublication).configure { from components.java artifactId = 'fmlloader' pom { name = project.name description = 'Modifactions to Minecraft to enable mod developers.' url = 'https://github.com/MinecraftForge/MinecraftForge' PomUtils.setGitHubDetails(pom, 'MinecraftForge') license PomUtils.Licenses.LGPLv2_1 } } repositories { maven gradleutils.publishingForgeMaven } } tasks.register('writeForgeVersionJson') { doLast { file('src/main/resources/forge_version.json').json = [ forge: FORGE_VERSION, mc: MC_VERSION, mcp: MCP_VERSION ] } } tasks.named('generateResources').configure { dependsOn('eclipseJdt') dependsOn('eclipseJdtApt') dependsOn('eclipseFactorypath') dependsOn('writeForgeVersionJson') } eclipse { classpath { // We need to set the default output directory for the log4j annotation processor // Ideally we'd just set the value, but the eclipse plugin deduplicates the output directories // So we have to do a hacky whenMerged //defaultOutputDir = file('bin/main') file.whenMerged { entries.each { entry -> if (entry.kind == 'output' && entry.hasProperty('path')) entry.path = 'bin/main' } } } }