spring-framework/buildSrc
Sam Brannen 89338c91a9 Stop using using legacy locale data for Date/Time formatting tests
Commit 84714fbae9 introduced usage of the
-Djava.locale.providers=COMPAT command-line argument for javac in order
to allow our JDK 20 builds to pass by using legacy locale data.

That was done to ensure that Date/Time formats using AM/PM produced a
standard space (" ") before the "AM" or "PM" instead of a narrow
non-breaking space (NNBSP "\u202F"), which was introduced in Java 20
due to adoption of Unicode Common Locale Data Repository (CLDR-14032).

This commit removes usage of the -Djava.locale.providers=COMPAT
command-line argument and updates all affected tests to:

- Use an NNBSP before "AM" or "PM" in input text when running on Java 20
  or higher.

- Leniently match against any Unicode space character in formatted
  values containing "AM" or "PM".

See https://jdk.java.net/20/release-notes#JDK-8284840
See https://unicode-org.atlassian.net/browse/CLDR-14032
See gh-30185
Closes gh-33144
2024-07-04 17:03:15 +02:00
..
config/checkstyle Polish "Order modifiers to align with JLS" 2023-10-17 16:16:58 +02:00
src/main/java/org/springframework/build Stop using using legacy locale data for Date/Time formatting tests 2024-07-04 17:03:15 +02:00
README.md Remove API diff Gradle plugin configuration 2023-11-23 16:19:20 +01:00
build.gradle Remove API diff Gradle plugin configuration 2023-11-23 16:19:20 +01:00
gradle.properties Upgrade to spring-javaformat-checkstyle 0.0.42 2024-06-11 09:04:30 +02:00
settings.gradle Upgrade to Gradle Enterprise 3.2 2020-04-29 10:54:03 +02:00

README.md

Spring Framework Build

This folder contains the custom plugins and conventions for the Spring Framework build. They are declared in the build.gradle file in this folder.

Build Conventions

The org.springframework.build.conventions plugin applies all conventions to the Framework build:

  • Configuring the Java compiler, see JavaConventions
  • Configuring the Kotlin compiler, see KotlinConventions
  • Configuring testing in the build with TestConventions

Build Plugins

Optional dependencies

The org.springframework.build.optional-dependencies plugin creates a new optional Gradle configuration - it adds the dependencies to the project's compile and runtime classpath but doesn't affect the classpath of dependent projects. This plugin does not provide a provided configuration, as the native compileOnly and testCompileOnly configurations are preferred.

RuntimeHints Java Agent

The spring-core-test project module contributes the RuntimeHintsAgent Java agent.

The RuntimeHintsAgentPlugin Gradle plugin creates a dedicated "runtimeHintsTest" test task for each project. This task will detect and execute tests tagged with the "RuntimeHintsTests" JUnit tag. In the Spring Framework test suite, those are usually annotated with the @EnabledIfRuntimeHintsAgent annotation.

By default, the agent will instrument all classes located in the "org.springframework" package, as they are loaded. The RuntimeHintsAgentExtension allows to customize this using a DSL:

// this applies the `RuntimeHintsAgentPlugin` to the project
plugins {
	id 'org.springframework.build.runtimehints-agent'
}

// You can configure the agent to include and exclude packages from the instrumentation process.
runtimeHintsAgent {
	includedPackages = ["org.springframework", "io.spring"]
	excludedPackages = ["org.example"]
}

dependencies {
    // to use the test infrastructure, the project should also depend on the "spring-core-test" module
	testImplementation(project(":spring-core-test"))
}

With this configuration, ./gradlew runtimeHintsTest will run all tests instrumented by this java agent. The global ./gradlew check task depends on runtimeHintsTest.

NOTE: the "spring-core-test" module doesn't shade "spring-core" by design, so the agent should never instrument code that doesn't have "spring-core" on its classpath.