From f469eff97bb76b976d3f8dabba05b90dcdac2ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Thu, 4 May 2023 15:31:31 +0200 Subject: [PATCH] Update RuntimeHintsAgentPlugin to use the native image code path RuntimeHintsAgentPlugin purpose is to verify that the reflective invocations expected match the ones performed. gh-30242 introduces a code path where the reflective invocation is skipped when running on native. This issue set the system property "org.graalvm.nativeimage.imagecode" to "runtime" when running runtime tests with the agent in order to make sure the code path tested for those tests is the native one. Closes gh-30422 --- .../springframework/build/hint/RuntimeHintsAgentPlugin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/org/springframework/build/hint/RuntimeHintsAgentPlugin.java b/buildSrc/src/main/java/org/springframework/build/hint/RuntimeHintsAgentPlugin.java index f8f4a513f5e..8f481c8186e 100644 --- a/buildSrc/src/main/java/org/springframework/build/hint/RuntimeHintsAgentPlugin.java +++ b/buildSrc/src/main/java/org/springframework/build/hint/RuntimeHintsAgentPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.gradle.api.tasks.testing.Test; * {@link Plugin} that configures the {@code RuntimeHints} Java agent to test tasks. * * @author Brian Clozel + * @author Sebastien Deleuze */ public class RuntimeHintsAgentPlugin implements Plugin { @@ -45,6 +46,7 @@ public class RuntimeHintsAgentPlugin implements Plugin { }); test.include("**/*Tests.class", "**/*Test.class"); test.systemProperty("java.awt.headless", "true"); + test.systemProperty("org.graalvm.nativeimage.imagecode", "runtime"); }); project.afterEvaluate(p -> { Jar jar = project.getRootProject().project("spring-core-test").getTasks().withType(Jar.class).named("jar").get();