Skip to content

Commit

Permalink
build: streamline tools/build.gradle.kts
Browse files Browse the repository at this point in the history
Signed-off-by: Jendrik Johannes <[email protected]>
  • Loading branch information
jjohannes committed Jan 9, 2025
1 parent 33eebf8 commit 5f390f3
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions tools/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
import com.github.jengelman.gradle.plugins.shadow.internal.DefaultDependencyFilter
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id("application")
id("org.hiero.gradle.module.library")
id("org.hiero.gradle.module.application")
id("com.gradleup.shadow") version "8.3.5"
}

description = "Hedera Block Stream Tools"

application { mainClass = "com.hedera.block.tools.BlockStreamTool" }

// Generate Manifest with Main-Class and Implementation-Title
tasks.withType<Jar>().configureEach {
manifest {
attributes(
"Main-Class" to application.mainClass.get(),
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
)
}
}

// Allow non-module Jar
extraJavaModuleInfo {
failOnMissingModuleInfo = false
Expand Down Expand Up @@ -50,16 +37,23 @@ dependencies {
implementation("com.google.cloud:google-cloud-storage")
}

tasks.withType<ShadowJar>().configureEach {
group = "shadow"
// == Shadow plugin configuration ==
tasks.shadowJar {
// Generate Manifest with Main-Class and Implementation-Title
manifest {
attributes(
"Main-Class" to application.mainClass,
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
)
}

// There is an issue in the shadow plugin that it automatically accesses the
// files in 'runtimeClasspath' while Gradle is building the task graph.
// See: https://github.com/GradleUp/shadow/issues/882
dependencyFilter = NoResolveDependencyFilter()
}

// Disable dependency resolution as it conflicts with shadow plugin
class NoResolveDependencyFilter : DefaultDependencyFilter(project) {
override fun resolve(configuration: FileCollection): FileCollection {
return configuration
Expand Down

0 comments on commit 5f390f3

Please sign in to comment.