Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.github.jengelman.gradle.plugins.shadow
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin.Companion.SHADOW
import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin.Companion.shadow
import com.github.jengelman.gradle.plugins.shadow.internal.addVariantsFromConfigurationCompat
import com.github.jengelman.gradle.plugins.shadow.internal.extendsFromCompat
import com.github.jengelman.gradle.plugins.shadow.internal.javaPluginExtension
import com.github.jengelman.gradle.plugins.shadow.internal.moveGradleApiIntoCompileOnly
import com.github.jengelman.gradle.plugins.shadow.internal.runtimeConfiguration
Expand Down Expand Up @@ -47,13 +48,13 @@ constructor(private val softwareComponentFactory: SoftwareComponentFactory) : Pl
}

protected open fun Project.configureConfigurations() {
val shadowConfiguration = configurations.shadow.get()
val shadowConfiguration = configurations.shadow
configurations.named(COMPILE_CLASSPATH_CONFIGURATION_NAME) { compileClasspath ->
compileClasspath.extendsFrom(shadowConfiguration)
compileClasspath.extendsFromCompat(shadowConfiguration)
}
val shadowRuntimeElements =
configurations.register(SHADOW_RUNTIME_ELEMENTS_CONFIGURATION_NAME) {
it.extendsFrom(shadowConfiguration)
it.extendsFromCompat(shadowConfiguration)
it.isCanBeConsumed = true
it.isCanBeResolved = false
it.attributes { attrs ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ internal fun Project.addBuildScanCustomValues() {
}
}

/** TODO: this could be removed after bumping the min Gradle requirement to 9.4 or above. */
internal fun Configuration.extendsFromCompat(vararg superConfigs: Provider<out Configuration>) {
if (GradleVersion.current() >= GradleVersion.version("9.4.0")) {
@Suppress("UnstableApiUsage") extendsFrom(*superConfigs)
} else {
extendsFrom(*superConfigs.map { it.get() }.toTypedArray())
}
}

/** TODO: this could be removed after bumping the min Gradle requirement to 9.2 or above. */
@Suppress("UnstableApiUsage")
internal fun AdhocComponentWithVariants.addVariantsFromConfigurationCompat(
Expand Down