Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,22 @@ pipeline {
stage('Maven/Tycho Build & Test') {
environment {
MAVEN_OPTS = "-Xmx1500m"
// set all Java versions needed by our toolchains.xml
JAVA_HOME_17_X64 = tool(type:'jdk', name:'temurin-jdk17-latest')
JAVA_HOME_21_X64 = tool(type:'jdk', name:'temurin-jdk21-latest')
// Set all Java version that can be discovered/selected by maven-toolchains-plugin
JAVA_17_HOME = tool(type:'jdk', name:'temurin-jdk17-latest')
JAVA_21_HOME = tool(type:'jdk', name:'temurin-jdk21-latest')
}
steps {
xvnc(useXauthority: true) {
sh """
jdkEnvVar='JAVA_${javaVersion()}_HOME'
if [ "${JAVA_HOME}" = "\${JAVA_${javaVersion()}_HOME}" ]; then
# Workaround for https://github.com/apache/maven-toolchains-plugin/pull/148
# clear the structured variable and require JAVA_HOME instead
export JAVA_${javaVersion()}_HOME=''
jdkEnvVar='JAVA_HOME'
fi
./full-build.sh --tp=${selectedTargetPlatform()} \
${javaVersion() == 17 ? '--toolchains releng/toolchains.xml -Pstrict-jdk-17' : ''} \
${javaVersion() == 21 ? '-Pstrict-jdk-21' : ''}
-Pstrict-jdk-${javaVersion()} -Dtoolchain.jdk.env=\${jdkEnvVar}
"""
}
}// END steps
Expand Down
55 changes: 22 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
<tycho-version>4.0.13</tycho-version>

<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>${maven.compiler.release}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.release}</maven.compiler.target>

<maven.javadoc.failOnError>false</maven.javadoc.failOnError>

<build-helper-maven-plugin-version>3.3.0</build-helper-maven-plugin-version>
Expand Down Expand Up @@ -694,35 +695,15 @@
</profile>
<profile>
<id>strict-jdk-17</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<!-- Toolchain selected by maven/tycho-compiler for compilation and maven/tycho-surefire as JRE of launched test-runtimes-->
<version>17</version>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.release>17</maven.compiler.release>
<!-- Toolchain selected by maven/tycho-compiler for compilation and maven/tycho-surefire as JRE of launched test-runtimes-->
<toolchain.jdk.version>[17,18)</toolchain.jdk.version>
</properties>

</profile>
<profile>
<id>strict-jdk-21</id>
<!--
Here we don't use the toolchain relying on the effective Java version used for the build
-->
<properties>
<!--
Since the Xtend compiler generates Java code using new API introduced in Java 21,
Expand All @@ -731,10 +712,7 @@
see https://github.com/eclipse-xtext/xtext/issues/2686#issuecomment-2038175179
-->
<maven.compiler.release>21</maven.compiler.release>
<!--
Force generatation of Java 21 bytecode
-->
<maven.compiler.target>21</maven.compiler.target>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, so I guess also above, we need .source and .target because the Xtend compiler looks for them, it ignores .release

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this hint. (Just for cross-reference) I have created a PR to make the xtend/xtest mojos consider maven.compiler.release:

For the meantime I implemented a workaround: in the global properties section assign the release version to the source and target version properties:

<maven.compiler.source>${maven.compiler.release}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.release}</maven.compiler.target>

Whenever the maven.compiler.release property is overwritten, e.g. in one of the strict-jdk- profiles the source and target value should update too, because they should be resolved lazy by Maven.

<toolchain.jdk.version>[21,22)</toolchain.jdk.version>
</properties>
</profile>
</profiles>
Expand Down Expand Up @@ -766,7 +744,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -1005,6 +983,17 @@
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>select-jdk-toolchain</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
25 changes: 0 additions & 25 deletions releng/toolchains.xml

This file was deleted.

Loading