HHH-13704 Make Javassist an optional dependency

* Change the gradle scope to `provide`
  * Add the dependency to the OSGi test bundle

HHH-13704 Add Javassist to the dependencies for the OSGi test
This commit is contained in:
Davide D'Alto 2019-11-08 20:54:00 +00:00
parent 39071a4d39
commit 76d2672122
2 changed files with 49 additions and 15 deletions

View File

@ -13,17 +13,45 @@ apply plugin: 'org.hibernate.build.gradle.xjc'
description = 'Hibernate\'s core ORM functionality'
ext {
jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
}
sourceSets.main {
java.srcDir project.jaxbTargetDir
}
sourceSets {
// resources inherently exclude sources
test {
resources {
setSrcDirs( ['src/test/java','src/test/resources'] )
}
}
testJavassist {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
}
configurations {
tests {
description = 'Configuration for the produced test jar'
}
//Configures the compile and runtime configurations for our javassist tests
//and includes the dependencies of the test task.
testJavassistCompile.extendsFrom testCompile
testJavassistRuntime.extendsFrom testRuntime
}
dependencies {
compile( libraries.jpa )
// Javassist is no longer the default enhancer but still required for other purposes, e.g. Scanning
compile( libraries.javassist )
provided( libraries.javassist )
// Could be made optional?
compile( libraries.byteBuddy )
compile( libraries.antlr )
@ -99,6 +127,10 @@ dependencies {
testCompile libraries.jboss_ejb_spec_jar
testCompile libraries.jboss_annotation_spec_jar
// Additional tests requiring Javassist
// folder in src/javassist/java
testJavassistCompile libraries.javassist
}
jar {
@ -139,19 +171,6 @@ jar {
}
}
ext {
jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
}
sourceSets.main {
java.srcDir project.jaxbTargetDir
}
// resources inherently exclude sources
sourceSets.test.resources {
setSrcDirs( ['src/test/java','src/test/resources'] )
}
//idea {
// module {
// sourceDirs += file( "${buildDir}/generated-src/antlr/main" )
@ -227,3 +246,17 @@ test {
//println "Starting test: " + descriptor
}
}
//Create the task that runs the integration tests found from the
//configured source directory and uses the correct classpath.
task testJavassist(type: Test) {
testClassesDirs = sourceSets.testJavassist.output.classesDirs
classpath = sourceSets.testJavassist.runtimeClasspath
//If you want to ensure that integration tests are run every time when you invoke
//this task, uncomment the following line.
//outputs.upToDateWhen { false }
}
check.dependsOn testJavassist
testJavassist.mustRunAfter test

View File

@ -7,5 +7,6 @@
<features name="hibernate-osgi-testing-repository" xmlns='http://karaf.apache.org/xmlns/features/v1.2.0'>
<feature name='hibernate-osgi-testing' version='5.0.0-SNAPSHOT'>
<bundle>mvn:com.h2database/h2/1.3.170</bundle>
<bundle>mvn:org.javassist/javassist/3.24.0-GA</bundle>
</feature>
</features>