/* * This file is a part of the SteamWar software. * * Copyright (C) 2025 SteamWar.de-Serverteam * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ plugins { steamwar.java } tasks.compileJava { options.isWarnings = false } java { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } tasks.withType().configureEach { options.compilerArgs.addAll( listOf( "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED" ) ) } tasks.withType().configureEach { jvmArgs("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED") } // ─── Collect all .accesswidener files from this plugin's resources ──────────── val accessWidenerFiles: FileCollection = fileTree("src/") { include("**/*.accesswidener") } val paperJarProvider: Provider = provider { val dep = libs.nms.get() configurations["compileClasspath"].resolvedConfiguration.resolvedArtifacts.first { artifact -> artifact.moduleVersion.id.module.group == dep.module.group && artifact.moduleVersion.id.module.name == dep.module.name }.file } // ─── Widen the Paper dev JAR so the IDE / javac see the patched access ──────── val widenedJar by tasks.registering(JavaExec::class) { description = "Produces a widened copy of the Paper dev JAR for compile-time use." group = "widener" // Re-run whenever the .accesswidener files change inputs.file(paperJarProvider) inputs.files(accessWidenerFiles) val output = layout.buildDirectory.file("widened/paper-widened.jar") outputs.file(output) classpath = project(":AccessWidener").tasks.named("shadowJar").get().outputs.files mainClass.set("de.steamwar.Main") doFirst { args = buildList { add(paperJarProvider.get().absolutePath) add(output.get().asFile.absolutePath) addAll(accessWidenerFiles.map { it.absolutePath }) } } dependsOn(":AccessWidener:shadowJar") } dependencies { compileOnly(libs.classindex) annotationProcessor(libs.classindex) compileOnly(project(":CommonCore", "default")) compileOnly(project(":CommandFramework", "default")) compileOnly(project(":SpigotCore:CRIUDummy", "default")) compileOnly(libs.fawe) compileOnly(libs.paperapi) compileOnly(libs.nms) compileOnly(files(widenedJar)) compileOnly(libs.authlib) compileOnly(libs.datafixer) compileOnly(libs.netty) compileOnly(libs.brigadier) compileOnly(libs.fastutil) implementation(libs.anvilgui) } tasks.compileJava { dependsOn(widenedJar) }