/*
 * Instrumentation for Hibernate between 3.5 and 4.
 * Has the same logic as the Hibernate 4+ instrumentation, but is copied rather than sharing a codebase. This is because
 * the root interface for Session/StatelessSession - SharedSessionContract - isn't present before version 4. So the
 * instrumentation isn't able to reference it.
 */

apply from: "$rootDir/gradle/instrumentation.gradle"

muzzle {
  pass {
    group = "org.hibernate"
    module = "hibernate-core"
    versions = "[3.3.0.GA,4.0.0.Final)"
    assertInverse = true
  }
}

dependencies {
  library group: 'org.hibernate', name: 'hibernate-core', version: '3.3.0.GA'

  implementation project(':instrumentation:hibernate:hibernate-common:javaagent')

  testInstrumentation project(':instrumentation:jdbc:javaagent')
  // Added to ensure cross compatibility:
  testInstrumentation project(':instrumentation:hibernate:hibernate-4.0:javaagent')
  testInstrumentation project(':instrumentation:hibernate:hibernate-4.3:javaagent')

  testLibrary group: 'org.hibernate', name: 'hibernate-core', version: '3.3.0.SP1'
  testImplementation group: 'org.hibernate', name: 'hibernate-annotations', version: '3.4.0.GA'
  testImplementation group: 'javassist', name: 'javassist', version: '+'
  testImplementation group: 'com.h2database', name: 'h2', version: '1.4.197'
  testImplementation "javax.xml.bind:jaxb-api:2.2.11"
  testImplementation "com.sun.xml.bind:jaxb-core:2.2.11"
  testImplementation "com.sun.xml.bind:jaxb-impl:2.2.11"
  testImplementation "javax.activation:activation:1.1.1"

  latestDepTestLibrary group: 'org.hibernate', name: 'hibernate-core', version: '3.+'
}

if (findProperty('testLatestDeps')) {
  configurations {
    // Needed for test, but for latestDepTest this would otherwise bundle a second incompatible version of hibernate-core.
    testImplementation.exclude group: 'org.hibernate', module: 'hibernate-annotations'
  }
}
