Skip to content

Commit

Permalink
build: cleanup settings.gradle.kts / remove build.gradle.kts (#15470)
Browse files Browse the repository at this point in the history
Signed-off-by: Jendrik Johannes <[email protected]>
  • Loading branch information
jjohannes committed Sep 17, 2024
1 parent 855861f commit 6473cc7
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 74 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/node-zxc-compile-application-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ jobs:
) &&
!cancelled()
}}
run: sed -i 's/^org.gradle.configuration-cache=.*$/org.gradle.configuration-cache=false/' gradle.properties
run: |
sed -i 's/^org.gradle.configuration-cache=.*$/org.gradle.configuration-cache=false/' gradle.properties
touch build.gradle.kts
- name: Setup Snyk
env:
Expand Down
17 changes: 0 additions & 17 deletions build.gradle.kts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ plugins {
// tasks from the 'build' group
defaultTasks("tasks")

tasks.named<TaskReportTask>("tasks") {
if (!isDetail) {
displayGroup = "build"
}
}

tasks.register("qualityGate") {
group = "build"
description = "Apply spotless rules and run all quality checks."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,23 @@ plugins {

// Configure Protobuf Plugin to download protoc executable rather than using local installed version
protobuf {
val libs = the<VersionCatalogsExtension>().named("libs")
protoc { artifact = "com.google.protobuf:protoc:" + libs.findVersion("google-proto").get() }
protoc { artifact = "com.google.protobuf:protoc" }
plugins {
// Add GRPC plugin as we need to generate GRPC services
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:" + libs.findVersion("grpc-proto").get()
}
id("grpc") { artifact = "io.grpc:protoc-gen-grpc-java" }
}
generateProtoTasks {
all().configureEach { plugins { id("grpc") { option("@generated=omit") } } }
}
}

sourceSets.all {
val compileProtoPath = getTaskName("", "compileProtoPath")
dependencies {
// For dependencies of protobuf compilation use versions from 'hedera-dependency-versions',
// but not 'runtime' dependencies of the platform (JAVA_API instead of JAVA_RUNTIME).
dependencies {
compileProtoPath(project(":hedera-dependency-versions")) {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.REGULAR_PLATFORM))
}
}
configurations.configureEach {
if (name.startsWith("protobufToolsLocator") || name.endsWith("ProtoPath")) {
attributes { attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API)) }
exclude(group = project.group.toString(), module = project.name)
withDependencies {
isTransitive = true
extendsFrom(configurations["internal"])
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* limitations under the License.
*/

import org.gradlex.javamodule.dependencies.initialization.JavaModulesExtension
import org.gradlex.javamodule.dependencies.initialization.RootPluginsExtension

pluginManagement {
repositories {
gradlePluginPortal()
Expand All @@ -27,6 +30,10 @@ plugins {
id("org.gradlex.java-module-dependencies")
}

// Plugins that are global, but are applied to the "root project" instead of settings.
// by having this block here, we do not require a "build.gradle.kts" in the repository roots.
configure<RootPluginsExtension> { id("com.hedera.gradle.root") }

// Enable Gradle Build Scan
develocity {
buildScan {
Expand Down Expand Up @@ -63,3 +70,11 @@ buildCache {
// https://docs.gradle.org/current/userguide/composite_builds.html#included_build_declaring_substitutions
// Some functionality of the 'java-module-dependencies' plugin relies on this.
includeBuild(".")

configure<JavaModulesExtension> {
// Project to aggregate code coverage data for the whole repository into one report
module("gradle/reports")

// "BOM" with versions of 3rd party dependencies
versions("hedera-dependency-versions")
}
2 changes: 1 addition & 1 deletion hapi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins {
id("com.hedera.gradle.protobuf")
id("com.hedera.gradle.services-publish")
id("com.hedera.gradle.feature.test-fixtures")
alias(libs.plugins.pbj)
id("com.hedera.pbj.pbj-compiler") version "0.9.2"
}

description = "Hedera API"
Expand Down
7 changes: 6 additions & 1 deletion hedera-dependency-versions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ dependencies {
api(enforcedPlatform("io.netty:netty-bom:4.1.110.Final"))

// forward logging from modules using SLF4J (e.g. 'org.hyperledger.besu.evm') to Log4J
runtime(javaModuleDependencies.gav("org.apache.logging.log4j.slf4j2.impl"))
runtime("org.apache.logging.log4j:log4j-slf4j2-impl") {
because("org.apache.logging.log4j.slf4j2.impl")
}
}

dependencies.constraints {
Expand Down Expand Up @@ -221,4 +223,7 @@ dependencies.constraints {
api("uk.org.webcompere:system-stubs-jupiter:2.1.5") {
because("uk.org.webcompere.systemstubs.jupiter")
}

api("com.google.protobuf:protoc:3.25.4")
api("io.grpc:protoc-gen-grpc-java:1.66.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import com.google.protobuf.gradle.ProtobufExtract

plugins {
id("com.hedera.gradle.application")
id("com.hedera.gradle.feature.test-timing-sensitive")
Expand All @@ -28,7 +26,7 @@ tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-Xlint:-exports,-static,-cast")
}

application.mainClass.set("com.swirlds.demo.platform.PlatformTestingToolMain")
application.mainClass = "com.swirlds.demo.platform.PlatformTestingToolMain"

testModuleInfo {
requires("org.apache.logging.log4j.core")
Expand All @@ -51,17 +49,15 @@ timingSensitiveModuleInfo {
requires("org.mockito")
}

protobuf { protoc { artifact = "com.google.protobuf:protoc:3.21.5" } }

configurations {
// Give proto compile access to the dependency versions
compileProtoPath { extendsFrom(configurations.internal.get()) }
testCompileProtoPath { extendsFrom(configurations.internal.get()) }
timingSensitiveCompileProtoPath { extendsFrom(configurations.internal.get()) }
}
protobuf { protoc { artifact = "com.google.protobuf:protoc" } }

tasks.withType<ProtobufExtract>().configureEach {
if (name == "extractIncludeProto") {
enabled = false
configurations.configureEach {
if (name.startsWith("protobufToolsLocator") || name.endsWith("ProtoPath")) {
attributes { attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API)) }
exclude(group = project.group.toString(), module = project.name)
withDependencies {
isTransitive = true
extendsFrom(configurations["internal"])
}
}
}
17 changes: 0 additions & 17 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ pluginManagement { includeBuild("gradle/plugins") }

plugins { id("com.hedera.gradle.settings") }


javaModules {
// Project to aggregate code coverage data for the whole repository into one report´
module("gradle/reports")

// This "intermediate parent project" should be removed
module("platform-sdk") { artifact = "swirlds-platform" }

Expand Down Expand Up @@ -81,17 +77,4 @@ javaModules {
directory("platform-sdk/platform-apps/tests") {
group = "com.swirlds"
}

// "BOM" with versions of 3rd party dependencies
versions("hedera-dependency-versions")
}

dependencyResolutionManagement {
// Protobuf tool versions
versionCatalogs.create("libs") {
version("google-proto", "3.25.4")
version("grpc-proto", "1.66.0")

plugin("pbj", "com.hedera.pbj.pbj-compiler").version("0.9.2")
}
}

0 comments on commit 6473cc7

Please sign in to comment.