Skip to content

Commit

Permalink
feat: update to Java 22
Browse files Browse the repository at this point in the history
BREAKING-CHANGE: requires Java 22
  • Loading branch information
gotson committed Aug 22, 2024
1 parent 3452f4c commit 96d55cc
Show file tree
Hide file tree
Showing 485 changed files with 70,947 additions and 44,905 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
# NightMonkeys

A collection of ImageIO plugins, adding support for newer image formats. NightMonkeys uses the newer Foreign Linker API
available in JDK 21 to access native libraries.
available in JDK 22 to access native libraries.

## How it works

NightMonkeys plugins are released as multi-release JARs:

- with Java < 21, a no-op version of the plugin will unregister itself on load, basically doing nothing
- with Java 21, the plugin will be available
- with Java < 22, a no-op version of the plugin will unregister itself on load, basically doing nothing
- with Java 22, the plugin will be available
- the plugins are not compatible with other Java versions, as the Foreign Linker APIs are still changing

This lets you add the dependencies in your project whatever the JDK used, and still enable the plugin at runtime if the necessary JDK is used.
Expand All @@ -33,10 +33,10 @@ decoding/encoding.

In order for the plugins to run properly, you will need to:

- Run Java 21 with the following options:
- Run Java 22 with the following options:

```
--enable-preview --enable-native-access=ALL-UNNAMED
--enable-native-access=ALL-UNNAMED
```

- Make sure the path to the directory containing the native libraries is contained in the Java system
Expand Down
22 changes: 7 additions & 15 deletions gradle/mrjar.gradle
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
apply plugin: 'me.champeau.mrjar'

multiRelease {
targetVersions 8, 21
targetVersions 8, 22
}

compileJava21Java {
options.compilerArgs += ["--enable-preview"]
}

compileJava21TestJava {
options.compilerArgs += ["--enable-preview"]
}

java21Test {
jvmArgs += ["--enable-preview", "--enable-native-access=ALL-UNNAMED"]
java22Test {
jvmArgs += ["--enable-native-access=ALL-UNNAMED"]
}

configurations {
java21Implementation.extendsFrom(implementation)
java22Implementation.extendsFrom(implementation)
}

def noLibTestTask = tasks.register('noLibTest', Test) {
description = 'Runs tests without lib'
group = 'verification'

classpath = files(jar.archiveFile.get().asFile) +
configurations[sourceSets.java21.runtimeClasspathConfigurationName] +
configurations[sourceSets.java22.runtimeClasspathConfigurationName] +
configurations[sourceSets.test.runtimeClasspathConfigurationName] +
sourceSets.test.output
testClassesDirs = sourceSets.test.output.classesDirs

jvmArgs += ["--enable-preview", "--enable-native-access=ALL-UNNAMED"]
jvmArgs += ["--enable-native-access=ALL-UNNAMED"]
systemProperty "java.library.path", ''
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
languageVersion = JavaLanguageVersion.of(22)
}

dependsOn jar
Expand Down
7 changes: 7 additions & 0 deletions imageio-heif/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@
- Color profiles
- EXIF and XMP
- Thumbnails

## Implementation notes

The `panama` package bindings were generated using:
- jextract 22
- from the https://github.com/strukturag/libheif repository, version 1.16.0
- based on the `heif.f` header file
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public HeifImageReaderSpi() {

@Override
public void onRegistration(ServiceRegistry registry, Class<?> category) {
LOGGER.info("This plugin only supports Java 21, plugin will be disabled");
LOGGER.info("This plugin only supports Java 22, plugin will be disabled");
registry.deregisterServiceProvider(this);
super.onRegistration(registry, category);
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 96d55cc

Please sign in to comment.