/*
 * Copyright Consensys Software Inc.
 *
 * This file is dual-licensed under either the MIT license or Apache License 2.0.
 * See the LICENSE-MIT and LICENSE-APACHE files in the repository root for details.
 *
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */

plugins {
  id 'java'
  id 'java-library-distribution'
  alias(libs.plugins.lombok)
  alias(libs.plugins.gradleVersions)
  alias(libs.plugins.dependencyManagement)
  alias(libs.plugins.download)
}

group = 'net.consensys.linea.besu.plugin'

def lineaSequencerProject = project(lineaSequencerProjectPath)
apply from: lineaSequencerProject.file("gradle/java.gradle")
apply from: lineaSequencerProject.file("gradle/dependency-management.gradle")
apply from: lineaSequencerProject.file('gradle/common-dependencies.gradle')
apply from: lineaSequencerProject.file("gradle/lint.gradle")

dependencies {
  // annotationProcessor generates the file META-INF/services/org.hyperledger.besu.plugin.BesuPlugin
  annotationProcessor 'com.google.auto.service:auto-service'
  compileOnly 'com.google.auto.service:auto-service'

  api "build.linea:blob-compressor:${libs.versions.blobCompressor.get()}"
  api "build.linea.internal:kotlin:${libs.versions.lineaKotlin.get()}"

  implementation "${besuArtifactGroup}:besu-datatypes"
  implementation "${besuArtifactGroup}:besu-evm"
  implementation "${besuArtifactGroup}:besu-plugin-api"
  implementation "${besuArtifactGroup}.internal:besu-crypto-algorithms"
  implementation "${besuArtifactGroup}.internal:besu-ethereum-api"
  implementation "${besuArtifactGroup}.internal:besu-ethereum-core"
  implementation "${besuArtifactGroup}.internal:besu-ethereum-eth"
  implementation "${besuArtifactGroup}.internal:besu-ethereum-rlp"

  implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'

  implementation 'com.github.ben-manes.caffeine:caffeine'

  implementation 'com.google.code.gson:gson'

  implementation "io.consensys.tuweni:tuweni-bytes"
  implementation "io.consensys.tuweni:tuweni-units"
  implementation "io.consensys.tuweni:tuweni-toml"

  implementation 'info.picocli:picocli'

  implementation 'net.consensys.linea.zktracer:arithmetization'

  implementation 'org.hibernate.validator:hibernate-validator'

  testImplementation "${besuArtifactGroup}.internal:besu-app"
  testImplementation group: "${besuArtifactGroup}.internal", name: "besu-ethereum-core", classifier: "test-support"

  testImplementation 'org.awaitility:awaitility'
}

apply from: lineaSequencerProject.file("gradle/dist.gradle")

// Simple artifacts task that runs jar and distPlugin
task artifacts {
  group = 'Build'
  description = 'Creates all build artifacts (JAR and distribution ZIP)'
  dependsOn 'jar', 'distPlugin'
}

test {
  useJUnitPlatform()
  // Disable parallel execution for this module due to WireMock test interference
  systemProperty "junit.jupiter.execution.parallel.enabled", "false"
}
