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
This commit is contained in:
parent
c7cca2e879
commit
c0e479460e
|
@ -24,7 +24,6 @@ import org.gradle.api.Plugin;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.plugins.JavaLibraryPlugin;
|
import org.gradle.api.plugins.JavaLibraryPlugin;
|
||||||
import org.gradle.api.plugins.JavaPlugin;
|
import org.gradle.api.plugins.JavaPlugin;
|
||||||
import org.gradle.api.plugins.JavaPluginConvention;
|
|
||||||
import org.gradle.api.tasks.compile.JavaCompile;
|
import org.gradle.api.tasks.compile.JavaCompile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +69,6 @@ public class CompilerConventionsPlugin implements Plugin<Project> {
|
||||||
* @param project the current project
|
* @param project the current project
|
||||||
*/
|
*/
|
||||||
private void applyJavaCompileConventions(Project project) {
|
private void applyJavaCompileConventions(Project project) {
|
||||||
JavaPluginConvention java = project.getConvention().getPlugin(JavaPluginConvention.class);
|
|
||||||
project.getTasks().withType(JavaCompile.class)
|
project.getTasks().withType(JavaCompile.class)
|
||||||
.matching(compileTask -> compileTask.getName().equals(JavaPlugin.COMPILE_JAVA_TASK_NAME))
|
.matching(compileTask -> compileTask.getName().equals(JavaPlugin.COMPILE_JAVA_TASK_NAME))
|
||||||
.forEach(compileTask -> {
|
.forEach(compileTask -> {
|
||||||
|
|
|
@ -19,12 +19,9 @@ package org.springframework.build.optional;
|
||||||
import org.gradle.api.Plugin;
|
import org.gradle.api.Plugin;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
import org.gradle.api.artifacts.Configuration;
|
||||||
import org.gradle.api.attributes.Usage;
|
|
||||||
import org.gradle.api.plugins.JavaPlugin;
|
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.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
|
* A {@code Plugin} that adds support for Maven-style optional dependencies. Creates a new
|
||||||
|
@ -47,7 +44,7 @@ public class OptionalDependenciesPlugin implements Plugin<Project> {
|
||||||
optional.setCanBeConsumed(false);
|
optional.setCanBeConsumed(false);
|
||||||
optional.setCanBeResolved(false);
|
optional.setCanBeResolved(false);
|
||||||
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
||||||
SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class)
|
SourceSetContainer sourceSets = project.getExtensions().getByType(JavaPluginExtension.class)
|
||||||
.getSourceSets();
|
.getSourceSets();
|
||||||
sourceSets.all((sourceSet) -> {
|
sourceSets.all((sourceSet) -> {
|
||||||
project.getConfigurations().getByName(sourceSet.getCompileClasspathConfigurationName()).extendsFrom(optional);
|
project.getConfigurations().getByName(sourceSet.getCompileClasspathConfigurationName()).extendsFrom(optional);
|
||||||
|
|
|
@ -2,10 +2,9 @@ FROM ubuntu:focal-20210827
|
||||||
|
|
||||||
ADD setup.sh /setup.sh
|
ADD setup.sh /setup.sh
|
||||||
ADD get-jdk-url.sh /get-jdk-url.sh
|
ADD get-jdk-url.sh /get-jdk-url.sh
|
||||||
RUN ./setup.sh java8
|
RUN ./setup.sh
|
||||||
|
|
||||||
ENV JAVA_HOME /opt/openjdk/java8
|
ENV JAVA_HOME /opt/openjdk/java17
|
||||||
ENV JDK11 /opt/openjdk/java11
|
ENV JDK17 /opt/openjdk/java17
|
||||||
ENV JDK16 /opt/openjdk/java16
|
|
||||||
|
|
||||||
ENV PATH $JAVA_HOME/bin:$PATH
|
ENV PATH $JAVA_HOME/bin:$PATH
|
||||||
|
|
|
@ -2,15 +2,9 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
java8)
|
java17)
|
||||||
echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz"
|
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"
|
echo $"Unknown java version"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -22,7 +22,7 @@ curl --output /opt/concourse-release-scripts.jar https://repo.spring.io/release/
|
||||||
|
|
||||||
mkdir -p /opt/openjdk
|
mkdir -p /opt/openjdk
|
||||||
pushd /opt/openjdk > /dev/null
|
pushd /opt/openjdk > /dev/null
|
||||||
for jdk in java8 java11 java16
|
for jdk in java17
|
||||||
do
|
do
|
||||||
JDK_URL=$( /get-jdk-url.sh $jdk )
|
JDK_URL=$( /get-jdk-url.sh $jdk )
|
||||||
mkdir $jdk
|
mkdir $jdk
|
||||||
|
|
|
@ -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: "https://github.com/spring-projects/spring-framework.git"
|
||||||
github-repo-name: "spring-projects/spring-framework"
|
github-repo-name: "spring-projects/spring-framework"
|
||||||
docker-hub-organization: "springci"
|
docker-hub-organization: "springci"
|
||||||
artifactory-server: "https://repo.spring.io"
|
artifactory-server: "https://repo.spring.io"
|
||||||
branch: "main"
|
branch: "main"
|
||||||
milestone: "5.3.x"
|
milestone: "6.0.x"
|
||||||
build-name: "spring-framework"
|
build-name: "spring-framework"
|
||||||
pipeline-name: "spring-framework"
|
pipeline-name: "spring-framework"
|
||||||
concourse-url: "https://ci.spring.io"
|
concourse-url: "https://ci.spring.io"
|
||||||
|
|
|
@ -67,13 +67,6 @@ resources:
|
||||||
icon: github
|
icon: github
|
||||||
source:
|
source:
|
||||||
<<: *git-repo-resource-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
|
- name: ci-images-git-repo
|
||||||
type: git
|
type: git
|
||||||
icon: github
|
icon: github
|
||||||
|
@ -86,7 +79,7 @@ resources:
|
||||||
icon: docker
|
icon: docker
|
||||||
source:
|
source:
|
||||||
<<: *docker-resource-source
|
<<: *docker-resource-source
|
||||||
repository: ((docker-hub-organization))/spring-framework-ci
|
repository: ((docker-hub-organization))/spring-framework-ci-jdk17
|
||||||
- name: artifactory-repo
|
- name: artifactory-repo
|
||||||
type: artifactory-resource
|
type: artifactory-resource
|
||||||
icon: package-variant
|
icon: package-variant
|
||||||
|
@ -111,22 +104,6 @@ resources:
|
||||||
access_token: ((github-ci-status-token))
|
access_token: ((github-ci-status-token))
|
||||||
branch: ((branch))
|
branch: ((branch))
|
||||||
context: build
|
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
|
- name: slack-alert
|
||||||
type: slack-notification
|
type: slack-notification
|
||||||
icon: slack
|
icon: slack
|
||||||
|
@ -216,62 +193,6 @@ jobs:
|
||||||
"zip.type": "schema"
|
"zip.type": "schema"
|
||||||
get_params:
|
get_params:
|
||||||
threads: 8
|
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
|
- name: build-pull-requests
|
||||||
serial: true
|
serial: true
|
||||||
public: true
|
public: true
|
||||||
|
@ -453,7 +374,7 @@ jobs:
|
||||||
|
|
||||||
groups:
|
groups:
|
||||||
- name: "builds"
|
- name: "builds"
|
||||||
jobs: ["build", "jdk11-build", "jdk16-build"]
|
jobs: ["build"]
|
||||||
- name: "releases"
|
- name: "releases"
|
||||||
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"]
|
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"]
|
||||||
- name: "ci-images"
|
- name: "ci-images"
|
||||||
|
|
|
@ -4,6 +4,6 @@ set -e
|
||||||
source $(dirname $0)/common.sh
|
source $(dirname $0)/common.sh
|
||||||
|
|
||||||
pushd git-repo > /dev/null
|
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
|
-PmainToolchain=${MAIN_TOOLCHAIN} -PtestToolchain=${TEST_TOOLCHAIN} --no-daemon --max-workers=4 check
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* <li>a JDK11 toolchain for compiling and running the test SourceSet
|
* <li>a JDK11 toolchain for compiling and running the test SourceSet
|
||||||
* </ul>
|
* </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.
|
* Gradle will automatically detect JDK distributions in well-known locations.
|
||||||
* The following command will list the detected JDKs on the host.
|
* The following command will list the detected JDKs on the host.
|
||||||
|
@ -44,7 +44,7 @@ def mainToolchainLanguageVersion() {
|
||||||
if (mainToolchainConfigured()) {
|
if (mainToolchainConfigured()) {
|
||||||
return JavaLanguageVersion.of(project.mainToolchain.toString())
|
return JavaLanguageVersion.of(project.mainToolchain.toString())
|
||||||
}
|
}
|
||||||
return JavaLanguageVersion.of(8)
|
return JavaLanguageVersion.of(17)
|
||||||
}
|
}
|
||||||
|
|
||||||
def testToolchainLanguageVersion() {
|
def testToolchainLanguageVersion() {
|
||||||
|
@ -64,9 +64,9 @@ plugins.withType(JavaPlugin) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Fallback to JDK8
|
// Fallback to JDK17
|
||||||
java {
|
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
|
// Configure a specific Java Toolchain for compiling and running tests if the 'testToolchain' property is defined
|
||||||
|
@ -86,10 +86,10 @@ plugins.withType(JavaPlugin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.withType(GroovyPlugin) {
|
plugins.withType(GroovyPlugin) {
|
||||||
// Fallback to JDK8
|
// Fallback to JDK17
|
||||||
if (!mainToolchainConfigured()) {
|
if (!mainToolchainConfigured()) {
|
||||||
compileGroovy {
|
compileGroovy {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ pluginManager.withPlugin("kotlin") {
|
||||||
languageVersion = mainLanguageVersion
|
languageVersion = mainLanguageVersion
|
||||||
}
|
}
|
||||||
// See https://kotlinlang.org/docs/gradle.html#attributes-specific-for-jvm
|
// 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 {
|
compileKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = javaVersion
|
jvmTarget = javaVersion
|
||||||
|
@ -118,15 +118,15 @@ pluginManager.withPlugin("kotlin") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Fallback to JDK8
|
// Fallback to JDK11
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = '1.8'
|
jvmTarget = '11'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = '1.8'
|
jvmTarget = '11'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue