Browse Source

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
pull/30423/head
Sébastien Deleuze 1 year ago
parent
commit
f469eff97b
  1. 4
      buildSrc/src/main/java/org/springframework/build/hint/RuntimeHintsAgentPlugin.java

4
buildSrc/src/main/java/org/springframework/build/hint/RuntimeHintsAgentPlugin.java

@ -1,5 +1,5 @@ @@ -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; @@ -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<Project> {
@ -45,6 +46,7 @@ public class RuntimeHintsAgentPlugin implements Plugin<Project> { @@ -45,6 +46,7 @@ public class RuntimeHintsAgentPlugin implements Plugin<Project> {
});
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();

Loading…
Cancel
Save