diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c08fc5876..9ee1e1b5b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,7 +11,12 @@ updates: schedule: interval: daily - - package-ecosystem: "gradle" - directory: "/" + - package-ecosystem: gradle + directory: /hiero-dependency-versions schedule: - interval: "weekly" \ No newline at end of file + interval: weekly + + - package-ecosystem: gradle + directory: / + schedule: + interval: weekly \ No newline at end of file diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 04a767b98..716804869 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ## + name: "PR Gradle Checks" on: push: @@ -74,15 +75,15 @@ jobs: - name: Build id: gradle-build - run: ${GRADLE_EXEC} build + run: ${GRADLE_EXEC} assemble --scan - name: Style Check id: spotless-check - run: ${GRADLE_EXEC} spotlessCheck + run: ${GRADLE_EXEC} qualityCheck --continue --scan - name: Unit Tests id: unit-tests - run: ${GRADLE_EXEC} check + run: ${GRADLE_EXEC} check --scan - name: Upload coverage report uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 3bd71c4cd..000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("com.hedera.block.root") -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index d9fff832f..000000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { `kotlin-dsl` } - -repositories { gradlePluginPortal() } - -dependencies { - implementation("com.adarshr:gradle-test-logger-plugin:4.0.0") - implementation("com.autonomousapps:dependency-analysis-gradle-plugin:1.32.0") - implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0") - implementation("com.google.protobuf:protobuf-gradle-plugin:0.9.4") - implementation("com.gradle.publish:plugin-publish-plugin:1.2.1") - implementation("gradle.plugin.lazy.zoo.gradle:git-data-plugin:1.2.2") - implementation("io.github.gradle-nexus:publish-plugin:1.3.0") - implementation("me.champeau.jmh:jmh-gradle-plugin:0.7.2") - implementation("net.swiftzer.semver:semver:1.3.0") - implementation("org.gradlex:extra-java-module-info:1.8") - implementation("org.gradlex:jvm-dependency-conflict-resolution:2.0") - implementation("org.gradlex:java-module-dependencies:1.6.5") -} diff --git a/buildSrc/src/main/kotlin/Utils.kt b/buildSrc/src/main/kotlin/Utils.kt deleted file mode 100644 index f6ce8f4bf..000000000 --- a/buildSrc/src/main/kotlin/Utils.kt +++ /dev/null @@ -1,83 +0,0 @@ -import net.swiftzer.semver.SemVer -import org.gradle.api.Project -import java.io.File -import java.io.OutputStream -import java.io.PrintStream - -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -class Utils { - companion object { - @JvmStatic - fun updateVersion(project: Project, newVersion: SemVer) { - val gradlePropFile = File(project.projectDir, "gradle.properties") - var lines: List = mutableListOf() - - if (gradlePropFile.exists()) { - lines = gradlePropFile.readLines(Charsets.UTF_8) - } - - var versionStr = "version=$newVersion" - val finalLines: List - - - if (lines.isNotEmpty()) { - finalLines = lines.map { - if (it.trimStart().startsWith("version=")) { - versionStr - } else { - it - } - } - } else { - finalLines = listOf(versionStr) - } - - - gradlePropFile.bufferedWriter(Charsets.UTF_8).use { - val writer = it - finalLines.forEach { - writer.write(it) - writer.newLine() - } - writer.flush() - } - } - - @JvmStatic - fun generateProjectVersionReport(rootProject: Project, ostream: OutputStream) { - val writer = PrintStream(ostream, false, Charsets.UTF_8) - - ostream.use { - writer.use { - // Writer headers - writer.println("### Deployed Version Information") - writer.println() - writer.println("| Artifact Name | Version Number |") - writer.println("| --- | --- |") - - // Write table rows - rootProject.childProjects.values.onEach { - writer.printf("| %s | %s |\n", it.name, it.version.toString()) - } - writer.flush() - ostream.flush() - } - } - } - } -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.aggregate-reports.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.aggregate-reports.gradle.kts deleted file mode 100644 index 0a3a6a386..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.aggregate-reports.gradle.kts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import java.io.BufferedOutputStream -import net.swiftzer.semver.SemVer - -plugins { id("lazy.zoo.gradle.git-data-plugin") } - -tasks.register("githubVersionSummary") { - group = "github" - doLast { - val ghStepSummaryPath: String = - System.getenv("GITHUB_STEP_SUMMARY") - ?: throw IllegalArgumentException( - "This task may only be run in a Github Actions CI environment! Unable to locate the GITHUB_STEP_SUMMARY environment variable." - ) - - val ghStepSummaryFile = File(ghStepSummaryPath) - Utils.generateProjectVersionReport( - rootProject, - BufferedOutputStream(ghStepSummaryFile.outputStream()) - ) - } -} - -tasks.register("showVersion") { - group = "versioning" - doLast { println(project.version) } -} - -tasks.register("versionAsPrefixedCommit") { - group = "versioning" - doLast { - gitData.lastCommitHash?.let { - val prefix = findProperty("commitPrefix")?.toString() ?: "adhoc" - val newPrerel = prefix + ".x" + it.take(8) - val currVer = SemVer.parse(project.version.toString()) - try { - val newVer = SemVer(currVer.major, currVer.minor, currVer.patch, newPrerel) - Utils.updateVersion(project, newVer) - } catch (e: java.lang.IllegalArgumentException) { - throw IllegalArgumentException(String.format("%s: %s", e.message, newPrerel), e) - } - } - } -} - -tasks.register("versionAsSnapshot") { - group = "versioning" - doLast { - val currVer = SemVer.parse(project.version.toString()) - val newVer = SemVer(currVer.major, currVer.minor, currVer.patch, "SNAPSHOT") - - Utils.updateVersion(project, newVer) - } -} - -tasks.register("versionAsSpecified") { - group = "versioning" - doLast { - val verStr = - providers.gradleProperty("newVersion").orNull - ?: throw IllegalArgumentException( - "No newVersion property provided! Please add the parameter -PnewVersion= when running this task." - ) - - val newVer = SemVer.parse(verStr) - Utils.updateVersion(project, newVer) - } -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.common.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.common.gradle.kts deleted file mode 100644 index 5fdfbba27..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.common.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("java-library") - id("com.hedera.block.conventions") - id("me.champeau.jmh") -} - -val maven = publishing.publications.create("maven") { from(components["java"]) } - -signing.sign(maven) diff --git a/buildSrc/src/main/kotlin/com.hedera.block.conventions.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.conventions.gradle.kts deleted file mode 100644 index 9b053e332..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.conventions.gradle.kts +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.adarshr.gradle.testlogger.theme.ThemeType - -plugins { - id("java") - id("jacoco") - id("org.gradlex.java-module-dependencies") - id("com.adarshr.test-logger") - id("com.hedera.block.repositories") - id("com.hedera.block.jpms-modules") - id("com.hedera.block.spotless-conventions") - id("com.hedera.block.spotless-java-conventions") - id("com.hedera.block.spotless-kotlin-conventions") - id("com.hedera.block.maven-publish") -} - -group = "com.hedera.block" - -val javaVersionMajor = JavaVersion.VERSION_21 -val javaVersionPatch = "0.4" - -val currentJavaVersionMajor = JavaVersion.current() -val currentJavaVersion = providers.systemProperty("java.version").get() -val expectedJavaVersion = "$javaVersionMajor.$javaVersionPatch" - -if (currentJavaVersion != expectedJavaVersion) { - val message = - "Gradle runs with Java $currentJavaVersion. This project works best running with Java $expectedJavaVersion. " + - "\n - From commandline: change JAVA_HOME and/or PATH to point at Java $expectedJavaVersion installation." + - "\n - From IntelliJ: change 'Gradle JVM' in 'Gradle Settings' to point at Java $expectedJavaVersion installation." - - if (currentJavaVersionMajor.ordinal < javaVersionMajor.ordinal) { // fail if version is too old - throw (RuntimeException(message)) - } else { - logger.lifecycle("WARN: $message") - } -} - -java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 - toolchain { - languageVersion.set(JavaLanguageVersion.of(21)) - vendor.set(JvmVendorSpec.ADOPTIUM) - } - - // Enable JAR file generation required for publishing - withJavadocJar() - withSourcesJar() -} - -testing { - @Suppress("UnstableApiUsage") suites.getByName("test") { useJUnitJupiter() } -} - -tasks.withType { - isPreserveFileTimestamps = false - isReproducibleFileOrder = true - filePermissions { unix("0664") } - dirPermissions { unix("0775") } -} - -val deactivatedCompileLintOptions = - listOf( - // In Gradle, a module does not see the upstream (not-yet-compiled) modules. This could - // only be solved by calling 'javac' with '--source-module-path' to make other sources - // known. But this is at odds with how Gradle's incremental compilation calls the - // compiler for a subset of Java files for each project individually. - "module", // module not found when doing 'exports to ...' - "serial", // serializable class ... has no definition of serialVersionUID - "processing", // No processor claimed any of these annotations: ... - "try", // auto-closeable resource ignore is never referenced... (AutoClosableLock) - "missing-explicit-ctor", // class ... declares no explicit constructors - - // Needed because we use deprecation internally and do not fix all uses right away - "removal", - "deprecation", - - // The following checks could be activated and fixed: - "this-escape", // calling public/protected method in constructor - "overrides", // overrides equals, but neither it ... overrides hashCode method - "unchecked", - "rawtypes" - ) - -tasks.withType().configureEach { - // Track the full Java version as input (e.g. 17.0.3 vs. 17.0.9). - // By default, Gradle only tracks the major version as defined in the toolchain (e.g. 17). - // Since the full version is encoded in 'module-info.class' files, it should be tracked as - // it otherwise leads to wrong build cache hits. - inputs.property("fullJavaVersion", currentJavaVersion) - - options.encoding = "UTF-8" - options.isFork = true // run compiler in separate JVM process (independent of toolchain setup) - options.compilerArgs.add("-implicit:none") - - doLast { - // Make sure consistent line ending are used in files generated by annotation processors by - // rewriting generated files. - // To fix this problem at the root, one of these issues needs to be addressed upstream: - // - https://github.com/google/auto/issues/1656 - // - https://github.com/gradle/gradle/issues/27385 - if (System.lineSeparator() != "\n") { - destinationDirectory - .get() - .asFileTree - .filter { it.extension != "class" } - .forEach { - val content = it.readText() - val normalizedContent = content.replace(System.lineSeparator(), "\n") - if (content != normalizedContent) { - it.writeText(normalizedContent) - } - } - } - } -} - -tasks.withType().configureEach { - options { - this as StandardJavadocDocletOptions - encoding = "UTF-8" - tags( - "apiNote:a:API Note:", - "implSpec:a:Implementation Requirements:", - "implNote:a:Implementation Note:" - ) - options.windowTitle = "Hedera Block Node" - options.memberLevel = JavadocMemberLevel.PACKAGE - // Commenting this so we still get missing javadocs warnings - // addStringOption("Xdoclint:all,-missing", "-Xwerror") - } -} - -testlogger { - theme = ThemeType.MOCHA - slowThreshold = 10000 - showStandardStreams = true - showPassedStandardStreams = false - showSkippedStandardStreams = false - showFailedStandardStreams = true -} - -// Ensure JaCoCo coverage is generated and aggregated -tasks.jacocoTestReport.configure { - reports { - xml.required.set(true) - html.required.set(true) - } - - val testExtension = tasks.test.get().extensions.getByType() - executionData.setFrom(testExtension.destinationFile) - - shouldRunAfter(tasks.named("check")) -} - -tasks.check { - // Ensure the check task also runs the JaCoCo coverage report - dependsOn(tasks.jacocoTestReport) - // Check dependency scopes in module-info.java - dependsOn(tasks.checkAllModuleInfo) -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.jpms-modules.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.jpms-modules.gradle.kts deleted file mode 100644 index 14ae2e6c5..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.jpms-modules.gradle.kts +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2016-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("org.gradlex.jvm-dependency-conflict-resolution") - id("org.gradlex.extra-java-module-info") -} - -// Fix or enhance the metadata of third-party Modules. This is about the metadata in the -// repositories: '*.pom' and '*.module' files. -jvmDependencyConflicts.patch { - // These compile time annotation libraries are not of interest in our setup and are thus removed - // from the dependencies of all components that bring them in. - val annotationLibraries = - listOf( - "com.google.android:annotations", - "com.google.code.findbugs:annotations", - "com.google.code.findbugs:jsr305", - "com.google.errorprone:error_prone_annotations", - "com.google.guava:listenablefuture", - "org.checkerframework:checker-compat-qual", - "org.checkerframework:checker-qual", - "org.codehaus.mojo:animal-sniffer-annotations" - ) - - module("io.grpc:grpc-netty-shaded") { annotationLibraries.forEach { removeDependency(it) } } - - module("io.grpc:grpc-api") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-core") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-context") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-protobuf") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-protobuf-lite") { - annotationLibraries.forEach { removeDependency(it) } - removeDependency(/* dependency = */ "com.google.protobuf:protobuf-javalite") - addApiDependency("com.google.protobuf:protobuf-java") - } - module("io.grpc:grpc-services") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-stub") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-testing") { annotationLibraries.forEach { removeDependency(it) } } - module("io.grpc:grpc-util") { annotationLibraries.forEach { removeDependency(it) } } - module("com.google.dagger:dagger-compiler") { - annotationLibraries.forEach { removeDependency(it) } - } - module("com.google.dagger:dagger-producers") { - annotationLibraries.forEach { removeDependency(it) } - } - module("com.google.dagger:dagger-spi") { annotationLibraries.forEach { removeDependency(it) } } - module("com.google.guava:guava") { - (annotationLibraries - - "com.google.code.findbugs:jsr305" - - "com.google.errorprone:error_prone_annotations" - - "org.checkerframework:checker-qual") - .forEach { removeDependency(it) } - } - module("com.google.protobuf:protobuf-java-util") { - annotationLibraries.forEach { removeDependency(it) } - } - module("io.prometheus:simpleclient") { - removeDependency("io.prometheus:simpleclient_tracer_otel") - removeDependency("io.prometheus:simpleclient_tracer_otel_agent") - } - module("org.jetbrains.kotlin:kotlin-stdlib") { - removeDependency("org.jetbrains.kotlin:kotlin-stdlib-common") - } - module("junit:junit") { removeDependency("org.hamcrest:hamcrest-core") } - module("org.hyperledger.besu:secp256k1") { addApiDependency("net.java.dev.jna:jna") } -} - -// Fix or enhance the 'module-info.class' of third-party Modules. This is about the -// 'module-info.class' inside the Jar files. In our full Java Modules setup every -// Jar needs to have this file. If it is missing, it is added by what is configured here. -extraJavaModuleInfo { - failOnAutomaticModules = true // Only allow Jars with 'module-info' on all module paths - - module("io.grpc:grpc-api", "io.grpc") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - uses("io.grpc.ManagedChannelProvider") - uses("io.grpc.NameResolverProvider") - uses("io.grpc.LoadBalancerProvider") - } - - module("io.grpc:grpc-core", "io.grpc.internal") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("io.grpc:grpc-context", "io.grpc.context") - module("io.grpc:grpc-stub", "io.grpc.stub") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("io.grpc:grpc-testing", "io.grpc.testing") - module("io.grpc:grpc-services", "io.grpc.services") - module("io.grpc:grpc-util", "io.grpc.util") - module("io.grpc:grpc-protobuf", "io.grpc.protobuf") - module("io.grpc:grpc-protobuf-lite", "io.grpc.protobuf.lite") - - module("io.grpc:grpc-netty-shaded", "io.grpc.netty.shaded") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - requires("jdk.unsupported") - ignoreServiceProvider("reactor.blockhound.integration.BlockHoundIntegration") - } - - module("com.github.spotbugs:spotbugs-annotations", "com.github.spotbugs.annotations") - module("com.google.code.findbugs:jsr305", "java.annotation") { - exportAllPackages() - mergeJar("javax.annotation:javax.annotation-api") - } - module("com.google.errorprone:error_prone_annotations", "com.google.errorprone.annotations") - module("com.google.j2objc:j2objc-annotations", "com.google.j2objc.annotations") - module("com.google.protobuf:protobuf-java", "com.google.protobuf") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("com.google.guava:guava", "com.google.common") { - exportAllPackages() - requireAllDefinedDependencies() - requires("java.logging") - } - module("com.google.guava:failureaccess", "com.google.common.util.concurrent.internal") - module("com.google.api.grpc:proto-google-common-protos", "com.google.api.grpc.common") - module("com.google.dagger:dagger", "dagger") - module("io.perfmark:perfmark-api", "io.perfmark") - module("javax.inject:javax.inject", "javax.inject") - - module("commons-codec:commons-codec", "org.apache.commons.codec") - module("org.apache.commons:commons-math3", "org.apache.commons.math3") - module("org.apache.commons:commons-collections4", "org.apache.commons.collections4") - module("com.esaulpaugh:headlong", "headlong") - - module("org.checkerframework:checker-qual", "org.checkerframework.checker.qual") - module("net.i2p.crypto:eddsa", "net.i2p.crypto.eddsa") - module("org.jetbrains:annotations", "org.jetbrains.annotations") - module("org.antlr:antlr4-runtime", "org.antlr.antlr4.runtime") - - // needed for metrics and logging, but also several platform classes - module("com.goterl:resource-loader", "resource.loader") - module("com.goterl:lazysodium-java", "lazysodium.java") - module("org.hyperledger.besu:secp256k1", "org.hyperledger.besu.nativelib.secp256k1") - module("net.java.dev.jna:jna", "com.sun.jna") { - exportAllPackages() - requires("java.logging") - } - module("io.prometheus:simpleclient", "io.prometheus.simpleclient") - module("io.prometheus:simpleclient_common", "io.prometheus.simpleclient_common") - module("io.prometheus:simpleclient_httpserver", "io.prometheus.simpleclient.httpserver") { - exportAllPackages() - requireAllDefinedDependencies() - requires("jdk.httpserver") - } - - // Annotation processing only - module("com.google.auto.service:auto-service-annotations", "com.google.auto.service") - module("com.google.auto.service:auto-service", "com.google.auto.service.processor") - module("com.google.auto:auto-common", "com.google.auto.common") - module("com.google.dagger:dagger-compiler", "dagger.compiler") - module("com.google.dagger:dagger-producers", "dagger.producers") - module("com.google.dagger:dagger-spi", "dagger.spi") - module( - "com.google.devtools.ksp:symbol-processing-api", - "com.google.devtools.ksp.symbolprocessingapi" - ) - module("com.google.errorprone:javac-shaded", "com.google.errorprone.javac.shaded") - module("com.google.googlejavaformat:google-java-format", "com.google.googlejavaformat") - module("net.ltgt.gradle.incap:incap", "net.ltgt.gradle.incap") - module("org.jetbrains.kotlinx:kotlinx-metadata-jvm", "kotlinx.metadata.jvm") - - // Test clients only - module("com.github.docker-java:docker-java-api", "com.github.dockerjava.api") - module("com.github.docker-java:docker-java-transport", "com.github.dockerjava.transport") - module( - "com.github.docker-java:docker-java-transport-zerodep", - "com.github.dockerjava.transport.zerodep" - ) - module("io.github.cdimascio:java-dotenv", "io.github.cdimascio") - module("com.google.protobuf:protobuf-java-util", "com.google.protobuf.util") - module("com.squareup:javapoet", "com.squareup.javapoet") { - exportAllPackages() - requires("java.compiler") - } - module("junit:junit", "junit") - module("org.hamcrest:hamcrest", "org.hamcrest") - module("org.json:json", "org.json") - module("org.mockito:mockito-core", "org.mockito") - module("org.objenesis:objenesis", "org.objenesis") - module("org.rnorth.duct-tape:duct-tape", "org.rnorth.ducttape") - module("org.testcontainers:junit-jupiter", "org.testcontainers.junit.jupiter") - module("org.testcontainers:testcontainers", "org.testcontainers") - module("org.mockito:mockito-junit-jupiter", "org.mockito.junit.jupiter") -} - -// Make 'javax.annotation:javax.annotation-api' discoverable for merging it into -// 'com.google.code.findbugs:jsr305' -dependencies { "javaModulesMergeJars"("javax.annotation:javax.annotation-api:1.3.2") } diff --git a/buildSrc/src/main/kotlin/com.hedera.block.maven-publish.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.maven-publish.gradle.kts deleted file mode 100644 index 4e6aaabfd..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.maven-publish.gradle.kts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("java") - id("maven-publish") - id("signing") -} - -publishing { - publications.withType().configureEach { - pom { - packaging = findProperty("maven.project.packaging")?.toString() ?: "jar" - name.set(project.name) - url.set("https://www.hedera.com/") - inceptionYear.set("2024") - - description.set( - "An implementation of a Block Node for the Hedera public distributed ledger." - ) - - organization { - name.set("Hedera Hashgraph, LLC") - url.set("https://www.hedera.com") - } - - licenses { - license { - name.set("Apache 2.0 License") - url.set("https://raw.githubusercontent.com/hashgraph/pbj/main/LICENSE") - } - } - - developers { - developer { - name.set("Jasper Potts") - email.set("jasper.potts@swirldslabs.com") - organization.set("Swirlds Labs, Inc.") - organizationUrl.set("https://www.swirldslabs.com") - } - } - - scm { - connection.set("scm:git:git://github.com/hashgraph/hedera-block-node.git") - developerConnection.set("scm:git:ssh://github.com:hashgraph/hedera-block-node.git") - url.set("https://github.com/hashgraph/hedera-block-node") - } - } - } -} - -signing { useGpgCmd() } - -tasks.withType { - onlyIf { providers.gradleProperty("publishSigningEnabled").getOrElse("false").toBoolean() } -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.protobuf.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.protobuf.gradle.kts deleted file mode 100644 index 359e50c5c..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.protobuf.gradle.kts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.google.protobuf.gradle.id -import com.hedera.block.tasks.GitClone - -plugins { - id("java-library") - id("com.hedera.block.conventions") - id("com.google.protobuf") -} - -tasks.register("cloneHederaProtobufs") { - url = "https://github.com/hashgraph/hedera-protobufs.git" - offline = gradle.startParameter.isOffline - localCloneDirectory = layout.buildDirectory.dir("hedera-protobufs") -} - -// Configure Protobuf Plugin to download protoc executable rather than using local installed version -protobuf { - val libs = the().named("libs") - protoc { artifact = "com.google.protobuf:protoc:" + libs.findVersion("google.proto").get() } - plugins { - // Add GRPC plugin as we need to generate GRPC services - id("grpc") { - artifact = - "io.grpc:protoc-gen-grpc-java:" + libs.findVersion("grpc.protobuf.grpc").get() - } - } - generateProtoTasks { all().forEach { it.plugins { id("grpc") } } } -} - -tasks.javadoc { - options { - this as StandardJavadocDocletOptions - // There are violations in the generated protobuf code - addStringOption("Xdoclint:-reference,-html", "-quiet") - } -} - -// Give JUnit more ram and make it execute tests in parallel -tasks.test { - // We are running a lot of tests 10s of thousands, so they need to run in parallel. Make each - // class run in parallel. - systemProperties["junit.jupiter.execution.parallel.enabled"] = true - systemProperties["junit.jupiter.execution.parallel.mode.default"] = "concurrent" - // limit amount of threads, so we do not use all CPU - systemProperties["junit.jupiter.execution.parallel.config.dynamic.factor"] = "0.9" -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.protos.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.protos.gradle.kts deleted file mode 100644 index 291f89918..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.protos.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id("java") - id("com.google.protobuf") - id("com.hedera.block.conventions") -} - -sourceSets { - main { - proto { - srcDir("src/main/protobuf") - } - } -} - -protobuf { - // Configure the protoc executable - protoc { - // Download from repositories - artifact = "com.google.protobuf:protoc:3.21.10" - } -} - diff --git a/buildSrc/src/main/kotlin/com.hedera.block.repositories.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.repositories.gradle.kts deleted file mode 100644 index 6db244ccd..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.repositories.gradle.kts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -repositories { - mavenCentral() - maven { - url = uri("https://hyperledger.jfrog.io/artifactory/besu-maven") - content { includeGroupByRegex("org\\.hyperledger\\..*") } - } -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.root.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.root.gradle.kts deleted file mode 100644 index fbfa2c467..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.root.gradle.kts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import io.github.gradlenexus.publishplugin.CloseNexusStagingRepository - -plugins { - id("com.hedera.block.repositories") - id("com.hedera.block.aggregate-reports") - id("com.hedera.block.spotless-conventions") - id("com.hedera.block.spotless-kotlin-conventions") - id("com.autonomousapps.dependency-analysis") - id("io.github.gradle-nexus.publish-plugin") -} - -group = "com.hedera.block" - -spotless { kotlinGradle { target("buildSrc/**/*.gradle.kts") } } - -nexusPublishing { - repositories { - sonatype { - username = System.getenv("OSSRH_USERNAME") - password = System.getenv("OSSRH_PASSWORD") - } - } -} - -tasks.withType { - // The publishing of all components to Maven Central (in this case only 'pbj-runtime') is - // automatically done before close (which is done before release). - dependsOn(":server:publishToSonatype") -} - -tasks.register("release") { - group = "release" - dependsOn(tasks.closeAndReleaseStagingRepository) -} - -tasks.register("releaseSnapshot") { - group = "release" - dependsOn(":server:publishToSonatype") -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.server.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.server.gradle.kts deleted file mode 100644 index 5bb202c3b..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.server.gradle.kts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("application") - id("com.hedera.block.conventions") - id("me.champeau.jmh") -} - -val maven = publishing.publications.create("maven") { from(components["java"]) } - -signing.sign(maven) - diff --git a/buildSrc/src/main/kotlin/com.hedera.block.simulator.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.simulator.gradle.kts deleted file mode 100644 index f5361b330..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.simulator.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("application") - id("com.hedera.block.conventions") - id("me.champeau.jmh") -} - -val maven = publishing.publications.create("maven") { from(components["java"]) } - -signing.sign(maven) diff --git a/buildSrc/src/main/kotlin/com.hedera.block.spotless-conventions.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.spotless-conventions.gradle.kts deleted file mode 100644 index f83772726..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.spotless-conventions.gradle.kts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { id("com.diffplug.spotless") } - -spotless { - // Disable strong enforcement during gradle check tasks - isEnforceCheck = false - - // optional: limit format enforcement to just the files changed by this feature branch - ratchetFrom("origin/main") - - format("misc") { - // define the files to apply `misc` to - target("*.gradle", "*.md", ".gitignore") - - // define the steps to apply to those files - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - } - - format("actionYaml") { - target(".github/workflows/*.yaml") - - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - - licenseHeader( - """ - ## - # Copyright (C) ${'$'}YEAR Hedera Hashgraph, LLC - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - ## - """ - .trimIndent(), - "(name|on)" - ) - } -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.spotless-java-conventions.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.spotless-java-conventions.gradle.kts deleted file mode 100644 index 89ce27de3..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.spotless-java-conventions.gradle.kts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { id("com.diffplug.spotless") } - -spotless { - java { - targetExclude("build/generated/**/*.java", "build/generated/**/*.proto") - // Enables the spotless:on and spotless:off comments - toggleOffOn() - // don't need to set target, it is inferred from java - // apply a specific flavor of palantir-java-format - // and do not format javadoc because the default setup - // is _very_ bad for javadoc. We need to figure out a - // "correct" _separate_ setup for that. - palantirJavaFormat("2.50.0").formatJavadoc(false) - // Fix some left-out items from the palantir plugin - indentWithSpaces(4) - trimTrailingWhitespace() - endWithNewline() - // make sure every file has the following copyright header. - // optionally, Spotless can set copyright years by digging - // through git history (see "license" section below). - // The delimiter override below is required to support some - // of our test classes which are in the default package. - licenseHeader( - """ - /* - * Copyright (C) ${'$'}YEAR Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */${"\n\n"} - """ - .trimIndent(), - "(package|import)" - ) - } -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.spotless-kotlin-conventions.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.spotless-kotlin-conventions.gradle.kts deleted file mode 100644 index 430a8944f..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.spotless-kotlin-conventions.gradle.kts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { id("com.diffplug.spotless") } - -spotless { - kotlinGradle { - ktfmt().kotlinlangStyle() - - licenseHeader( - """ - /* - * Copyright (C) ${'$'}YEAR Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */${"\n\n"} - """ - .trimIndent(), - "(import|plugins|repositories)", - ) - } -} diff --git a/buildSrc/src/main/kotlin/com.hedera.block.tools.gradle.kts b/buildSrc/src/main/kotlin/com.hedera.block.tools.gradle.kts deleted file mode 100644 index 0779a3619..000000000 --- a/buildSrc/src/main/kotlin/com.hedera.block.tools.gradle.kts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id("application") - id("com.hedera.block.conventions") - id("me.champeau.jmh") -} diff --git a/buildSrc/src/main/kotlin/com/hedera/block/tasks/GitClone.kt b/buildSrc/src/main/kotlin/com/hedera/block/tasks/GitClone.kt deleted file mode 100644 index d47c11dc6..000000000 --- a/buildSrc/src/main/kotlin/com/hedera/block/tasks/GitClone.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hedera.block.tasks - -import javax.inject.Inject -import org.gradle.api.DefaultTask -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.Optional -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.TaskAction -import org.gradle.process.ExecOperations - -abstract class GitClone : DefaultTask() { - - @get:Input abstract val url: Property - - @get:Input @get:Optional abstract val tag: Property - - @get:Input @get:Optional abstract val branch: Property - - @get:Input abstract val offline: Property - - @get:OutputDirectory abstract val localCloneDirectory: DirectoryProperty - - @get:Inject protected abstract val exec: ExecOperations - - init { - // If a 'branch' is configured, the task is never up-to-date as it may change - outputs.upToDateWhen { !branch.isPresent } - } - - @TaskAction - fun cloneOrUpdate() { - if (!tag.isPresent && !branch.isPresent || tag.isPresent && branch.isPresent) { - throw RuntimeException("Define either 'tag' or 'branch'") - } - - val localClone = localCloneDirectory.get() - if (!offline.get()) { - exec.exec { - if (!localClone.dir(".git").asFile.exists()) { - workingDir = localClone.asFile.parentFile - commandLine( - "git", - "clone", - url.get(), - "-q" - ) - } else { - workingDir = localClone.asFile - commandLine("git", "fetch", "-q") - } - } - } - if (tag.isPresent) { - exec.exec { - workingDir = localClone.asFile - commandLine("git", "checkout", tag.get(), "-q") - } - exec.exec { - workingDir = localClone.asFile - commandLine("git", "reset", "--hard", tag.get(), "-q") - } - } else { - exec.exec { - workingDir = localClone.asFile - commandLine("git", "checkout", branch.get(), "-q") - } - exec.exec { - workingDir = localClone.asFile - commandLine("git", "reset", "--hard", "origin/${branch.get()}", "-q") - } - } - } -} diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 59f22acc5..a9785a8ac 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -14,13 +14,14 @@ * limitations under the License. */ -plugins { - id("java-library") - id("com.hedera.block.common") -} +plugins { id("org.hiero.gradle.module.library") } description = "Commons module with logic that could be abstracted and reused." +// Remove the following line to enable all 'javac' lint checks that we have turned on by default +// and then fix the reported issues. +tasks.withType().configureEach { options.compilerArgs.add("-Xlint:-exports") } + testModuleInfo { requiresStatic("com.github.spotbugs.annotations") requires("org.junit.jupiter.api") diff --git a/gradle.properties b/gradle.properties index 5ac5f9e14..4fac13161 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ -# Version number -version=0.3.0-SNAPSHOT - # Need increased heap for running Gradle itself, or SonarQube will run the JVM out of metaspace -org.gradle.jvmargs=-Xmx2048m +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -# Enable Gradle Caching +# Enable Gradle caching +org.gradle.configuration-cache=true org.gradle.caching=true + +# Enable parallel workers org.gradle.parallel=true # Disable publish signing by default diff --git a/buildSrc/src/main/kotlin/com.hedera.block.suites.gradle.kts b/gradle/aggregation/build.gradle.kts similarity index 69% rename from buildSrc/src/main/kotlin/com.hedera.block.suites.gradle.kts rename to gradle/aggregation/build.gradle.kts index f5361b330..a68ece888 100644 --- a/buildSrc/src/main/kotlin/com.hedera.block.suites.gradle.kts +++ b/gradle/aggregation/build.gradle.kts @@ -15,11 +15,13 @@ */ plugins { - id("application") - id("com.hedera.block.conventions") - id("me.champeau.jmh") + id("org.hiero.gradle.report.code-coverage") + id("org.hiero.gradle.check.spotless") + id("org.hiero.gradle.check.spotless-kotlin") } -val maven = publishing.publications.create("maven") { from(components["java"]) } - -signing.sign(maven) +dependencies { + implementation(project(":server")) + implementation(project(":simulator")) + implementation(project(":suites")) +} diff --git a/gradle/license-header.txt b/gradle/license-header.txt new file mode 100644 index 000000000..2e707c37f --- /dev/null +++ b/gradle/license-header.txt @@ -0,0 +1,13 @@ +Copyright (C) $YEAR Hedera Hashgraph, LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/gradle/modules.properties b/gradle/modules.properties deleted file mode 100644 index 1aa3f5dd0..000000000 --- a/gradle/modules.properties +++ /dev/null @@ -1,53 +0,0 @@ -com.swirlds.metrics.api=com.swirlds:swirlds-metrics-api -com.swirlds.metrics.impl=com.swirlds:swirlds-metrics-impl -com.swirlds.common=com.swirlds:swirlds-common -com.swirlds.config.impl=com.swirlds:swirlds-config-impl -com.swirlds.config.extensions=com.swirlds:swirlds-config-extensions -com.swirlds.config.processor=com.swirlds:swirlds-config-processor -com.google.auto.service=com.google.auto.service:auto-service-annotations -com.google.auto.service.processor=com.google.auto.service:auto-service -com.google.auto.common=com.google.auto:auto-common -com.github.spotbugs.annotations=com.github.spotbugs:spotbugs-annotations -com.lmax.disruptor=com.lmax:disruptor -io.helidon.webserver=io.helidon.webserver:helidon-webserver - -io.helidon.webserver.testing.junit5=io.helidon.webserver.testing.junit5:helidon-webserver-testing-junit5 -io.helidon.logging=io.helidon.logging:helidon-logging-jul -org.antlr.antlr4.runtime=org.antlr:antlr4-runtime -com.google.common=com.google.guava:guava - -com.hedera.pbj.runtime=com.hedera.pbj:pbj-runtime -com.hedera.pbj.grpc.helidon=com.hedera.pbj:pbj-grpc-helidon -com.hedera.pbj.grpc.helidon.config=com.hedera.pbj:pbj-grpc-helidon-config - -google.proto=com.google.protobuf:protoc -io.grpc=io.grpc:grpc-api -io.grpc.protobuf=io.grpc:grpc-protobuf -io.grpc.stub=io.grpc:grpc-stub -io.grpc.netty.shaded=io.grpc:grpc-netty-shaded - -com.google.protobuf=com.google.protobuf:protobuf-java -com.google.protobuf.util=com.google.protobuf:protobuf-java-util -com.apache.commons.codec=commons-codec:commons-codec -org.apache.commons.collections4=org.apache.commons:commons-collections4 -org.apache.commons.io=commons-io:commons-io -org.apache.commons.lang3=org.apache.commons:commons-lang3 -org.apache.commons.compress=org.apache.commons:commons-compress - -org.testcontainers=org.testcontainers:testcontainers -org.testcontainers.junit-jupiter=org.testcontainers:junit-jupiter -com.github.dockerjava.api=com.github.docker-java:docker-java-api -com.github.docker-java.transport.zerodep=com.github.docker-java:docker-java-transport-zerodep -com.github.docker-java.transport.httpclient5=com.github.docker-java:docker-java-transport-httpclient5 -io.github.cdimascio=io.github.cdimascio:java-dotenv - -java.annotation=javax.annotation:javax.annotation-api -org.apache.logging.log4j.slf4j2.impl=org.apache.logging.log4j:log4j-slf4j2-impl - -dagger=com.google.dagger:dagger -dagger.compiler=com.google.dagger:dagger-compiler -com.squareup.javapoet=com.squareup:javapoet -javax.inject=javax.inject:javax.inject -org.checkerframework.checker.qual=org.checkerframework:checker-qual - -com.github.luben.zstd_jni=com.github.luben:zstd-jni diff --git a/gradle/toolchain-versions.properties b/gradle/toolchain-versions.properties new file mode 100644 index 000000000..04e458fae --- /dev/null +++ b/gradle/toolchain-versions.properties @@ -0,0 +1 @@ +jdk=21.0.4 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f..a4b76b953 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradlew b/gradlew index b740cf133..f5feea6d6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 7101f8e46..9b42019c7 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/hiero-dependency-versions/build.gradle.kts b/hiero-dependency-versions/build.gradle.kts new file mode 100644 index 000000000..2a31beb00 --- /dev/null +++ b/hiero-dependency-versions/build.gradle.kts @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2024 Hedera Hashgraph, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("org.hiero.gradle.base.lifecycle") + id("org.hiero.gradle.base.jpms-modules") + id("org.hiero.gradle.check.spotless") + id("org.hiero.gradle.check.spotless-kotlin") +} + +dependencies.constraints { + // Define a constant for the platform SDK version. + // Platform SDK modules are all released together with matching versions. + val daggerVersion = "2.42" + val grpcIoVersion = "1.65.1" + val helidonVersion = "4.1.1" + val pbjVersion = "0.9.11" + val protobufVersion = "4.28.2" + val swirldsVersion = "0.51.5" + + api("com.github.luben:zstd-jni:1.5.6-8") { because("com.github.luben.zstd_jni") } + api("com.github.spotbugs:spotbugs-annotations:4.7.3") { + because("com.github.spotbugs.annotations") + } + api("com.google.auto.service:auto-service-annotations:1.1.1") { + because("com.google.auto.service") + } + api("com.google.guava:guava:33.3.1-jre") { because("com.google.common") } + api("com.google.j2objc:j2objc-annotations:3.0.0") { because("com.google.j2objc.annotations") } + api("com.google.protobuf:protobuf-java-util:$protobufVersion") { + because("com.google.protobuf.util") + } + api("com.google.protobuf:protoc:$protobufVersion") { because("google.proto") } + api("com.hedera.pbj:pbj-grpc-helidon:${pbjVersion}") { because("com.hedera.pbj.grpc.helidon") } + api("com.hedera.pbj:pbj-grpc-helidon-config:${pbjVersion}") { + because("com.hedera.pbj.grpc.helidon.config") + } + api("com.hedera.pbj:pbj-runtime:${pbjVersion}") { because("com.hedera.pbj.runtime") } + api("com.lmax:disruptor:4.0.0") { because("com.lmax.disruptor") } + api("com.swirlds:swirlds-common:$swirldsVersion") { because("com.swirlds.common") } + api("com.swirlds:swirlds-config-impl:$swirldsVersion") { because("com.swirlds.config.impl") } + api("io.helidon.logging:helidon-logging-jul:$helidonVersion") { + because("io.helidon.logging.jul") + } + api("io.helidon.webserver:helidon-webserver-grpc:$helidonVersion") { + because("io.helidon.webserver.grpc") + } + api("io.helidon.webserver:helidon-webserver:$helidonVersion") { + because("io.helidon.webserver") + } + + // gRPC dependencies + api("io.grpc:grpc-api:$grpcIoVersion") { because("io.grpc") } + api("io.grpc:grpc-stub:$grpcIoVersion") { because("io.grpc.stub") } + api("io.grpc:grpc-protobuf:$grpcIoVersion") { because("io.grpc.protobuf") } + api("io.grpc:grpc-netty:$grpcIoVersion") { because("io.grpc.netty") } + api("io.grpc:protoc-gen-grpc-java:1.66.0") + + // command line tool + api("info.picocli:picocli:4.7.6") { because("info.picocli") } + + // needed for dagger + api("com.google.dagger:dagger:$daggerVersion") { because("dagger") } + api("com.google.dagger:dagger-compiler:$daggerVersion") { because("dagger.compiler") } + api("com.squareup:javapoet:1.13.0") { because("com.squareup.javapoet") } + + // Testing only versions + api("com.github.docker-java:docker-java-api:3.4.0") { because("com.github.dockerjava.api") } + api("io.github.cdimascio:dotenv-java:3.0.2") { because("io.github.cdimascio.dotenv.java") } + api("org.assertj:assertj-core:3.23.1") { because("org.assertj.core") } + api("org.junit.jupiter:junit-jupiter-api:5.10.2") { because("org.junit.jupiter.api") } + api("org.mockito:mockito-core:5.8.0") { because("org.mockito") } + api("org.mockito:mockito-junit-jupiter:5.8.0") { because("org.mockito.junit.jupiter") } + api("org.testcontainers:junit-jupiter:1.20.1") { because("org.testcontainers.junit.jupiter") } + api("org.testcontainers:testcontainers:1.20.1") { because("org.testcontainers") } + + api("com.google.auto.service:auto-service:1.1.1") { + because("com.google.auto.service.processor") + } + api("com.google.dagger:dagger-compiler:$daggerVersion") { because("dagger.compiler") } +} diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 25592c617..62002092d 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2024 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,17 @@ */ plugins { + id("org.hiero.gradle.module.library") id("application") - id("com.hedera.block.server") } +// Description is added to POM metadata +description = "Hedera Block Node Server" + +// Remove the following line to enable all 'javac' lint checks that we have turned on by default +// and then fix the reported issues. +tasks.withType().configureEach { options.compilerArgs.add("-Xlint:-exports") } + application { mainModule = "com.hedera.block.server" mainClass = "com.hedera.block.server.Server" @@ -29,7 +36,7 @@ mainModuleInfo { annotationProcessor("com.google.auto.service.processor") runtimeOnly("com.swirlds.config.impl") runtimeOnly("org.apache.logging.log4j.slf4j2.impl") - runtimeOnly("io.helidon.logging") + runtimeOnly("io.helidon.logging.jul") runtimeOnly("com.hedera.pbj.grpc.helidon.config") } diff --git a/server/src/main/java/module-info.java b/server/src/main/java/module-info.java index dda0c6d22..447ba5eb6 100644 --- a/server/src/main/java/module-info.java +++ b/server/src/main/java/module-info.java @@ -24,22 +24,23 @@ requires com.hedera.block.common; requires com.hedera.block.stream; - requires com.github.luben.zstd_jni; requires com.hedera.pbj.grpc.helidon.config; requires com.hedera.pbj.grpc.helidon; requires com.hedera.pbj.runtime; - requires com.lmax.disruptor; requires com.swirlds.common; requires com.swirlds.config.api; requires com.swirlds.config.extensions; requires com.swirlds.metrics.api; + requires com.github.luben.zstd_jni; + requires com.lmax.disruptor; requires dagger; requires io.helidon.common; requires io.helidon.config; requires io.helidon.webserver; requires javax.inject; - requires static com.github.spotbugs.annotations; - requires static com.google.auto.service; + requires static transitive com.github.spotbugs.annotations; + requires static transitive com.google.auto.service; + requires static java.compiler; // javax.annotation.processing.Generated provides com.swirlds.config.api.ConfigurationExtension with BlockNodeConfigExtension; diff --git a/settings.gradle.kts b/settings.gradle.kts index 37e1a23fb..56149ac28 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,137 +14,13 @@ * limitations under the License. */ -plugins { - id("com.gradle.enterprise").version("3.15.1") -} - -// Include the subprojects -include(":common") -include(":suites") -include(":stream") -include(":server") -include(":simulator") -include(":tools") - -includeBuild(".") // https://github.com/gradle/gradle/issues/21490#issuecomment-1458887481 - -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} - -dependencyResolutionManagement { - versionCatalogs { - create("libs") { - // Define a constant for the platform SDK version. - // Platform SDK modules are all released together with matching versions. - val swirldsVersion = "0.54.1" - - // Define a constant for the Dagger version. - val daggerVersion = "2.42" - - // Define a constant for protobuf version. - val protobufVersion = "4.28.2" - val helidonVersion = "4.1.1" - val grpcIoVersion = "1.65.1" - var pbjVersion = "0.9.11" - - // Compile time dependencies - version("io.helidon.webserver.http2", helidonVersion) - version("io.helidon.webserver", helidonVersion) - version("io.helidon.logging", helidonVersion) - - version("com.lmax.disruptor", "4.0.0") - version("com.github.spotbugs.annotations", "4.7.3") - version("com.swirlds.metrics.api", swirldsVersion) - version("com.swirlds.metrics.impl", swirldsVersion) - version("com.swirlds.common", swirldsVersion) - version("com.swirlds.config.impl", swirldsVersion) - version("com.swirlds.config.processor", swirldsVersion) - version("com.swirlds.config.extensions", swirldsVersion) - version("com.google.auto.service.processor", "1.1.1") - version("com.google.auto.service", "1.1.1") - version("org.hyperledger.besu.nativelib.secp256k1", "0.8.2") - version("info.picocli", "4.7.6") - - // gRPC dependencies for the stream subproject - version("io.grpc", grpcIoVersion) - version("io.grpc.protobuf", grpcIoVersion) - version("io.grpc.stub", grpcIoVersion) - - // netty dependency for the simulator subproject - version("io.grpc.netty.shaded", grpcIoVersion) - - // Reference from the protobuf plugin - version("google.proto", protobufVersion) - version("grpc.protobuf.grpc", grpcIoVersion) - - // Google protobuf dependencies - version("com.google.protobuf", protobufVersion) - version("com.google.protobuf.util", protobufVersion) - - - // PBJ dependencies - plugin("pbj", "com.hedera.pbj.pbj-compiler").version(pbjVersion) - version("com.hedera.pbj.runtime", pbjVersion) - version("com.hedera.pbj.grpc.helidon", pbjVersion) - version("com.hedera.pbj.grpc.helidon.config", pbjVersion) - version("org.antlr.antlr4.runtime", "4.13.1") - - version("java.annotation", "1.3.2") - version("javax.inject", "1") - version("com.google.common", "33.0.0-jre") - - version("org.apache.commons.codec", "1.15") - version("org.apache.commons.collections4", "4.4") - version("org.apache.commons.io", "2.15.1") - version("org.apache.commons.lang3", "3.14.0") - version("org.apache.commons.compress", "1.26.0") - version("org.apache.logging.log4j.slf4j2.impl", "2.21.1") - version("com.github.luben.zstd_jni","1.5.6-8") - - // needed for dagger - version("dagger", daggerVersion) - version("dagger.compiler", daggerVersion) - version("com.squareup.javapoet", "1.13.0") - - // Testing only versions - version("org.assertj.core", "3.23.1") - version("org.junit.jupiter.api", "5.10.2") - version("org.junit.platform", "1.11.0") - version("org.mockito", "5.8.0") - version("org.mockito.junit.jupiter", "5.8.0") - version("org.testcontainers", "1.20.1") - version("org.testcontainers.junit-jupiter", "1.20.1") - version("com.github.docker-java", "3.4.0") - version("io.github.cdimascio", "5.2.2") - } - } -} - - -// Build cache configuration -val isCiServer = System.getenv().containsKey("CI") -val gradleCacheUsername: String? = System.getenv("GRADLE_CACHE_USERNAME") -val gradleCachePassword: String? = System.getenv("GRADLE_CACHE_PASSWORD") -val gradleCacheAuthorized = - (gradleCacheUsername?.isNotEmpty() ?: false) && (gradleCachePassword?.isNotEmpty() ?: false) - -buildCache { - remote { - url = uri("https://cache.gradle.hedera.svcs.eng.swirldslabs.io/cache/") - isPush = isCiServer && gradleCacheAuthorized +plugins { id("org.hiero.gradle.build") version "0.1.2" } - isUseExpectContinue = true - isEnabled = !gradle.startParameter.isOffline +rootProject.name = "hedera-block-node" - if (isCiServer && gradleCacheAuthorized) { - credentials { - username = gradleCacheUsername - password = gradleCachePassword - } - } +javaModules { + directory(".") { + group = "com.hedera.block" + module("suites") // no 'module-info' yet } } diff --git a/simulator/build.gradle.kts b/simulator/build.gradle.kts index 040b539b4..0245955cf 100644 --- a/simulator/build.gradle.kts +++ b/simulator/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2024 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,17 @@ plugins { id("application") - id("com.hedera.block.simulator") + id("org.hiero.gradle.module.library") } // dependencies { implementation(project(":common")) } description = "Hedera Block Stream Simulator" +// Remove the following line to enable all 'javac' lint checks that we have turned on by default +// and then fix the reported issues. +tasks.withType().configureEach { options.compilerArgs.add("-Xlint:-exports") } + application { mainModule = "com.hedera.block.simulator" mainClass = "com.hedera.block.simulator.BlockStreamSimulator" @@ -33,7 +37,7 @@ mainModuleInfo { annotationProcessor("com.google.auto.service.processor") runtimeOnly("com.swirlds.config.impl") runtimeOnly("org.apache.logging.log4j.slf4j2.impl") - runtimeOnly("io.grpc.netty.shaded") + runtimeOnly("io.grpc.netty") } testModuleInfo { diff --git a/simulator/src/main/java/module-info.java b/simulator/src/main/java/module-info.java index 2da924ff8..c420caccc 100644 --- a/simulator/src/main/java/module-info.java +++ b/simulator/src/main/java/module-info.java @@ -12,8 +12,6 @@ exports com.hedera.block.simulator.metrics; exports com.hedera.block.simulator.grpc.impl; - requires static com.github.spotbugs.annotations; - requires static com.google.auto.service; requires com.hedera.block.common; requires com.hedera.block.stream; requires com.hedera.pbj.runtime; @@ -26,6 +24,9 @@ requires io.grpc; requires java.logging; requires javax.inject; + requires static transitive com.github.spotbugs.annotations; + requires static transitive com.google.auto.service; + requires static java.compiler; // javax.annotation.processing.Generated provides com.swirlds.config.api.ConfigurationExtension with SimulatorConfigExtension; diff --git a/stream/build.gradle.kts b/stream/build.gradle.kts index 64f5f971c..dd8dd8fe7 100644 --- a/stream/build.gradle.kts +++ b/stream/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2024 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,14 @@ * limitations under the License. */ +import org.hiero.gradle.tasks.GitClone + plugins { - id("com.hedera.block.protobuf") - alias(libs.plugins.pbj) + id("org.hiero.gradle.module.library") + id("org.hiero.gradle.feature.protobuf") + id("com.hedera.pbj.pbj-compiler") version "0.9.2" } -group = "com.hedera.block" - description = "Hedera API" // Remove the following line to enable all 'javac' lint checks that we have turned on by default @@ -30,28 +31,32 @@ tasks.withType().configureEach { } // Add downloaded HAPI repo protobuf files into build directory and add to sources to build them -tasks.cloneHederaProtobufs { - // uncomment below to use a specific tag - // tag = "v0.53.0" or a specific commit like "0047255" - tag = "1033f10" +val cloneHederaProtobufs = + tasks.register("cloneHederaProtobufs") { + url = "https://github.com/hashgraph/hedera-protobufs.git" + localCloneDirectory = layout.buildDirectory.dir("hedera-protobufs") - // uncomment below to use a specific branch - // branch = "main" -} + // uncomment below to use a specific tag + // tag = "v0.53.0" or a specific commit like "0047255" + tag = "1033f10" + + // uncomment below to use a specific branch + // branch = "main" + } sourceSets { main { pbj { - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("services") }) - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("block") }) - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("platform") }) - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("streams") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("services") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("block") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("platform") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("streams") }) } proto { - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("services") }) - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("block") }) - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("platform") }) - srcDir(tasks.cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("streams") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("services") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("block") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("platform") }) + srcDir(cloneHederaProtobufs.flatMap { it.localCloneDirectory.dir("streams") }) } } } diff --git a/stream/src/main/java/module-info.java b/stream/src/main/java/module-info.java index 403a6aa44..32b1a00cd 100644 --- a/stream/src/main/java/module-info.java +++ b/stream/src/main/java/module-info.java @@ -1,6 +1,6 @@ module com.hedera.block.stream { exports com.hedera.hapi.block; - exports com.hedera.hapi.block.protoc; + exports com.hedera.hapi.block.protoc; // TODO move to test fixtures exports com.hedera.hapi.block.stream.protoc; exports com.hedera.hapi.block.stream.input.protoc; exports com.hedera.hapi.block.stream.output.protoc; @@ -70,9 +70,9 @@ exports com.hedera.hapi.platform.state.legacy to com.google.protobuf; + requires transitive com.hedera.pbj.runtime; requires transitive com.google.common; requires transitive com.google.protobuf; - requires transitive com.hedera.pbj.runtime; requires transitive io.grpc.stub; requires transitive io.grpc; requires io.grpc.protobuf; diff --git a/suites/build.gradle.kts b/suites/build.gradle.kts index 85af453d4..aea88ecc1 100644 --- a/suites/build.gradle.kts +++ b/suites/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2024 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,27 +16,42 @@ plugins { id("application") - id("com.hedera.block.suites") + id("org.hiero.gradle.module.library") } description = "Hedera Block Node E2E Suites" -dependencies { implementation(project(":simulator")) } - application { mainModule = "com.hedera.block.suites" mainClass = "com.hedera.block.suites.BaseSuite" } mainModuleInfo { - runtimeOnly("org.testcontainers.junit-jupiter") + runtimeOnly("org.testcontainers.junit.jupiter") runtimeOnly("org.junit.jupiter.engine") runtimeOnly("org.testcontainers") runtimeOnly("com.swirlds.config.impl") } -// workaround until https://github.com/hashgraph/hedera-block-node/pull/216 is integrated -dependencies.constraints { implementation("org.slf4j:slf4j-api:2.0.6") } +val updateDockerEnv = + tasks.register("updateDockerEnv") { + description = + "Creates the .env file in the docker folder that contains environment variables for Docker" + group = "docker" + + workingDir(layout.projectDirectory.dir("../server/docker")) + commandLine("sh", "-c", "./update-env.sh ${project.version} false false") + } + +// Task to build the Docker image +tasks.register("createDockerImage") { + description = "Creates the Docker image of the Block Node Server based on the current version" + group = "docker" + + dependsOn(updateDockerEnv, tasks.assemble) + workingDir(layout.projectDirectory.dir("../server/docker")) + commandLine("./docker-build.sh", project.version, layout.projectDirectory.dir("..").asFile) +} tasks.register("runSuites") { description = "Runs E2E Test Suites" diff --git a/suites/src/main/java/module-info.java b/suites/src/main/java/module-info.java index 513183446..79b515a85 100644 --- a/suites/src/main/java/module-info.java +++ b/suites/src/main/java/module-info.java @@ -1,14 +1,14 @@ /** Runtime module of the suites. */ module com.hedera.block.node.suites { + // Require testing libraries requires com.hedera.block.simulator; requires com.swirlds.config.api; requires com.swirlds.config.extensions; - - // Require testing libraries - requires io.github.cdimascio; + requires io.github.cdimascio.dotenv.java; requires org.junit.jupiter.api; requires org.junit.platform.suite.api; requires org.testcontainers; + requires static dagger; exports com.hedera.block.suites to org.junit.platform.commons; diff --git a/tools/build.gradle.kts b/tools/build.gradle.kts index 26a09c31b..08cc43e40 100644 --- a/tools/build.gradle.kts +++ b/tools/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2024 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ plugins { id("application") - id("com.hedera.block.tools") + id("org.hiero.gradle.module.library") } description = "Hedera Block Stream Tools" @@ -29,7 +29,7 @@ application { mainModuleInfo { runtimeOnly("com.swirlds.config.impl") runtimeOnly("org.apache.logging.log4j.slf4j2.impl") - runtimeOnly("io.grpc.netty.shaded") + runtimeOnly("io.grpc.netty") } testModuleInfo { requiresStatic("com.github.spotbugs.annotations") } diff --git a/version.txt b/version.txt new file mode 100644 index 000000000..daf2bb73d --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.3.0-SNAPSHOT