Skip to content

Provide built-in support for GraalVM native images #3040

@sbrannen

Description

@sbrannen

Overview

The GraalVM Native Build Tools (NBT) project provides support for running tests within a native image using the JUnit Platform. Since JUnit 5 has never provided built-in support for running in a native image, the NBT team implemented an internal PluginConfigProvider mechanism for contributing native image configuration for the JUnit Platform, JUnit Jupiter, and JUnit Vintage projects.

The JUnitPlatformFeature also registers reflection for all test classes.

Rationale

The code in the above classes is very specific to JUnit 5 and can therefore be better maintained by the JUnit team. In addition, having the native image configuration directly in JUnit 5 artifacts will allow the JUnit team to proactively integration test support for GraalVM native images, thereby avoiding issues such as #3035.

Deliverables

  • Avoid build-time initialization in JUnit 5 wherever feasible and list the remaining classes in native-image.properties of each jar #4207
  • Add a new section on GraalVM native image support in the User Guide -- for example, in the "Running Tests" section.
  • Introduce integration tests that run on the CI server which verify support for GraalVM native images without using Native Build Tools (as a companion to recently introduced integration tests that use NBT) -- for example, using the ConsoleLauncher as the application class for the compiled native image.
  • Determine how much of the functionality in the PluginConfigProvider implementations in NBT can be migrated to JUnit 5.
  • Determine how much of the functionality in the JUnitPlatformFeature and its support classes can be migrated to JUnit 5.
  • Remove custom --initialize-at-build-time args from platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions