Skip to content

Commit

Permalink
Allow for opt-out of the java shadowRuntimeElements variant
Browse files Browse the repository at this point in the history
  • Loading branch information
m8nmueller committed Apr 29, 2021
1 parent e22a314 commit 8d01d41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class ShadowExtension {

CopySpec applicationDistribution
Project project
boolean addJavaVariants

ShadowExtension(Project project) {
this.project = project
applicationDistribution = project.copySpec {}
addJavaVariants = true
}

void component(MavenPublication publication) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ class ShadowJavaPlugin implements Plugin<Project> {

project.configurations.shadowRuntimeElements.extendsFrom project.configurations.shadow

project.components.java {
addVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
mapToOptional() // make it a Maven optional dependency
project.afterEvaluate {
if (project.extensions.findByName(ShadowBasePlugin.EXTENSION_NAME).addJavaVariants) {
project.components.java {
addVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
mapToOptional() // make it a Maven optional dependency
}
}
}
}
}
Expand Down

0 comments on commit 8d01d41

Please sign in to comment.