Hi. I’m experimenting with Kotlin and Processing. So, I have made the project with gradle and kotlin and the processing as the library. Also I use the shadowJar plugin to bundle the fatJar for distribution. Everything works well, but when I add syphon the shadowJar doesn’t include it in bundle. If I run gradle all works, but if I run the compiled jar file, the syphon is lost. I’m not the expert in gradle, maybe someone can help me. Thanks a lot.
Sketch
import processing.core.*
import processing.core.PConstants
import codeanticode.syphon.*
lateinit var syphon: SyphonServer
val speed = 0.01f
class Sketch() : PApplet() {
override fun settings() {
size(800, 600, PConstants.P3D)
}
override fun setup() {
syphon = SyphonServer(this, "Sketch")
}
override fun draw() {
background(235f, 221f, 203f)
lights()
translate(width/2.toFloat(), height/2.toFloat())
rotateX(frameCount.toFloat() * speed)
rotateY(frameCount.toFloat() * speed)
box(200f)
syphon.sendScreen()
}
}
fun main(args: Array<String>) {
PApplet.main("Sketch")
}
Gradle
buildscript {
ext.kotlin_version = '1.3.70'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
}
}
apply plugin: "application"
apply plugin: "kotlin"
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
mainClassName = 'MainKt'
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation files(
'/Applications/Processing.app/Contents/Java/core/library/core.jar',
'/Applications/Processing.app/Contents/Java/core/library/gluegen-rt-natives-macosx-universal.jar',
'/Applications/Processing.app/Contents/Java/core/library/gluegen-rt.jar',
'/Applications/Processing.app/Contents/Java/core/library/jogl-all-natives-macosx-universal.jar',
'/Applications/Processing.app/Contents/Java/core/library/jogl-all.jar',
'/Users/alex/Documents/Processing/libraries/Syphon/library/Syphon.jar',
'/Users/alex/Documents/Processing/libraries/Syphon/library/jsyphon.jar',
)
}
applicationDefaultJvmArgs = ['-Djava.library.path=/Users/alex/Documents/Processing/libraries/Syphon/library/']
shadowJar {
baseName = 'app'
classifier = ''
archiveVersion = ''
}