plugins {
  id 'net.consensys.zkevm.kotlin-common-conventions'
  id 'java-library'
  id 'java-test-fixtures'
}

description="Web3j extensions for Linea"

dependencies {
  api "org.web3j:core:${libs.versions.web3j.get()}"
  api project(':jvm-libs:linea:core:domain-models')
  api project(':jvm-libs:linea:clients:interfaces')
  api project(':jvm-libs:generic:logging')
  api project(":jvm-libs:generic:extensions:kotlin")
  api project(':jvm-libs:generic:extensions:futures')
  api project(':jvm-libs:linea:besu-libs')
  api project(':jvm-libs:generic:serialization:jackson')

  testImplementation(testFixtures(project(":jvm-libs:generic:json-rpc")))
  testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl:${libs.versions.log4j.get()}"
  testImplementation "com.fasterxml.jackson.core:jackson-annotations:${libs.versions.jackson.get()}"
  testImplementation "com.fasterxml.jackson.core:jackson-databind:${libs.versions.jackson.get()}"
  testImplementation "org.wiremock:wiremock:${libs.versions.wiremock.get()}"
  testImplementation project(":jvm-libs:linea:besu-rlp-and-mappers")
}

jar {
  dependsOn configurations.runtimeClasspath
}

sourceSets {
  integrationTest {
    kotlin {
      compileClasspath += main.output
      runtimeClasspath += main.output
    }
    compileClasspath += sourceSets.main.output + sourceSets.main.compileClasspath + sourceSets.test.compileClasspath
    runtimeClasspath += sourceSets.main.output + sourceSets.main.runtimeClasspath + sourceSets.test.runtimeClasspath
  }
}

task integrationTest(type: Test) { test ->
  description = "Runs integration tests."
  group = "verification"
  useJUnitPlatform()

  classpath = sourceSets.integrationTest.runtimeClasspath
  testClassesDirs = sourceSets.integrationTest.output.classesDirs

  dependsOn(":localStackComposeUp")
}
