Skip to content

Commit

Permalink
Defer more
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Sep 13, 2024
1 parent 36026ee commit 028216d
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ShadowJavaPlugin implements Plugin<Project> {

@Override
void apply(Project project) {
def shadowTask = configureShadowTask(project)
def shadowTaskProvider = configureShadowTask(project)

project.configurations.compileClasspath.extendsFrom project.configurations.shadow

Expand All @@ -44,12 +44,13 @@ class ShadowJavaPlugin implements Plugin<Project> {
it.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, LibraryElements.JAR))
it.attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling, Bundling.SHADOWED))
}
it.outgoing.artifact(shadowTask)
it.outgoing.artifact(shadowTaskProvider)
}

AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName("java")
javaComponent.addVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
it.mapToOptional()
project.components.named("java") { AdhocComponentWithVariants it ->
it.addVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
it.mapToOptional()
}
}

AdhocComponentWithVariants shadow = softwareComponentFactory.adhoc("shadow")
Expand Down Expand Up @@ -95,7 +96,7 @@ class ShadowJavaPlugin implements Plugin<Project> {
project.configurations.runtimeClasspath : project.configurations.runtime]
shadow.exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'module-info.class')
}
project.artifacts.add(ShadowBasePlugin.CONFIGURATION_NAME, taskProvider.get())
project.artifacts.add(ShadowBasePlugin.CONFIGURATION_NAME, taskProvider)
return taskProvider
}
}

0 comments on commit 028216d

Please sign in to comment.