After a few days twisting Gradle to build the Video Export Library I got it to work!!! Happy about it.
It seems to run in Processing 3 and Processing 4. I run the task called shadow/shadowJar
to build it.
It’s now written in Kotlin. Missing still is to copy some files, documentation, examples. Maybe figure out how to write some tests which produce video files and extract metadata from the resulting mp4’s to see if the files look correct.
build.gradle.kts
plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.0"
id("org.jetbrains.dokka") version "1.5.0"
id("com.github.johnrengelman.shadow") version "7.0.0"
`java-library`
}
repositories {
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// used internally, not exposed to consumers on their own compile classpath
//implementation("org.processing:core:3.3.7")
//implementation("org.processing:pde:3.3.7")
compileOnly("com.github.micycle1:processing-core-4:4.0.3")
compileOnly("net.java.dev.jna:jna:5.7.0")
compileOnly("net.java.dev.jna:jna-platform:5.7.0")
// Test
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
testImplementation("org.processing:core:3.3.7")
// Documentation
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.5.0")
// Exported to consumers
//api("org.apache.commons:commons-math3:3.6.1")
}
tasks.jar {
manifest {
attributes(
mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
)
)
}
doLast {
copy {
from(layout.buildDirectory.dir("libs/${rootProject.name}-all.jar"))
into("/home/funpro/Desktop/edu/src/processing/libraries" +
"/videoExport/library/")
}
}
}
I’ll release it soon. I also could share the whole template to create a Processing Library with Kotlin and Gradle (and IntelliJ?). I guess using Java would require few or no changes.
ps. found the maven artifact in Processing 4 Core Maven Artifact - #8 by monkstone