Browse Source

Switch CI pipeline to a JDK17 baseline

This commit introduces a new `spring-framework-6.0.x` CI pipeline with
JDK 17 baseline.

Note that Kotlin still uses a JDK11 baseline for now, this will be
addressed in gh-27413.

Closes gh-27409
pull/27415/head
Brian Clozel 3 years ago
parent
commit
c0e479460e
  1. 2
      buildSrc/src/main/java/org/springframework/build/compile/CompilerConventionsPlugin.java
  2. 7
      buildSrc/src/main/java/org/springframework/build/optional/OptionalDependenciesPlugin.java
  3. 7
      ci/images/ci-image/Dockerfile
  4. 10
      ci/images/get-jdk-url.sh
  5. 2
      ci/images/setup.sh
  6. 5
      ci/parameters.yml
  7. 83
      ci/pipeline.yml
  8. 2
      ci/scripts/check-project.sh
  9. 20
      gradle/toolchains.gradle

2
buildSrc/src/main/java/org/springframework/build/compile/CompilerConventionsPlugin.java

@ -24,7 +24,6 @@ import org.gradle.api.Plugin; @@ -24,7 +24,6 @@ import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaLibraryPlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.compile.JavaCompile;
/**
@ -70,7 +69,6 @@ public class CompilerConventionsPlugin implements Plugin<Project> { @@ -70,7 +69,6 @@ public class CompilerConventionsPlugin implements Plugin<Project> {
* @param project the current project
*/
private void applyJavaCompileConventions(Project project) {
JavaPluginConvention java = project.getConvention().getPlugin(JavaPluginConvention.class);
project.getTasks().withType(JavaCompile.class)
.matching(compileTask -> compileTask.getName().equals(JavaPlugin.COMPILE_JAVA_TASK_NAME))
.forEach(compileTask -> {

7
buildSrc/src/main/java/org/springframework/build/optional/OptionalDependenciesPlugin.java

@ -19,12 +19,9 @@ package org.springframework.build.optional; @@ -19,12 +19,9 @@ package org.springframework.build.optional;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.attributes.Usage;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.plugins.ide.eclipse.EclipsePlugin;
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
/**
* A {@code Plugin} that adds support for Maven-style optional dependencies. Creates a new
@ -47,7 +44,7 @@ public class OptionalDependenciesPlugin implements Plugin<Project> { @@ -47,7 +44,7 @@ public class OptionalDependenciesPlugin implements Plugin<Project> {
optional.setCanBeConsumed(false);
optional.setCanBeResolved(false);
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class)
SourceSetContainer sourceSets = project.getExtensions().getByType(JavaPluginExtension.class)
.getSourceSets();
sourceSets.all((sourceSet) -> {
project.getConfigurations().getByName(sourceSet.getCompileClasspathConfigurationName()).extendsFrom(optional);

7
ci/images/ci-image/Dockerfile

@ -2,10 +2,9 @@ FROM ubuntu:focal-20210827 @@ -2,10 +2,9 @@ FROM ubuntu:focal-20210827
ADD setup.sh /setup.sh
ADD get-jdk-url.sh /get-jdk-url.sh
RUN ./setup.sh java8
RUN ./setup.sh
ENV JAVA_HOME /opt/openjdk/java8
ENV JDK11 /opt/openjdk/java11
ENV JDK16 /opt/openjdk/java16
ENV JAVA_HOME /opt/openjdk/java17
ENV JDK17 /opt/openjdk/java17
ENV PATH $JAVA_HOME/bin:$PATH

10
ci/images/get-jdk-url.sh

@ -2,15 +2,9 @@ @@ -2,15 +2,9 @@
set -e
case "$1" in
java8)
echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz"
java17)
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-09-15-08-15-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-09-15-08-15.tar.gz"
;;
java11)
echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_x64_linux_hotspot_11.0.12_7.tar.gz"
;;
java16)
echo "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz"
;;
*)
echo $"Unknown java version"
exit 1

2
ci/images/setup.sh

@ -22,7 +22,7 @@ curl --output /opt/concourse-release-scripts.jar https://repo.spring.io/release/ @@ -22,7 +22,7 @@ curl --output /opt/concourse-release-scripts.jar https://repo.spring.io/release/
mkdir -p /opt/openjdk
pushd /opt/openjdk > /dev/null
for jdk in java8 java11 java16
for jdk in java17
do
JDK_URL=$( /get-jdk-url.sh $jdk )
mkdir $jdk

5
ci/parameters.yml

@ -1,12 +1,9 @@ @@ -1,12 +1,9 @@
email-server: "smtp.svc.pivotal.io"
email-from: "ci@spring.io"
email-to: ["spring-framework-dev@pivotal.io"]
github-repo: "https://github.com/spring-projects/spring-framework.git"
github-repo-name: "spring-projects/spring-framework"
docker-hub-organization: "springci"
artifactory-server: "https://repo.spring.io"
branch: "main"
milestone: "5.3.x"
milestone: "6.0.x"
build-name: "spring-framework"
pipeline-name: "spring-framework"
concourse-url: "https://ci.spring.io"

83
ci/pipeline.yml

@ -67,13 +67,6 @@ resources: @@ -67,13 +67,6 @@ resources:
icon: github
source:
<<: *git-repo-resource-source
- name: every-morning
type: time
icon: alarm
source:
start: 8:00 AM
stop: 9:00 AM
location: Europe/Vienna
- name: ci-images-git-repo
type: git
icon: github
@ -86,7 +79,7 @@ resources: @@ -86,7 +79,7 @@ resources:
icon: docker
source:
<<: *docker-resource-source
repository: ((docker-hub-organization))/spring-framework-ci
repository: ((docker-hub-organization))/spring-framework-ci-jdk17
- name: artifactory-repo
type: artifactory-resource
icon: package-variant
@ -111,22 +104,6 @@ resources: @@ -111,22 +104,6 @@ resources:
access_token: ((github-ci-status-token))
branch: ((branch))
context: build
- name: repo-status-jdk11-build
type: github-status-resource
icon: eye-check-outline
source:
repository: ((github-repo-name))
access_token: ((github-ci-status-token))
branch: ((branch))
context: jdk11-build
- name: repo-status-jdk16-build
type: github-status-resource
icon: eye-check-outline
source:
repository: ((github-repo-name))
access_token: ((github-ci-status-token))
branch: ((branch))
context: jdk16-build
- name: slack-alert
type: slack-notification
icon: slack
@ -216,62 +193,6 @@ jobs: @@ -216,62 +193,6 @@ jobs:
"zip.type": "schema"
get_params:
threads: 8
- name: jdk11-build
serial: true
public: true
plan:
- get: ci-image
- get: git-repo
- get: every-morning
trigger: true
- put: repo-status-jdk11-build
params: { state: "pending", commit: "git-repo" }
- do:
- task: check-project
image: ci-image
file: git-repo/ci/tasks/check-project.yml
privileged: true
timeout: ((task-timeout))
params:
TEST_TOOLCHAIN: 11
<<: *build-project-task-params
on_failure:
do:
- put: repo-status-jdk11-build
params: { state: "failure", commit: "git-repo" }
- put: slack-alert
params:
<<: *slack-fail-params
- put: repo-status-jdk11-build
params: { state: "success", commit: "git-repo" }
- name: jdk16-build
serial: true
public: true
plan:
- get: ci-image
- get: git-repo
- get: every-morning
trigger: true
- put: repo-status-jdk16-build
params: { state: "pending", commit: "git-repo" }
- do:
- task: check-project
image: ci-image
file: git-repo/ci/tasks/check-project.yml
privileged: true
timeout: ((task-timeout))
params:
TEST_TOOLCHAIN: 15
<<: *build-project-task-params
on_failure:
do:
- put: repo-status-jdk16-build
params: { state: "failure", commit: "git-repo" }
- put: slack-alert
params:
<<: *slack-fail-params
- put: repo-status-jdk16-build
params: { state: "success", commit: "git-repo" }
- name: build-pull-requests
serial: true
public: true
@ -453,7 +374,7 @@ jobs: @@ -453,7 +374,7 @@ jobs:
groups:
- name: "builds"
jobs: ["build", "jdk11-build", "jdk16-build"]
jobs: ["build"]
- name: "releases"
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"]
- name: "ci-images"

2
ci/scripts/check-project.sh

@ -4,6 +4,6 @@ set -e @@ -4,6 +4,6 @@ set -e
source $(dirname $0)/common.sh
pushd git-repo > /dev/null
./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Porg.gradle.java.installations.fromEnv=JDK11,JDK15 \
./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Porg.gradle.java.installations.fromEnv=JDK17 \
-PmainToolchain=${MAIN_TOOLCHAIN} -PtestToolchain=${TEST_TOOLCHAIN} --no-daemon --max-workers=4 check
popd > /dev/null

20
gradle/toolchains.gradle

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
* <li>a JDK11 toolchain for compiling and running the test SourceSet
* </ul>
*
* By default, the build will fall back to using the current JDK and 1.8 language level for all sourceSets.
* By default, the build will fall back to using the current JDK and 17 language level for all sourceSets.
*
* Gradle will automatically detect JDK distributions in well-known locations.
* The following command will list the detected JDKs on the host.
@ -44,7 +44,7 @@ def mainToolchainLanguageVersion() { @@ -44,7 +44,7 @@ def mainToolchainLanguageVersion() {
if (mainToolchainConfigured()) {
return JavaLanguageVersion.of(project.mainToolchain.toString())
}
return JavaLanguageVersion.of(8)
return JavaLanguageVersion.of(17)
}
def testToolchainLanguageVersion() {
@ -64,9 +64,9 @@ plugins.withType(JavaPlugin) { @@ -64,9 +64,9 @@ plugins.withType(JavaPlugin) {
}
}
else {
// Fallback to JDK8
// Fallback to JDK17
java {
sourceCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
}
}
// Configure a specific Java Toolchain for compiling and running tests if the 'testToolchain' property is defined
@ -86,10 +86,10 @@ plugins.withType(JavaPlugin) { @@ -86,10 +86,10 @@ plugins.withType(JavaPlugin) {
}
plugins.withType(GroovyPlugin) {
// Fallback to JDK8
// Fallback to JDK17
if (!mainToolchainConfigured()) {
compileGroovy {
sourceCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
}
}
}
@ -102,7 +102,7 @@ pluginManager.withPlugin("kotlin") { @@ -102,7 +102,7 @@ pluginManager.withPlugin("kotlin") {
languageVersion = mainLanguageVersion
}
// See https://kotlinlang.org/docs/gradle.html#attributes-specific-for-jvm
def javaVersion = mainLanguageVersion.toString() == '8' ? '1.8' : mainLanguageVersion.toString()
def javaVersion = mainLanguageVersion.toString()
compileKotlin {
kotlinOptions {
jvmTarget = javaVersion
@ -118,15 +118,15 @@ pluginManager.withPlugin("kotlin") { @@ -118,15 +118,15 @@ pluginManager.withPlugin("kotlin") {
}
}
else {
// Fallback to JDK8
// Fallback to JDK11
compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
}
}
}

Loading…
Cancel
Save