diff --git a/build.gradle b/build.gradle index 042c5348d..57064789c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ import java.time.Duration import java.time.Instant plugins { + id 'net.consensys.zkevm.linea-contracts-helper' alias(libs.plugins.spotless) alias(libs.plugins.docker) } diff --git a/buildSrc/src/main/groovy/net.consensys.zkevm.linea-contracts-helper.gradle b/buildSrc/src/main/groovy/net.consensys.zkevm.linea-contracts-helper.gradle index e32e21ed0..7a9f1ca8f 100644 --- a/buildSrc/src/main/groovy/net.consensys.zkevm.linea-contracts-helper.gradle +++ b/buildSrc/src/main/groovy/net.consensys.zkevm.linea-contracts-helper.gradle @@ -1,16 +1,18 @@ import java.util.concurrent.TimeUnit +if (!rootProject.tasks.getNames().contains("compileContracts")) { + rootProject.tasks.register("compileContracts") { + description = "Compiles contracts." + inputs.dir("$rootDir/contracts/contracts") + outputs.cacheIf { true } -tasks.register('compileContracts') { - description = "Compiles contracts." - inputs.dir("$rootDir/contracts") - outputs.cacheIf { true } - doLast { - runRootMakefileCommand("compile-contracts", Map.of()) + doLast { + runRootMakefileCommand("compile-contracts", Map.of()) + } } } -ext.runRootMakefileCommand = { String command, Map env -> +def runRootMakefileCommand(String command, Map env) { def randomSuffix = UUID.randomUUID().toString() File outputFile = file("${command.replace(" ", "-")}-run-output-${randomSuffix}.txt") def deploymentProcessBuilder = new ProcessBuilder("make", "-C", project.rootDir.path, command) diff --git a/coordinator/ethereum/blob-submitter/build.gradle b/coordinator/ethereum/blob-submitter/build.gradle index 88db5613b..ddec526ab 100644 --- a/coordinator/ethereum/blob-submitter/build.gradle +++ b/coordinator/ethereum/blob-submitter/build.gradle @@ -3,7 +3,6 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { id 'net.consensys.zkevm.kotlin-library-conventions' - id 'net.consensys.zkevm.linea-contracts-helper' } dependencies { @@ -62,7 +61,7 @@ task integrationTest(type: Test) { testClassesDirs = sourceSets.integrationTest.output.classesDirs dependsOn(":localStackComposeUp") - dependsOn(compileContracts) + dependsOn(rootProject.tasks.compileContracts) testLogging { events TestLogEvent.FAILED, diff --git a/coordinator/ethereum/gas-pricing/static-cap/build.gradle b/coordinator/ethereum/gas-pricing/static-cap/build.gradle index f692aa776..7390d0213 100644 --- a/coordinator/ethereum/gas-pricing/static-cap/build.gradle +++ b/coordinator/ethereum/gas-pricing/static-cap/build.gradle @@ -1,6 +1,5 @@ plugins { id "net.consensys.zkevm.kotlin-library-conventions" - id 'net.consensys.zkevm.linea-contracts-helper' } dependencies { @@ -42,7 +41,7 @@ task integrationTest(type: Test) { classpath = sourceSets.integrationTest.runtimeClasspath testClassesDirs = sourceSets.integrationTest.output.classesDirs dependsOn(":localStackComposeUp") - dependsOn(compileContracts) + dependsOn(rootProject.tasks.compileContracts) } diff --git a/coordinator/ethereum/message-anchoring/build.gradle b/coordinator/ethereum/message-anchoring/build.gradle index b3a36de5e..311cc3526 100644 --- a/coordinator/ethereum/message-anchoring/build.gradle +++ b/coordinator/ethereum/message-anchoring/build.gradle @@ -1,6 +1,5 @@ plugins { id 'net.consensys.zkevm.kotlin-library-conventions' - id 'net.consensys.zkevm.linea-contracts-helper' } dependencies { @@ -44,5 +43,5 @@ task integrationTest(type: Test) { classpath = sourceSets.integrationTest.runtimeClasspath testClassesDirs = sourceSets.integrationTest.output.classesDirs dependsOn(":localStackComposeUp") - dependsOn(compileContracts) + dependsOn(rootProject.tasks.compileContracts) } diff --git a/coordinator/ethereum/test-utils/build.gradle b/coordinator/ethereum/test-utils/build.gradle index 691eb70eb..7ae6baa83 100644 --- a/coordinator/ethereum/test-utils/build.gradle +++ b/coordinator/ethereum/test-utils/build.gradle @@ -3,7 +3,6 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { id 'net.consensys.zkevm.kotlin-library-conventions' - id 'net.consensys.zkevm.linea-contracts-helper' } dependencies { @@ -42,7 +41,7 @@ task integrationTest(type: Test) { testClassesDirs = sourceSets.integrationTest.output.classesDirs dependsOn(":localStackComposeUp") - dependsOn(compileContracts) + dependsOn(rootProject.tasks.compileContracts) testLogging { events TestLogEvent.FAILED, TestLogEvent.SKIPPED,