Skip to content

Using Jextract in Java code

Libraries defined in the DSL extension are not made available to the Java code automatically. They must be added to the Java source sets where they should be accessible. The plugin adds a source set extension named jextract with a libraries list. The library config objects must be added to this list to become a dependency of the respective source set.

build.gradle.kts
jextract.libraries {
val greeting by registering {
// library config
}
val cursing by registering {
// library config
}
sourceSets.named("main") {
jextract.libraries.addLater(greeting)
}
sourceSets.named("test") {
jextract.libraries.addLater(cursing)
}
}