Commit Graph

8 Commits

Author SHA1 Message Date
Brian Clozel 10e4965f99 Guard against new Spring modules in ApiDiff task
Prior to this commit, the ApiDiff Gradle task would be configured for
all submodules of the Spring Framework project and would assume that
they all existed for the baseline version considered for the API diff.

This would cause issues when:
* the sub-project is not published as it's not an official "spring-*"
  module
* the "spring-*" module is new and did not exist for the baseline
  version

This commit ensures that only "spring-*" modules are considered for this
task and that we trigger an early resolution of the baseline version -
if the version doesn't exist, a warn message is logged and we assume
that this is a new module, to be compared with an empty configuration.

This commit also renames the "spring-core-graalvm" project to
"graalvm-feature", since this sub-project is not an official module
published to Maven Central, but rather an internal dependency.

Fixes gh-28818
2022-07-28 10:51:53 +02:00
Sébastien Deleuze 5397d4721b Recognize PRESENT fields in native classpath checks at build time
This pattern is used in Spring Boot.

See gh-28624
2022-07-07 11:48:43 +02:00
Sébastien Deleuze cdf01ede8d Perform Reactor native classpath checks at build time
See gh-28624
2022-07-06 16:39:00 +02:00
Sébastien Deleuze b64edebadc Improve ConstantFieldFeature compatibility
This commit makes ConstantFieldFeature
compatible with GraalVM 22.2 while retaining
GraalVM 22.1 compatibility.

See gh-28624
2022-07-04 11:59:01 +02:00
Sébastien Deleuze 8d08b1d323 Make *_PRESENT fields constant at build time
See gh-28624
2022-06-29 12:31:46 +02:00
Sébastien Deleuze efb83fa064 Prevent duplicated logs in ConstantFieldSubstitutionProcessor
See gh-28624
2022-06-27 19:08:37 +02:00
Sébastien Deleuze 798dd4fec0 Add missing build time class initialization
As gh-28624 supports only static boolean fields, we still
need a few classes to be initialized at build time.

Such explicit configuration should be in theory avoidable,
so we will work with the GraalVM team to see if this can be
fixed, see for example
https://github.com/oracle/graal/issues/4673
for HttpStatus.

See gh-28624
2022-06-27 19:08:20 +02:00
Sébastien Deleuze 22a750f378 Replace build-time initialization by constant fields
This commit leverages a subset of @philwebb initial experimentation
to compute at build time the value of specific boolean static fields
in native images. This enhancement is implemented for now as a
GraalVM feature.

The goal here is to keep an optimized footprint via build time code
removal without leveraging build-time class initialization which is known
for the blocking compatibility issues it introduces due to its viral nature.

For now, the static fields initialized at build time with native are:
 - NativeDetector#imageCode
 - Fields with a name ending by "Present" in "org.springframework" package
   typically used for classpath check with ClassUtils#isPresent

Closes gh-28624
2022-06-24 13:54:20 +02:00