# Updating P3 library for P4

**URL:** <https://discourse.processing.org/t/updating-p3-library-for-p4/32191>\
**Category:** Development\
**Created:** [September 10, 2021, 11:12pm UTC](https://discourse.processing.org/t/updating-p3-library-for-p4/32191 "2021-09-10T23:12:48Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [September 12, 2021, 4:03pm UTC](https://discourse.processing.org/t/updating-p3-library-for-p4/32191/5 "2021-09-12T16:03:18Z")

</div>

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

```gradle
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](https://discourse.processing.org/t/processing-4-core-maven-artifact/27334/8)

---

_[View the full topic](https://discourse.processing.org/t/updating-p3-library-for-p4/32191)._
