JniBindingTarget

interface JniBindingTarget : Named, HasProject

A single platform target of a JNI library binding.

Describes where the compiled native binary for this platform comes from (see fromProducer and fromPrebuiltBinding) and where it must be packaged (see copyToResources and copyToJniLibs).

Properties

Link copied to clipboard
abstract val abi: String

Name of the platform ABI, e.g. "gnu", "darwin".

Link copied to clipboard
abstract val arch: String

Name of the processor architecture, e.g. "x86_64", "aarch64".

Link copied to clipboard
abstract val konanTarget: KonanTarget?

Corresponding Kotlin/Native target, or null if this target has no direct Kotlin/Native counterpart.

Link copied to clipboard
abstract val name: String?
Link copied to clipboard
abstract val os: String

Name of the operating system, e.g. "windows", "linux", "macos".

Link copied to clipboard
abstract val producerProject: Property<Project>

The producer project this target takes its binding from, or unset when the binding is taken from prebuilt bindings.

Link copied to clipboard
abstract val project: Project
Link copied to clipboard
abstract val source: Property<JniLibrarySource>

Source of the native binary and JniActuals' info for this target.

Functions

Link copied to clipboard
abstract fun copyToJniLibs()

Packages this target's binary into jniLibs/<abi> of the APK or AAR of the Android consumer compilation, so that System.loadLibrary("<library name>") finds it without extracting it by hand.

Link copied to clipboard
abstract fun copyToResources(resourceDir: String = "natives/")

Packages this target's binary into the resources of the consumer compilation, so that the JVM code can load it from the classpath. On Android the binary goes into the assets of the variant instead.

Link copied to clipboard
abstract fun fromPrebuiltBinding(bindingsDir: File)

Convenience overload of fromPrebuiltBinding accepting a File.

abstract fun fromPrebuiltBinding(bindingsDir: Directory)

Convenience overload of fromPrebuiltBinding accepting a Directory.

abstract fun fromPrebuiltBinding(bindingsDir: Provider<Directory>)

Takes the binding from pre-built bindings in the given directory.

Link copied to clipboard
abstract fun fromProducer(projectPath: String)

Takes the binding from a producer project resolved by its path.

abstract fun fromProducer(project: Project)

Takes the binding from a producer project that applies io.github.mimimishkin.jni.binding.plugin.producer.JniLibProducerPlugin.