spring-framework/buildSrc
Brian Clozel a8d553218c Introduce Gradle Toolchain support in build
Prior to this commit, the Spring Framework build would rely on
setting a custom Java HOME for building all sources and tests
with that JDK.

This approach is not flexible enough, since we would be testing
the source compatibility against a recent JDK, but not a common
case experienced by the community: compiling and running
application code with a recent JDK and the official, JDK8-based
Framework artifacts.
This method is also limiting our choice of JDKs to the ones
currently supported by Gradle itself.

This commit introduces the support of Gradle JVM Toolchains in
the Spring Framework build.

We can now select a specific JDK for compiling the main
SourceSets (Java, Groovy and Kotlin) and another one for
compiling and running the test SourceSets:

`./gradlew check -PmainToolChain=8 -PtestToolchain=15`

Gradle will automatically find the JDKs present on the host or
download one automcatically. You can find out about the ones
installed on your host using:

`./gradlew -q javaToolchains`

Finally, this commit also refactors the CI infrastructure to:

* only have a single CI image (with all the supported JDKs)
* use this new feature to compile with JDK8 but test it
against JDK11 and JDK15.

Closes gh-25787
2021-03-15 14:33:41 +01:00
..
src/main/java/org/springframework/build Introduce Gradle Toolchain support in build 2021-03-15 14:33:41 +01:00
README.md Introduce Gradle Toolchain support in build 2021-03-15 14:33:41 +01:00
build.gradle Upgrade Guava for API Diff plugin 2020-02-28 13:56:49 +01:00
gradle.properties Enable local build cache for buildSrc and main project 2019-09-30 15:04:14 +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

Compiler conventions

The org.springframework.build.compile plugin applies the Java compiler conventions to the build.

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.

API Diff

This plugin uses the Gradle JApiCmp plugin to generate API Diff reports for each Spring Framework module. This plugin is applied once on the root project and creates tasks in each framework module. Unlike previous versions of this part of the build, there is no need for checking out a specific tag. The plugin will fetch the JARs we want to compare the current working version with. You can generate the reports for all modules or a single module:

./gradlew apiDiff -PbaselineVersion=5.1.0.RELEASE
./gradlew :spring-core:apiDiff -PbaselineVersion=5.1.0.RELEASE

The reports are located under build/reports/api-diff/$OLDVERSION_to_$NEWVERSION/.