HHH-15398 Bump baseline Jakarta Persistence version to 3.1

This commit is contained in:
Marco Belladelli 2022-12-16 10:25:55 +01:00 committed by Christian Beikov
parent eccc1a89c5
commit aadd0d7179
8 changed files with 13 additions and 147 deletions

View File

@ -1,93 +0,0 @@
@Library('hibernate-jenkins-pipeline-helpers@1.5') _
// Avoid running the pipeline on branch indexing
if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
print "INFO: Build skipped due to trigger being Branch Indexing"
currentBuild.result = 'ABORTED'
return
}
pipeline {
agent {
label 'LongDuration'
}
tools {
jdk 'OpenJDK 11 Latest'
}
options {
rateLimitBuilds(throttle: [count: 1, durationName: 'day', userBoost: true])
buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3'))
disableConcurrentBuilds(abortPrevious: true)
}
parameters {
choice(name: 'IMAGE_JDK', choices: ['jdk11'], description: 'The JDK base image version to use for the TCK image.')
string(name: 'TCK_VERSION', defaultValue: '3.0.2', description: 'The version of the Jakarta JPA TCK i.e. `2.2.0` or `3.0.2`')
string(name: 'TCK_SHA', defaultValue: '264892e663959f5ac452f5640ae2376337415cdf733b5d68c84d3a210b024bfe', description: 'The SHA256 of the Jakarta JPA TCK that is distributed under https://download.eclipse.org/jakartaee/persistence/3.0/jakarta-persistence-tck-${TCK_VERSION}.zip.sha256')
booleanParam(name: 'NO_SLEEP', defaultValue: true, description: 'Whether the NO_SLEEP patch should be applied to speed up the TCK execution')
}
stages {
stage('Build') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('openjdk:11-jdk').pull()
}
}
dir('hibernate') {
checkout scm
sh './gradlew publishToMavenLocal'
script {
env.HIBERNATE_VERSION = sh (
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
returnStdout: true
).trim()
}
}
dir('tck') {
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]]
sh """ \
cd jpa-3.0; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} .
"""
}
}
}
stage('Run TCK') {
steps {
sh """ \
rm -Rf ./results
docker rm -f tck || true
docker volume rm -f tck-vol || true
docker volume create tck-vol
docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z -v tck-vol:/tck/persistence-tck/tmp/:z -e NO_SLEEP=${params.NO_SLEEP} -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner
docker cp tck:/tck/persistence-tck/tmp/ ./results
"""
archiveArtifacts artifacts: 'results/**'
script {
failures = sh (
script: """ \
set +x
while read line; do
if [[ "\$line" != *"Passed." ]]; then
echo "\$line"
fi
done <results/JTreport/text/summary.txt
""",
returnStdout: true
).trim()
if ( !failures.isEmpty() ) {
echo "Some TCK tests failed:"
echo failures
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
always {
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
}
}
}
}

View File

@ -36,7 +36,7 @@ public class ConfigXsdSupport {
private static final XsdDescriptor[] xsdCache = new XsdDescriptor[7];
public XsdDescriptor latestJpaDescriptor() {
return getJPA30();
return getJPA31();
}
public static boolean shouldBeMappedToLatestJpaDescriptor(String uri) {

View File

@ -31,7 +31,7 @@ import org.xml.sax.SAXException;
public class LocalXsdResolver {
public static String latestJpaVerison() {
return "3.0";
return "3.1";
}
public static boolean isValidJpaVersion(String version) {

View File

@ -8,6 +8,8 @@ package org.hibernate.bytecode.spi;
import java.security.ProtectionDomain;
import jakarta.persistence.spi.TransformerException;
/**
* A persistence provider provides an instance of this interface
* to the PersistenceUnitInfo.addTransformer method.
@ -35,5 +37,5 @@ public interface ClassTransformer extends jakarta.persistence.spi.ClassTransform
String className,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer);
byte[] classfileBuffer) throws TransformerException;
}

View File

@ -108,11 +108,7 @@ public class StandardIdentifierGeneratorFactory
generatorTypeStrategyMap.put( GenerationType.SEQUENCE, SequenceGenerationTypeStrategy.INSTANCE );
generatorTypeStrategyMap.put( GenerationType.TABLE, TableGenerationTypeStrategy.INSTANCE );
generatorTypeStrategyMap.put( GenerationType.IDENTITY, IdentityGenerationTypeStrategy.INSTANCE );
try {
generatorTypeStrategyMap.put( GenerationType.valueOf( "UUID" ), UUIDGenerationTypeStrategy.INSTANCE );
}
catch (IllegalArgumentException ignore) {
}
generatorTypeStrategyMap.put( GenerationType.UUID, UUIDGenerationTypeStrategy.INSTANCE );
}
private void logOverrides() {

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.jpa.internal.enhance;
import java.lang.instrument.IllegalClassFormatException;
import java.lang.reflect.Constructor;
import java.security.ProtectionDomain;
import org.hibernate.bytecode.enhance.spi.EnhancementContext;
@ -15,7 +13,8 @@ import org.hibernate.bytecode.enhance.spi.EnhancementContextWrapper;
import org.hibernate.bytecode.enhance.spi.Enhancer;
import org.hibernate.bytecode.spi.ClassTransformer;
import org.hibernate.cfg.Environment;
import org.hibernate.internal.util.ExceptionHelper;
import jakarta.persistence.spi.TransformerException;
/**
* @author Steve Ebersole
@ -23,21 +22,6 @@ import org.hibernate.internal.util.ExceptionHelper;
*/
public class EnhancingClassTransformerImpl implements ClassTransformer {
private static final Constructor<Exception> TRANSFORMER_CONSTRUCTOR;
static {
Constructor<Exception> constructor = null;
try {
final Class<?> transformerException = Class.forName( "jakarta.persistence.spi.TransformerException" );
//noinspection unchecked
constructor = (Constructor<Exception>) transformerException.getConstructor( String.class, Throwable.class );
}
catch (ClassNotFoundException | NoSuchMethodException e) {
// Ignore
}
TRANSFORMER_CONSTRUCTOR = constructor;
}
private final EnhancementContext enhancementContext;
public EnhancingClassTransformerImpl(EnhancementContext enhancementContext) {
@ -50,7 +34,7 @@ public class EnhancingClassTransformerImpl implements ClassTransformer {
String className,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer) {
byte[] classfileBuffer) throws TransformerException {
// The first design had the enhancer as a class variable. That approach had some goods and bads.
// We don't have to create an enhancer for each class, but on the other end it would stay in memory forever.
@ -61,30 +45,7 @@ public class EnhancingClassTransformerImpl implements ClassTransformer {
return enhancer.enhance( className, classfileBuffer );
}
catch (final Exception e) {
Throwable t;
if ( TRANSFORMER_CONSTRUCTOR == null ) {
t = new IllegalClassFormatException( "Error performing enhancement of " + className ) {
@Override
public synchronized Throwable getCause() {
return e;
}
};
}
else {
try {
t = TRANSFORMER_CONSTRUCTOR.newInstance( "Error performing enhancement of " + className, e );
}
catch (Exception ex) {
t = new IllegalClassFormatException( "Error performing enhancement of " + className ) {
@Override
public synchronized Throwable getCause() {
return e;
}
};
}
}
ExceptionHelper.doThrow( t );
return null;
throw new TransformerException( "Error performing enhancement of " + className, e );
}
}

View File

@ -22,10 +22,10 @@ public interface JpaSimpleCase<C,R> extends JpaExpression<R>, CriteriaBuilder.Si
@Override
JpaSimpleCase<C, R> when(C condition, Expression<? extends R> result);
// @Override
@Override
JpaSimpleCase<C, R> when(Expression<? extends C> condition, R result);
// @Override
@Override
JpaSimpleCase<C, R> when(Expression<? extends C> condition, Expression<? extends R> result);
@Override

View File

@ -18,7 +18,7 @@ import org.gradle.api.initialization.Settings;
public class JpaVersion {
public static final String EXT_KEY = "jakartaJpaVersion";
public static final String VERSION_KEY = "jakartaJpaVersion";
public static final String DEFAULT_VERSION = "3.0.0";
public static final String DEFAULT_VERSION = "3.1.0";
private final String name;
private final String osgiName;