diff --git a/.github/workflows/external-pr.yml b/.github/workflows/external-pr.yml index e84ec19a7d3..5471a5e190d 100644 --- a/.github/workflows/external-pr.yml +++ b/.github/workflows/external-pr.yml @@ -28,7 +28,13 @@ jobs: - name: 'Set up Java' uses: actions/setup-java@v3 with: - java-version: 17 + java-version: | + 11 + 17 + # Adapt the toolchains.xml generated by this action + mvn-toolchain-id: | + JavaSE-11 + JavaSE-17 distribution: 'temurin' if: ${{ env.BASE_REPO != env.PR_HEAD_REPO }} @@ -43,6 +49,6 @@ jobs: - name: Build and test uses: coactions/setup-xvfb@v1 with: - run: mvn clean verify --show-version -PuseJenkinsSnapshots -Dsurefire.rerunFailingTestsCount=3 + run: mvn clean verify --show-version -PuseJenkinsSnapshots,strict-jdk -Dsurefire.rerunFailingTestsCount=3 working-directory: org.eclipse.xtext.full.releng if: ${{ env.BASE_REPO != env.PR_HEAD_REPO }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index e9dee451a1a..9abedb37879 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -20,7 +20,13 @@ jobs: - name: 'Set up Java' uses: actions/setup-java@v3 with: - java-version: 17 + java-version: | + 11 + 17 + # Adapt the toolchains.xml generated by this action + mvn-toolchain-id: | + JavaSE-11 + JavaSE-17 distribution: 'temurin' - name: 'Cache Maven packages' @@ -32,8 +38,8 @@ jobs: - name: Build and test uses: coactions/setup-xvfb@v1 - with: - run: mvn clean verify --show-version -PuseJenkinsSnapshots -Dsurefire.rerunFailingTestsCount=3 + with: + run: mvn clean verify --show-version -PuseJenkinsSnapshots,strict-jdk -Dsurefire.rerunFailingTestsCount=3 working-directory: org.eclipse.xtext.full.releng build-maven-artifacts: @@ -46,7 +52,13 @@ jobs: - name: 'Set up Java' uses: actions/setup-java@v3 with: - java-version: 17 + java-version: | + 11 + 17 + # Adapt the toolchains.xml generated by this action + mvn-toolchain-id: | + JavaSE-11 + JavaSE-17 distribution: 'temurin' - name: 'Cache Maven packages' @@ -57,5 +69,5 @@ jobs: restore-keys: ${{ runner.os }}-maven - name: Build Maven artifacts - run: mvn clean verify --show-version -PuseJenkinsSnapshots + run: mvn clean verify --show-version -PuseJenkinsSnapshots,strict-jdk working-directory: org.eclipse.xtext.maven.releng \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index b314d470efd..e0c1b8f0e62 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,16 +7,13 @@ pipeline { parameters { choice(name: 'TARGET_PLATFORM', choices: ['r202203', 'r202206', 'r202209', 'r202212', 'r202303', 'latest'], description: 'Which Target Platform should be used?') - // see https://wiki.eclipse.org/Jenkins#JDK - choice(name: 'JDK_VERSION', description: 'Which JDK should be used?', choices: [ - 'temurin-jdk11-latest', 'temurin-jdk17-latest' - ]) + choice(name: 'JDK_VERSION', choices: [ '11', '17' ], description: 'Which JDK version should be used?') } triggers { parameterizedCron(env.BRANCH_NAME == 'main' ? ''' - H H(0-1) * * * %TARGET_PLATFORM=r202203;JDK_VERSION=temurin-jdk17-latest - H H(3-4) * * * %TARGET_PLATFORM=latest;JDK_VERSION=temurin-jdk17-latest + H H(0-1) * * * %TARGET_PLATFORM=r202203;JDK_VERSION=17 + H H(3-4) * * * %TARGET_PLATFORM=latest;JDK_VERSION=17 ''' : '') } @@ -28,7 +25,8 @@ pipeline { tools { maven "apache-maven-3.8.6" - jdk "${params.JDK_VERSION}" + // see https://wiki.eclipse.org/Jenkins#JDK + jdk "temurin-jdk17-latest" } stages { @@ -59,10 +57,29 @@ pipeline { stage('Maven/Tycho Build & Test') { environment { MAVEN_OPTS = "-Xmx1500m" + JAVA_HOME_11_X64 = tool(type:'jdk', name:'temurin-jdk11-latest') + JAVA_HOME_17_X64 = tool(type:'jdk', name:'temurin-jdk17-latest') } steps { xvnc(useXauthority: true) { - sh "./full-build.sh --tp=${selectedTargetPlatform()} ${javaVersionBasedProperties()}" + //TODO: remove the following test print out + sh ''' + echo 'JAVA_HOME_11_X64=${JAVA_HOME_11_X64}' + echo 'JAVA_HOME_17_X64=${JAVA_HOME_17_X64}' + echo 'Predefined Jenkins Toolchain content' + cat ~/.m2e/toolchains.xml + ''' + script { + def mavenSurfireJDKToolchain = params.JDK_VERSION + def tychoSurefireJDK = params.JDK_VERSION == '17' ? 'SYSTEM' : 'BREE' + sh """ + ./full-build.sh --tp=${selectedTargetPlatform()} \ + -Pstrict-jdk + --toolchains releng/toolchains.xml + -Dmaven.surefire.runtimeJDK=${mavenSurfireJDKToolchain} \ + -Dtycho.surefire.runtimeJDK=${tychoSurefireJDK} + """ + } } }// END steps } // END stage @@ -116,7 +133,7 @@ pipeline { /** return the Java version as Integer (8, 11, ...) */ def javaVersion() { - return Integer.parseInt(params.JDK_VERSION.replaceAll(".*-jdk(\\d+).*", "\$1")) + return Integer.parseInt(params.JDK_VERSION) } /** returns true when this build was triggered by an upstream build */ @@ -161,20 +178,3 @@ def selectedTargetPlatform() { return tp } } - -/** - * Tycho 3 requires Java 17. - * If the build uses Java version 11, we return the proper tycho-version override. - * Otherwise, we return an empty string. - */ -def javaVersionBasedProperties() { - def javaVersion = javaVersion() - - if (javaVersion<17) { - println("Switching to Tycho 2.7.5 with Java ${javaVersion}") - return '-Dtycho-version=2.7.5' - } else { - return '' - } -} - diff --git a/jenkins/nightly-deploy/Jenkinsfile b/jenkins/nightly-deploy/Jenkinsfile index 1f1f2a308c3..33486b1ebbf 100644 --- a/jenkins/nightly-deploy/Jenkinsfile +++ b/jenkins/nightly-deploy/Jenkinsfile @@ -34,13 +34,17 @@ pipeline { } } stage('Maven Tycho Build, Sign, Deploy') { + environment { + JAVA_HOME_11_X64 = tool(type:'jdk', name:'temurin-jdk11-latest') + JAVA_HOME_17_X64 = tool(type:'jdk', name:'temurin-jdk17-latest') + } steps { withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) { sh 'gpg --batch --import "${KEYRING}"' sh 'for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u); do echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust; done' } sshagent(['projects-storage.eclipse.org-bot-ssh']) { - sh './full-deploy.sh -Peclipse-sign,sonatype-oss-release,release-snapshot' + sh ' ./full-deploy.sh -Peclipse-sign,sonatype-oss-release,release-snapshot,strict-jdk --toolchains releng/toolchains.xml' } } } diff --git a/pom.xml b/pom.xml index 474184b3ed6..2c0648fe9c8 100644 --- a/pom.xml +++ b/pom.xml @@ -125,7 +125,7 @@ - ISO-8859-1 + ISO-8859-1 3.0.4 11 @@ -187,6 +187,11 @@ ${releases-zip-directory}/${current-release-zip-subdirectory} TMF Xtext Update Site + + + ${java.specification.version} + SYSTEM + @@ -401,6 +406,59 @@ + + strict-jdk + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + ${maven.compiler.release} + + + + + + + + + org.eclipse.tycho + tycho-compiler-plugin + + BREE + + + + org.eclipse.tycho + tycho-surefire-plugin + + ${tycho.surefire.runtimeJDK} + + + + org.apache.maven.plugins + maven-surefire-plugin + + + ${maven.surefire.runtimeJDK} + + + + + + + @@ -582,7 +640,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.5.0 diff --git a/releng/toolchains.xml b/releng/toolchains.xml new file mode 100644 index 00000000000..b12a3999dc8 --- /dev/null +++ b/releng/toolchains.xml @@ -0,0 +1,25 @@ + + + + jdk + + JavaSE-11 + 11 + + + ${env.JAVA_HOME_11_X64} + + + + jdk + + JavaSE-17 + 17 + + + ${env.JAVA_HOME_17_X64} + + +