refactor(epub): migrate from documentnode to grimmory epub4j library and update related code (#334)

* refactor(epub): migrate from documentnode to grimmory epub4j library and update related code

* chore(deps): restore proper imports

* refactor(epub): update to epub4j version 1.0.0 and improve cover image detection

* fix(epub): validate spine indices in convertXPointerRangeToCfi method

* chore(deps): update epub4j dependencies to version 1.0.1

* chore(deps): update epub4j dependency to version 1.0.1

* feat(build): enable preview features and update epub4j dependencies in build configuration

* feat(epub): update epub4j dependencies to version 1.1.0 and refactor resource handling for improved streaming
This commit is contained in:
brios
2026-04-22 17:27:10 -04:00
committed by Zach Yale
parent 3e5a6a9de8
commit bff20c5219
12 changed files with 635 additions and 1662 deletions
+11 -3
View File
@@ -26,6 +26,10 @@ java {
}
}
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("--enable-preview")
}
val useLocalLibs = providers.gradleProperty("useLocalLibs").isPresent
repositories {
@@ -127,9 +131,13 @@ dependencies {
implementation("com.twelvemonkeys.imageio:imageio-bmp:3.13.1")
// epub4j-grimmory fork publishes as org.grimmory:epub4j-core
val epub4jCoords = if (useLocalLibs) "org.grimmory:epub4j-core:+" else "io.documentnode:epub4j-core:4.2.3"
val epub4jCoords = if (useLocalLibs) "org.grimmory:epub4j-core:+" else "org.grimmory:epub4j-core:1.1.0"
implementation(epub4jCoords)
// epub4j-native for native archive parsing
val epub4jNativeCoords = if (useLocalLibs) "org.grimmory:epub4j-native:+" else "org.grimmory:epub4j-native:1.1.0"
implementation(epub4jNativeCoords)
// --- Audio Metadata (Audiobook Support) ---
implementation("com.github.RouHim:jaudiotagger:2.0.19")
@@ -194,7 +202,7 @@ hibernate {
tasks.named<Test>("test") {
useJUnitPlatform()
maxHeapSize = "2560m"
jvmArgs("-XX:+EnableDynamicAgentLoading", "--enable-native-access=ALL-UNNAMED")
jvmArgs("-XX:+EnableDynamicAgentLoading", "--enable-native-access=ALL-UNNAMED", "--enable-preview")
finalizedBy(tasks.named("jacocoTestReport"))
}
@@ -222,7 +230,7 @@ tasks.named<Copy>("processResources") {
}
tasks.named<BootRun>("bootRun") {
jvmArgs("--enable-native-access=ALL-UNNAMED")
jvmArgs("--enable-native-access=ALL-UNNAMED", "--enable-preview")
if (System.getenv("REMOTE_DEBUG_ENABLED") == "true") {
jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005")
}