// Set properties before any plugins get loaded
ext {
  cassandraDriverTestVersions = "[3.0,4.0)"
}

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

muzzle {

  pass {
    group = "com.datastax.cassandra"
    module = "cassandra-driver-core"
    versions = cassandraDriverTestVersions
    assertInverse = true
    // Older versions of cassandra-driver-core require an older guava dependency (0.16.0). guava >20.0 is not
    // compatible with Java 7, so we declare the dependency on 20.0 in our top level dependencies.gradle.
    // Ideally our muzzle plugin should take into account those versions declaration, instead it does not so we would
    // end up with testing compatibility with guava 0.16 which lacks the method invocation added to be compatible with
    // most recent versions of guava (27+). While the long term solution is to make the muzzle plugin aware of upstream
    // declared dependencies, for now we just make sure that we use the proper ones.
    extraDependency "com.google.guava:guava:20.0"
  }

  // Making sure that instrumentation works with recent versions of Guava which removed method
  // Futures::transform(input, function) in favor of Futures::transform(input, function, executor)
  pass {
    name = "Newest versions of Guava"
    group = "com.datastax.cassandra"
    module = "cassandra-driver-core"
    versions = cassandraDriverTestVersions
    // While com.datastax.cassandra uses old versions of Guava, users may depends themselves on newer versions of Guava
    extraDependency "com.google.guava:guava:27.0-jre"
  }
}

dependencies {
  library group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.0.0'

  testLibrary group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.2.0'
  testInstrumentation project(':instrumentation:guava-10.0:javaagent')

  latestDepTestLibrary group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.+'
}
