Skip to content

Commit

Permalink
Update plugin for jextract version 20
Browse files Browse the repository at this point in the history
  • Loading branch information
krakowski committed Apr 25, 2023
1 parent db3c3f5 commit 4c8b63c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Since the plugin is available on [Gradle's Plugin Portal](https://plugins.gradle

```gradle
plugins {
id "io.github.krakowski.jextract" version "0.3.2"
id "io.github.krakowski.jextract" version "0.4.0"
}
```

Expand Down Expand Up @@ -35,7 +35,7 @@ plugin configures them and uses the configured toolchain for its task, which can
```
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(19))
languageVersion.set(JavaLanguageVersion.of(20))
}
}
```
Expand All @@ -45,7 +45,7 @@ To enable this feature the `org.gradle.java.installations.paths` property has to
file usually located inside `${HOME}/.gradle`.

```
org.gradle.java.installations.paths=/custom/path/jdk19
org.gradle.java.installations.paths=/custom/path/jdk20
```

The plugin will first try to find `jextract` inside `PATH` and then fall back to `${JAVA_HOME}/bin`.
Expand All @@ -54,27 +54,27 @@ The plugin will first try to find `jextract` inside `PATH` and then fall back to

The `jextract` task exposes the following configuration options.

| Name | Type | Required | Description |
|:----------------:|:-------------------------------:|:--------------:|----------------------------------------------------------------------------|
| `clangArguments` | `java.lang.String` | | Arguments which should be passed to clang |
| `libraries` | `java.lang.String[]` | | The libraries against which the native code will link |
| `includes` | `java.lang.String[]` | | A list of directories which should be included during code generation |
| `targetPackage` | `java.lang.String` | :black_circle: | The package under which all bindings will be generated |
| `className` | `java.lang.String` | | The generated class file's name |
| `functions` | `java.lang.String[]` | | Whitelist of function symbols |
| `macros` | `java.lang.String[]` | | Whitelist of macro symbols |
| `structs` | `java.lang.String[]` | | Whitelist of struct symbols |
| `typedefs` | `java.lang.String[]` | | Whitelist of typedef symbols |
| `unions` | `java.lang.String[]` | | Whitelist of union symbols |
| `variables` | `java.lang.String[]` | | Whitelist of global variable symbols |
| `definedMacros` | `java.lang.String[]` | | List of additional defined C preprocessor macros |
| `sourceMode` | `java.lang.Boolean` | | Generate source files instead of class files (default: `true`) |
| `outputDir` | `org.gradle.api.file.Directory` | | The output directory under which the generated source files will be placed |
| Name | Type | Required | Description |
|:----------------:|:-------------------------------:|:--------------:|---------------------------------------------------------------------------|
| `clangArguments` | `java.lang.String` | | Arguments which should be passed to clang |
| `libraries` | `java.lang.String[]` | | The libraries against which the native code will link |
| `includes` | `java.lang.String[]` | | A list of directories which should be included during code generation |
| `targetPackage` | `java.lang.String` | :black_circle: | The package under which all bindings will be generated |
| `className` | `java.lang.String` | | The generated class file's name |
| `functions` | `java.lang.String[]` | | Whitelist of function symbols |
| `constants` | `java.lang.String[]` | | Whitelist of macro and enum constant symbols |
| `structs` | `java.lang.String[]` | | Whitelist of struct symbols |
| `typedefs` | `java.lang.String[]` | | Whitelist of typedef symbols |
| `unions` | `java.lang.String[]` | | Whitelist of union symbols |
| `variables` | `java.lang.String[]` | | Whitelist of global variable symbols |
| `definedMacros` | `java.lang.String[]` | | List of additional defined C preprocessor macros |
| `sourceMode` | `java.lang.Boolean` | | Generate source files instead of class files (default: `true`) |
| `outputDir` | `org.gradle.api.file.Directory` | | The output directory under which the generated source files will be placed |

## :wrench:   Requirements

* [OpenJDK 19 + Project Panama](https://github.com/openjdk/panama-foreign/tree/foreign-jextract)
* [LLVM 9+](https://releases.llvm.org/download.html)
* [OpenJDK 20](https://openjdk.org/projects/jdk/20/)
* [Project Jextract](https://jdk.java.net/jextract/)

## :scroll:   License

Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = "io.github.krakowski"
version = "0.3.2"
version = "0.4.0"

repositories {
mavenCentral()
Expand Down Expand Up @@ -64,7 +64,7 @@ pluginBundle {
}

tasks.withType<Wrapper> {
gradleVersion = "7.5.1"
gradleVersion = "8.1.1"
}

tasks.withType<Test>().configureEach {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/io/github/krakowski/jextract/JextractTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ abstract class JextractTask : DefaultTask() {
}

// Include specified macros
definition.macros.orNull?.forEach {
arguments += "--include-macro"
definition.constants.orNull?.forEach {
arguments += "--include-constant"
arguments += it
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ abstract class LibraryDefinition {
@get:Optional @get:Input
abstract val functions: ListProperty<String>

/** Whitelist of macros. */
/** Whitelist of macros and enum constants. */
@get:Optional @get:Input
abstract val macros: ListProperty<String>
abstract val constants: ListProperty<String>

/** Whitelist of structs. */
@get:Optional @get:Input
Expand Down

0 comments on commit 4c8b63c

Please sign in to comment.