Some checks failed
build / build (push) Has been cancelled
- build.gradle: optional -Pplatform=<id> property switches the build into a fat-jar mode where javacv 1.5.13 + javacpp + ffmpeg 8.0.1 (java + the picked platform's native jar) are all nested into the mod jar via Fabric loom's `include` directive. Fabric loader unpacks them at runtime, so users no longer need -Xbootclasspath/a:... or 5 separate jars in .minecraft/libraries. - Without -Pplatform, the build produces the same small ~85KB vanilla jar as before, so devs/server-side and bring-your-own-JavaCV setups still work. - Per-platform artifacts: video_player-<platform>-0.4.8.jar where <platform> ∈ windows-x86_64 / linux-x86_64 / macosx-x86_64 / macosx-arm64. Sizes 21-32MB. - README: STEP 5 (the long JavaCV manual-install + -Xbootclasspath section) is gone. New STEP 4 just says 'pick the jar for your OS'. Also added a warning about removing the old -Xbootclasspath JVM arg when upgrading, since duplicate JavaCV on the boot classpath can silently break decoding.
92 lines
3.2 KiB
Groovy
92 lines
3.2 KiB
Groovy
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}" }
|
|
}
|
|
}
|