plugins { id 'net.fabricmc.fabric-loom' version "${loom_version}" id 'maven-publish' id 'java' } version = project.mod_version group = project.maven_group // Optional platform bundle target: `-Pplatform=windows-x86_64` etc. produces a fat jar // with that platform's JavaCV + FFmpeg natives nested inside via Fabric's `include` // directive. Without `-Pplatform`, the build matches pre-0.4.8 behavior (small jar, // user supplies JavaCV separately). def javacvPlatform = (project.findProperty('platform') ?: '').toString() def bundleJavaCv = !javacvPlatform.isEmpty() def javacvVersion = '1.5.13' def ffmpegVersion = '8.0.1-1.5.13' def supportedPlatforms = ['windows-x86_64', 'linux-x86_64', 'macosx-x86_64', 'macosx-arm64'] if (bundleJavaCv && !supportedPlatforms.contains(javacvPlatform)) { throw new GradleException( "Unknown -Pplatform=${javacvPlatform}. Allowed: ${supportedPlatforms.join(', ')}") } base { archivesName = bundleJavaCv ? "${project.archives_base_name}-${javacvPlatform}" : project.archives_base_name } repositories { mavenCentral() maven { url = 'https://maven.fabricmc.net/' } } loom { // Intentionally empty — MC 26.1+ ships unobfuscated, so the new loom does not remap. } dependencies { // No mappings dep — Mojang ships official names since 26.1, intermediary is gone. minecraft "com.mojang:minecraft:${project.minecraft_version}" implementation "net.fabricmc:fabric-loader:${project.loader_version}" implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" if (bundleJavaCv) { // Nest the same 5 jars that the README's manual install step used to require, so // users no longer need -Xbootclasspath/a. `include` adds them as jar-in-jar entries; // Fabric loader unpacks and classloads them at runtime. // `transitive = false` keeps us from dragging in opencv/openblas/etc — we only use // FFmpegFrameGrabber / Frame / Java2DFrameConverter. include(implementation("org.bytedeco:javacv:${javacvVersion}") { transitive = false }) include(implementation("org.bytedeco:javacpp:${javacvVersion}") { transitive = false }) include(implementation("org.bytedeco:ffmpeg:${ffmpegVersion}") { transitive = false }) include(implementation("org.bytedeco:javacpp:${javacvVersion}:${javacvPlatform}") { transitive = false }) include(implementation("org.bytedeco:ffmpeg:${ffmpegVersion}:${javacvPlatform}") { transitive = false }) } } processResources { inputs.property "version", project.version inputs.property "mod_id", project.mod_id inputs.property "minecraft_version", project.minecraft_version filesMatching("fabric.mod.json") { expand "version": project.version, "mod_id": project.mod_id, "target_minecraft": "~${project.minecraft_version}" } } tasks.withType(JavaCompile).configureEach { it.options.release = 25 } java { withSourcesJar() sourceCompatibility = JavaVersion.VERSION_25 targetCompatibility = JavaVersion.VERSION_25 toolchain { languageVersion = JavaLanguageVersion.of(25) } } jar { from("LICENSE") { rename { "${it}_${project.archives_base_name}" } } }