Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with Tycho 3.0.4 and set up Maven toolchains #2223

Merged
merged 8 commits into from
Apr 20, 2023
Merged
26 changes: 7 additions & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pipeline {

tools {
maven "apache-maven-3.8.6"
jdk "${params.JDK_VERSION}"
jdk "temurin-jdk17-latest"
}

stages {
Expand Down Expand Up @@ -59,10 +59,15 @@ 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()}"
sh """
./full-build.sh --tp=${selectedTargetPlatform()} \
${javaVersion() == 17 ? '' : '--toolchains releng/toolchains.xml -Pstrict-release-jdk'}
"""
}
}// END steps
} // END stage
Expand Down Expand Up @@ -161,20 +166,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 ''
}
}

18 changes: 0 additions & 18 deletions org.eclipse.xtend.maven.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,6 @@
</bannedPlugins>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>jdt</compilerId>
<optimize>true</optimize>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
<version>${tycho-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -122,10 +108,6 @@
<artifactId>maven-archetype-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
Expand Down
18 changes: 0 additions & 18 deletions org.eclipse.xtext.maven.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,6 @@
</bannedPlugins>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>jdt</compilerId>
<optimize>true</optimize>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
<version>${tycho-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -99,10 +85,6 @@
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
Expand Down
32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,43 @@
</plugins>
</build>
</profile>
<profile>
<id>strict-release-jdk</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<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>${maven.compiler.release}</version>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down
25 changes: 25 additions & 0 deletions releng/toolchains.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF8"?>
<toolchains xmlns="https://maven.apache.org/TOOLCHAINS/1.1.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain>
<type>jdk</type>
<provides>
<id>JavaSE-11</id>
<version>11</version>
</provides>
<configuration>
<jdkHome>${env.JAVA_HOME_11_X64}</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<id>JavaSE-17</id>
<version>17</version>
</provides>
<configuration>
<jdkHome>${env.JAVA_HOME_17_X64}</jdkHome>
</configuration>
</toolchain>
</toolchains>