Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 1.89 KB

README.md

File metadata and controls

66 lines (50 loc) · 1.89 KB

Gradle JMod Plugin

This plugin enables support for building jmod artifacts in Gradle JVM projects. Java module artifacts can be used at compile time, similar to JARs, but support a lot more artifact ephemera: header files, man files, native linkage, and native command binaries, to name a few.

Binary Java module artifacts can also be used with jlink to produce an optimized stand-alone binary for a modular Java application. Using the JLink Plugin, such outputs can be built with jmod artifacts as dependencies, even when classpath use is involved.

Installation

build.gradle.kts:

plugins {
    id("dev.elide.jmod") version "..."
}

libs.versions.toml:

[versions]
elide-infra = "..."

[plugins]
jmod = { id = "dev.elide.jmod", version.ref = "elide-infra" }

build.gradle.kts (using a Version Catalog):

plugins {
    alias(libs.plugins.jmod)
}

Usage

The plug-in adds the jmod task, which builds an artifact at <project>/build/jmod/<name>.jmod. You can easily run the task with ./gradlew jmod. The added jmod task attaches to build, so ./gradlew build will also produce the artifact.

To configure the task:

build.gradle.kts

jmod {
    // See table of configuration properties.
}

tasks.jmod {
    // The individual task can also be configured like any Exec task.
    argumentProviders.add(CommandLineArgumentProvider {
        listOf("--more-arguments-to-jmod")
    })
}

Configuration

Coming soon; no properties are exposed at this time, aside from the standard Exec interface.