Skip to content

Commit 79409f0

Browse files
committed
1 parent 801c21e commit 79409f0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.github.jengelman.gradle.plugins.shadow
33
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin.Companion.SHADOW
44
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin.Companion.shadow
55
import com.github.jengelman.gradle.plugins.shadow.internal.addVariantsFromConfigurationCompat
6+
import com.github.jengelman.gradle.plugins.shadow.internal.extendsFromCompat
67
import com.github.jengelman.gradle.plugins.shadow.internal.javaPluginExtension
78
import com.github.jengelman.gradle.plugins.shadow.internal.moveGradleApiIntoCompileOnly
89
import com.github.jengelman.gradle.plugins.shadow.internal.runtimeConfiguration
@@ -47,13 +48,12 @@ constructor(private val softwareComponentFactory: SoftwareComponentFactory) : Pl
4748
}
4849

4950
protected open fun Project.configureConfigurations() {
50-
val shadowConfiguration = configurations.shadow.get()
5151
configurations.named(COMPILE_CLASSPATH_CONFIGURATION_NAME) { compileClasspath ->
52-
compileClasspath.extendsFrom(shadowConfiguration)
52+
compileClasspath.extendsFromCompat(configurations.shadow)
5353
}
5454
val shadowRuntimeElements =
5555
configurations.register(SHADOW_RUNTIME_ELEMENTS_CONFIGURATION_NAME) {
56-
it.extendsFrom(shadowConfiguration)
56+
it.extendsFromCompat(configurations.shadow)
5757
it.isCanBeConsumed = true
5858
it.isCanBeResolved = false
5959
it.attributes { attrs ->

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/GradleCompat.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ internal fun Project.addBuildScanCustomValues() {
6767
}
6868
}
6969

70+
internal fun Configuration.extendsFromCompat(configuration: Any) {
71+
if (GradleVersion.current() >= GradleVersion.version("9.4.0")) {
72+
@Suppress("UNCHECKED_CAST", "UnstableApiUsage")
73+
extendsFrom(configuration as Provider<Configuration>)
74+
} else {
75+
extendsFrom(configuration as Configuration)
76+
}
77+
}
78+
7079
/** TODO: this could be removed after bumping the min Gradle requirement to 9.2 or above. */
7180
@Suppress("UnstableApiUsage")
7281
internal fun AdhocComponentWithVariants.addVariantsFromConfigurationCompat(

0 commit comments

Comments
 (0)