apply from: "$rootDir/gradle/instrumentation.gradle"
apply plugin: 'org.unbroken-dome.test-sets'

muzzle {
  pass {
    group = "io.netty"
    module = "netty"
    versions = "[3.8.0.Final,4)"
    assertInverse = true
  }
  fail {
    group = "io.netty"
    module = "netty-all"
    versions = "[,]"
  }
}

testSets {
  latestDepTest
}

dependencies {
  compileOnly group: 'io.netty', name: 'netty', version: '3.8.0.Final'

  testImplementation group: 'io.netty', name: 'netty', version: '3.8.0.Final'
  testImplementation group: 'com.ning', name: 'async-http-client', version: '1.8.0'

  latestDepTestImplementation group: 'io.netty', name: 'netty', version: '3.10.+'
  latestDepTestImplementation group: 'com.ning', name: 'async-http-client', version: '1.9.+'
}

// We need to force the dependency to the earliest supported version because other libraries declare newer versions.
configurations.testImplementation {
  resolutionStrategy {
    eachDependency { DependencyResolveDetails details ->
      //specifying a fixed version for all libraries with io.netty' group
      if (details.requested.group == 'io.netty') {
        details.useVersion "3.8.0.Final"
      }
    }
  }
}
