Skip to content

Commit

Permalink
Introduced spotless checks to gradle scripts. Added publishing logic … (
Browse files Browse the repository at this point in the history
#401)

* Introduced spotless checks to gradle scripts. Added publishing logic to all the generic jvm libs. Removed redundant useJUnitPlatform()

* Removed more useJUnitPlatform()

* feat: update copyShadowJarToLocalBesu in finalized-tag-updater gradle build file

* fix: geth traces-node running in start-all local stack

---------

Co-authored-by: jonesho <[email protected]>
  • Loading branch information
Filter94 and jonesho authored Dec 6, 2024
1 parent 5cf5c52 commit c356dc4
Show file tree
Hide file tree
Showing 52 changed files with 393 additions and 387 deletions.
41 changes: 31 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ allprojects {
'-Xlint:deprecation',
])
if (!allowCompilationWarnings) {
options.compilerArgs.addAll([
'-Werror'
])
options.compilerArgs.addAll(['-Werror'])
}

if (!project.path.contains("testing-tools")) {
Expand Down Expand Up @@ -110,6 +108,13 @@ allprojects {
ktlint(libs.versions.ktlint.get().toString()).setEditorConfigPath("$rootDir/.editorconfig")
}
}
// spotless check applied to build.gradle (groovy) files
groovyGradle {
target '**/*.gradle'
greclipse()
indentWithSpaces(2)
endWithNewline()
}
}
}
}
Expand Down Expand Up @@ -143,8 +148,15 @@ dockerCompose {
// "l1-blockscout",
// "l2-blockscout"
]
composeAdditionalArgs = ["--profile", "l1", "--profile", "l2"]
useComposeFiles = ["${project.rootDir.path}/docker/compose.yml"]
composeAdditionalArgs = [
"--profile",
"l1",
"--profile",
"l2"
]
useComposeFiles = [
"${project.rootDir.path}/docker/compose.yml"
]
waitForHealthyStateTimeout = Duration.ofMinutes(3)
waitForTcpPorts = false
removeOrphans = true
Expand All @@ -157,10 +169,10 @@ dockerCompose {
}

localStackPostgresDbOnly {
startedServices = [
"postgres"
startedServices = ["postgres"]
useComposeFiles = [
"${project.rootDir.path}/docker/compose.yml"
]
useComposeFiles = ["${project.rootDir.path}/docker/compose.yml"]
waitForHealthyStateTimeout = Duration.ofMinutes(3)
waitForTcpPorts = true
removeOrphans = true
Expand All @@ -183,8 +195,17 @@ dockerCompose {
// "l1-blockscout",
// "l2-blockscout"
]
composeAdditionalArgs = ["--profile", "l1", "--profile", "l2", "--profile", "staterecover"]
useComposeFiles = ["${project.rootDir.path}/docker/compose.yml"]
composeAdditionalArgs = [
"--profile",
"l1",
"--profile",
"l2",
"--profile",
"staterecover"
]
useComposeFiles = [
"${project.rootDir.path}/docker/compose.yml"
]
waitForHealthyStateTimeout = Duration.ofMinutes(3)
waitForTcpPorts = false
removeOrphans = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/

plugins {
// Apply the common convention plugin for shared build configuration between library and application projects.
id 'net.consensys.zkevm.kotlin-common-conventions'
// Apply the common convention plugin for shared build configuration between library and application projects.
id 'net.consensys.zkevm.kotlin-common-conventions'

// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins {
id 'net.consensys.zkevm.kotlin-common-conventions'
id 'java-library'
id 'net.consensys.zkevm.kotlin-common-conventions'
id 'java-library'
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import java.time.Duration
import java.time.Instant

void downloadFileUsingWget(
String url,
String outputFilePath
String url,
String outputFilePath
) {
println("Downloading ${url} into ${outputFilePath}")

Expand All @@ -31,9 +31,9 @@ ext.architectureResourceDirMapping = [
]

private String downloadAssetIfNotPresent(
String libsZipUrl,
String releaseTag,
String outputDir
String libsZipUrl,
String releaseTag,
String outputDir
) {
def fileName = releaseTag + ".zip"
def outputFilePath = Path.of(outputDir).resolve(fileName)
Expand All @@ -55,7 +55,7 @@ private String downloadAssetIfNotPresent(
}

def getBinaryResourceFolder(
String libFile
String libFile
) {
def destResource = architectureResourceDirMapping.find {
libFile.contains(it.key.toString())
Expand All @@ -68,8 +68,8 @@ def getBinaryResourceFolder(
}

def getBinaryResourceFileName(
String libFile,
String libName
String libFile,
String libName
) {
def versionPattern = ~/v\d+\.\d+\.\d+/
def matcher = versionPattern.matcher(libFile)
Expand All @@ -82,9 +82,9 @@ def getBinaryResourceFileName(
}

def lazyUnzipWithRetry(
Path zipFile,
Path outputDir = zipFile.parent.resolve(zipFile.getFileName().toString().replaceFirst("\\.zip", "")).toString(),
Duration timeout
Path zipFile,
Path outputDir = zipFile.parent.resolve(zipFile.getFileName().toString().replaceFirst("\\.zip", "")).toString(),
Duration timeout
) {
if (outputDir.toFile().exists()) {
println("Skipping unzip, directory already exists at ${outputDir.toString()}")
Expand Down Expand Up @@ -114,51 +114,47 @@ def lazyUnzipWithRetry(
}

def extractLibToResources(
Path zipFile,
Path outputUnzipDir,
String libName
Path zipFile,
Path outputUnzipDir,
String libName
) {
lazyUnzipWithRetry(zipFile, outputUnzipDir, Duration.ofSeconds(60))
fileTree(outputUnzipDir.toFile())
.filter { it.name.contains(libName) && (it.name.endsWith(".so") || it.name.endsWith(".dylib")) }
.each { File file ->
def javaResourcesLibDir = getBinaryResourceFolder(file.name)
def destResourceFileName = getBinaryResourceFileName(file.name, libName)
def destResourcesPath = Path.of(project.layout.projectDirectory
.file("src/main/resources/${javaResourcesLibDir}").asFile.absolutePath)
def destFilePath = destResourcesPath.resolve(destResourceFileName)

if (destFilePath.toFile().exists()) {
println("Skipping: ${file} already found at ${destResourcesPath}/${destResourceFileName}")
} else {
println("Copying ${file} to ${destResourcesPath}/${destResourceFileName}")
}
copy {
from file
into destResourcesPath
rename {
destResourceFileName
.filter { it.name.contains(libName) && (it.name.endsWith(".so") || it.name.endsWith(".dylib")) }
.each { File file ->
def javaResourcesLibDir = getBinaryResourceFolder(file.name)
def destResourceFileName = getBinaryResourceFileName(file.name, libName)
def destResourcesPath = Path.of(project.layout.projectDirectory
.file("src/main/resources/${javaResourcesLibDir}").asFile.absolutePath)
def destFilePath = destResourcesPath.resolve(destResourceFileName)

if (destFilePath.toFile().exists()) {
println("Skipping: ${file} already found at ${destResourcesPath}/${destResourceFileName}")
} else {
println("Copying ${file} to ${destResourcesPath}/${destResourceFileName}")
}
copy {
from file
into destResourcesPath
rename {
destResourceFileName
}
}
}
}
}

def downloadZipReleaseAndExtractToResources(
String libsZipUrl,
String releaseTag,
String libName,
String outputDir
String libsZipUrl,
String releaseTag,
String libName,
String outputDir
) {
def zipFile = downloadAssetIfNotPresent(libsZipUrl, releaseTag, outputDir)
def outputUnzipDir = Path.of(outputDir).resolve(releaseTag)
extractLibToResources(Path.of(zipFile), outputUnzipDir, libName)
}

ext.fetchLibFromZip = {
String libsZipUrl,
String libName,
String outputDir
->
def releaseTag = libsZipUrl.split("/").last().replace(".zip", "")
downloadZipReleaseAndExtractToResources(libsZipUrl, releaseTag, libName, outputDir)
ext.fetchLibFromZip = { String libsZipUrl, String libName, String outputDir ->
def releaseTag = libsZipUrl.split("/").last().replace(".zip", "")
downloadZipReleaseAndExtractToResources(libsZipUrl, releaseTag, libName, outputDir)
}
23 changes: 16 additions & 7 deletions coordinator/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ jar {
archiveBaseName = 'coordinator'
manifest {
attributes(
'Class-Path': project.configurations.runtimeClasspath.collect { it.getName() }.findAll { it.endsWith('jar') }.join(' '),
'Main-Class': 'net.consensys.zkevm.coordinator.app.CoordinatorAppMain',
'Multi-Release': 'true'
)
'Class-Path': project.configurations.runtimeClasspath.collect { it.getName() }.findAll { it.endsWith('jar') }.join(' '),
'Main-Class': 'net.consensys.zkevm.coordinator.app.CoordinatorAppMain',
'Multi-Release': 'true'
)
}
}

Expand All @@ -103,9 +103,18 @@ run {
"-Dvertx.configurationFile=config/coordinator/vertx-options.json",
"-Dlog4j2.configurationFile=config/coordinator/log4j2-dev.xml"
] + System.properties.entrySet()
.findAll { it.key.startsWith("config") }
.collect { "-D${it.key}=${it.value}" }
args = ["--traces-limits", "config/common/traces-limits-v1.toml", "--smart-contract-errors", "config/common/smart-contract-errors.toml", "--gas-price-cap-time-of-day-multipliers", "config/common/gas-price-cap-time-of-day-multipliers.toml", "config/coordinator/coordinator-docker.config.toml", "config/coordinator/coordinator-local-dev.config.overrides.toml"]
.findAll { it.key.startsWith("config") }
.collect { "-D${it.key}=${it.value}" }
args = [
"--traces-limits",
"config/common/traces-limits-v1.toml",
"--smart-contract-errors",
"config/common/smart-contract-errors.toml",
"--gas-price-cap-time-of-day-multipliers",
"config/common/gas-price-cap-time-of-day-multipliers.toml",
"config/coordinator/coordinator-docker.config.toml",
"config/coordinator/coordinator-local-dev.config.overrides.toml"
]
}

test {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'net.consensys.zkevm.kotlin-library-conventions'
id 'net.consensys.zkevm.kotlin-library-conventions'
}

dependencies {
Expand Down
16 changes: 6 additions & 10 deletions coordinator/clients/prover-client/serialization/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ plugins {
}

dependencies {
api "com.fasterxml.jackson.core:jackson-annotations:${libs.versions.jackson.get()}"
api "com.fasterxml.jackson.core:jackson-databind:${libs.versions.jackson.get()}"
api "com.fasterxml.jackson.module:jackson-module-kotlin:${libs.versions.jackson.get()}"
api("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${libs.versions.jackson.get()}")
api(project(":jvm-libs:generic:extensions:kotlin"))
api(project(":coordinator:core"))
}

test {
useJUnitPlatform()
api "com.fasterxml.jackson.core:jackson-annotations:${libs.versions.jackson.get()}"
api "com.fasterxml.jackson.core:jackson-databind:${libs.versions.jackson.get()}"
api "com.fasterxml.jackson.module:jackson-module-kotlin:${libs.versions.jackson.get()}"
api("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${libs.versions.jackson.get()}")
api(project(":jvm-libs:generic:extensions:kotlin"))
api(project(":coordinator:core"))
}
26 changes: 11 additions & 15 deletions coordinator/clients/shomei-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@ plugins {
}

dependencies {
implementation project(':coordinator:core')
implementation project(':jvm-libs:generic:extensions:futures')
implementation project(':jvm-libs:generic:json-rpc')
implementation project(':jvm-libs:linea:metrics:micrometer')
implementation project(':jvm-libs:linea:core:traces')
implementation project(":jvm-libs:linea:teku-execution-client")
implementation "tech.pegasys.teku.internal:unsigned:${libs.versions.teku.get()}"
implementation project(':coordinator:core')
implementation project(':jvm-libs:generic:extensions:futures')
implementation project(':jvm-libs:generic:json-rpc')
implementation project(':jvm-libs:linea:metrics:micrometer')
implementation project(':jvm-libs:linea:core:traces')
implementation project(":jvm-libs:linea:teku-execution-client")
implementation "tech.pegasys.teku.internal:unsigned:${libs.versions.teku.get()}"

api "io.vertx:vertx-core"
api "io.vertx:vertx-core"

testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation "io.vertx:vertx-junit5"
testImplementation "com.github.tomakehurst:wiremock-jre8:${libs.versions.wiremock.get()}"
}

test {
useJUnitPlatform()
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation "io.vertx:vertx-junit5"
testImplementation "com.github.tomakehurst:wiremock-jre8:${libs.versions.wiremock.get()}"
}
2 changes: 1 addition & 1 deletion coordinator/clients/web3signer-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

plugins {
id 'net.consensys.zkevm.kotlin-library-conventions'
id 'net.consensys.zkevm.kotlin-library-conventions'
}

dependencies {
Expand Down
8 changes: 2 additions & 6 deletions coordinator/core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'net.consensys.zkevm.kotlin-library-conventions'
id 'java-test-fixtures'
id 'net.consensys.zkevm.kotlin-library-conventions'
id 'java-test-fixtures'
}

dependencies {
Expand Down Expand Up @@ -39,7 +39,3 @@ dependencies {
testImplementation(testFixtures(project(':jvm-libs:generic:extensions:kotlin')))
testImplementation("io.vertx:vertx-junit5")
}

test {
useJUnitPlatform()
}
Loading

0 comments on commit c356dc4

Please sign in to comment.