Skip to content

Commit

Permalink
HV-1882 Move sigtest to a separate stage and run it with JDK 8
Browse files Browse the repository at this point in the history
We cannot run the sigtest when running Maven with JDK 17,
so we have to twist the rules and exceptionally run this with JDK 8...
  • Loading branch information
yrodiere authored and gsmet committed Feb 24, 2022
1 parent 2064ffb commit 70cef76
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 8 deletions.
39 changes: 34 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ import org.hibernate.jenkins.pipeline.helpers.alternative.AlternativeMultiMap

@Field boolean enableDefaultBuild = false
@Field boolean enableDefaultBuildIT = false
@Field boolean enableDefaultBuildSigtest = false
@Field boolean deploySnapshot = false

this.helper = new JobHelper(this)
Expand All @@ -121,7 +120,6 @@ stage('Configure') {
condition: TestCondition.BEFORE_MERGE,
isDefault: true),
new JdkBuildEnvironment(testJavaVersion: '8', testLauncherTool: 'OracleJDK8 Latest',
enableSigtest: true,
condition: TestCondition.BEFORE_MERGE),
new JdkBuildEnvironment(testJavaVersion: '11', testCompilerTool: 'OpenJDK 11 Latest',
condition: TestCondition.BEFORE_MERGE)
Expand All @@ -131,6 +129,10 @@ stage('Configure') {
condition: TestCondition.AFTER_MERGE),
new WildFlyTckBuildEnvironment(testJavaVersion: '11', testCompilerTool: 'OpenJDK 11 Latest',
condition: TestCondition.AFTER_MERGE)
],
sigtest: [
new SigTestBuildEnvironment(testJavaVersion: '8', jdkTool: 'OracleJDK8 Latest',
condition: TestCondition.BEFORE_MERGE)
]
])

Expand Down Expand Up @@ -251,7 +253,6 @@ stage('Default build') {
"} \
-Pdist \
-Pjqassistant \
${enableDefaultBuildSigtest ? '-Psigtest' : ''} \
${enableDefaultBuildIT ? '' : '-DskipITs'} \
${toTestJdkArg(environments.content.jdk.default)} \
"""
Expand All @@ -273,7 +274,6 @@ stage('Non-default environments') {
helper.withMavenWorkspace {
mavenNonDefaultBuild buildEnv, """ \
clean install \
${buildEnv.enableSigtest ? '-Psigtest' : ''} \
"""
}
}
Expand All @@ -295,6 +295,28 @@ stage('Non-default environments') {
})
}

// Run the TCK signature test
environments.content.sigtest.enabled.each { SigTestBuildEnvironment buildEnv ->
parameters.put(buildEnv.tag, {
runBuildOnNode {
helper.withMavenWorkspace(jdk: buildEnv.jdkTool) {
if ( buildEnv.testJavaVersion == '8' ) {
// JVM options such as --add-opens won't work on JDK 8
sh 'rm .mvn/jvm.config'
}
mavenNonDefaultBuild buildEnv, """ \
clean install \
-pl tck-runner \
-Psigtest \
-Denforcer.skip=true \
-DskipTests=true -Dcheckstyle.skip=true \
-DdisableDistributionBuild=true -DdisableDocumentationBuild=true \
"""
}
}
})
}

if (parameters.isEmpty()) {
echo 'Skipping builds in non-default environments'
helper.markStageSkipped()
Expand Down Expand Up @@ -341,7 +363,6 @@ abstract class BuildEnvironment {
}

class JdkBuildEnvironment extends BuildEnvironment {
boolean enableSigtest
@Override
String getTag() { "jdk-$testJavaVersion" }
@Override
Expand All @@ -355,6 +376,14 @@ class WildFlyTckBuildEnvironment extends BuildEnvironment {
boolean requiresDefaultBuildArtifacts() { true }
}

class SigTestBuildEnvironment extends BuildEnvironment {
String jdkTool
@Override
String getTag() { "sigtest-jdk$testJavaVersion" }
@Override
boolean requiresDefaultBuildArtifacts() { true }
}

void keepOnlyEnvironmentsMatchingFilter(String regex) {
def pattern = /$regex/

Expand Down
29 changes: 26 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@
<!-- No need to build the javadocs per module. Aggregated javadocs are build in the distribution module. See also HV-894 -->
<maven.javadoc.skip>true</maven.javadoc.skip>

<maven.compiler.release>${java-version.main.release}</maven.compiler.release>
<maven.compiler.testRelease>${java-version.test.release}</maven.compiler.testRelease>

<!-- maven.compiler.release and maven.compiler.testRelease are set in a profile; see below -->
<!-- Also set source/target, because several other plugins rely on this and don't understand release -->
<maven.compiler.source>${java-version.main.release}</maven.compiler.source>
<maven.compiler.target>${java-version.main.release}</maven.compiler.target>
Expand Down Expand Up @@ -1337,6 +1335,31 @@
</plugins>
</build>
</profile>
<profile>
<!-- Running the build with JDK 8 is not recommended and will require disabling the enforcer plugin,
but it's the only way to run the signature test. -->
<id>runningMavenWithJdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<!-- With JDK 8, java.home is the JRE -->
<java-version.main.compiler.java_home>${java.home}/../</java-version.main.compiler.java_home>
<java-version.test.compiler.java_home>${java.home}/../</java-version.test.compiler.java_home>
<!-- Cannot use -release on JDK 8; we'll default to -source/-target -->
<!-- That's why we don't define maven.compiler.release nor maven.compiler.testRelease here -->
</properties>
</profile>
<profile>
<id>runningMavenWithJdk9+</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<maven.compiler.release>${java-version.main.release}</maven.compiler.release>
<maven.compiler.testRelease>${java-version.test.release}</maven.compiler.testRelease>
</properties>
</profile>
<profile>
<id>testWithJdk8</id>
<activation>
Expand Down

0 comments on commit 70cef76

Please sign in to comment.