Skip to content

Commit

Permalink
Add 'feature.shadow' convention plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Jendrik Johannes <jendrik.johannes@gmail.com>
  • Loading branch information
jjohannes committed Jan 17, 2025
1 parent ccd25e6 commit f1370a6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies {
implementation("com.google.protobuf:protobuf-gradle-plugin:0.9.4")
implementation("com.gradle.publish:plugin-publish-plugin:1.3.0")
implementation("com.gradle:develocity-gradle-plugin:3.19")
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.5")
implementation(
"gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.2"
)
Expand Down
1 change: 1 addition & 0 deletions src/main/descriptions/org.hiero.gradle.feature.shadow.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Conventions for 'com.gradleup.shadow' to be used to build a fat Jar of an application
26 changes: 26 additions & 0 deletions src/main/kotlin/org.hiero.gradle.feature.shadow.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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("com.gradleup.shadow")
}

tasks.withType<ShadowJar>().configureEach {
group = "shadow"
mergeServiceFiles()

manifest { attributes("Multi-Release" to "true") }

// 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()
}

class NoResolveDependencyFilter : DefaultDependencyFilter(project) {

Check warning on line 22 in src/main/kotlin/org.hiero.gradle.feature.shadow.gradle.kts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/kotlin/org.hiero.gradle.feature.shadow.gradle.kts#L22

NoResolveDependencyFilter is missing required documentation.
override fun resolve(configuration: FileCollection): FileCollection {
return configuration
}
}

0 comments on commit f1370a6

Please sign in to comment.