PlatformDependencyModifiers.EnforcedPlatformDependencyModifier
, PlatformDependencyModifiers.PlatformDependencyModifier
, TestFixturesDependencyModifiers.TestFixturesDependencyModifier
@Incubating @NonExtensible public abstract class DependencyModifier extends java.lang.Object
DependencyModifier
defines how to modify a dependency inside a custom dependencies
block to select a different variant.modify(...)
unnecessary from the DSL.
call(...)
equivalents for all the modify(...)
methods.invoke(...)
equivalents for all the modify(...)
methods.modifyImplementation(ModuleDependency)
. Other abstract
methods are used to inject necessary services
and should not be implemented.modify(...)
delegate to modifyImplementation(ModuleDependency)
.
Changes to this interface may require changes to the
extension module for Groovy DSL
or
extension functions for Kotlin DSL
.
Modifier | Constructor | Description |
---|---|---|
protected |
DependencyModifier() |
Creates a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
protected abstract DependencyFactory |
getDependencyFactory() |
A dependency factory is used to convert supported dependency notations into
Dependency instances. |
<D extends ModuleDependency> |
modify(D dependency) |
Takes a given
ModuleDependency and modifies the dependency to select the variant of the given module. |
ExternalModuleDependency |
modify(java.lang.CharSequence dependencyNotation) |
Create an
ExternalModuleDependency from the given notation and modifies it to select the variant of the given module as described in modify(ModuleDependency) . |
<D extends ModuleDependency> |
modify(Provider<D> providerToDependency) |
Takes a given
Provider to a ExternalModuleDependency and modifies the dependency to select the variant of the given module as described in modify(ModuleDependency) . |
Provider<? extends MinimalExternalModuleDependency> |
modify(ProviderConvertible<? extends MinimalExternalModuleDependency> providerConvertibleToDependency) |
Takes a given
Provider to a MinimalExternalModuleDependency and modifies the dependency to select the variant of the given module as described in modify(ModuleDependency) . |
protected abstract void |
modifyImplementation(ModuleDependency dependency) |
Modify the given dependency.
|
protected DependencyModifier()
@Inject protected abstract DependencyFactory getDependencyFactory()
Dependency
instances.DependencyFactory
public final ExternalModuleDependency modify(java.lang.CharSequence dependencyNotation)
ExternalModuleDependency
from the given notation and modifies it to select the variant of the given module as described in modify(ModuleDependency)
.dependencyNotation
- the dependency notationDependencyFactory.create(CharSequence)
public final Provider<? extends MinimalExternalModuleDependency> modify(ProviderConvertible<? extends MinimalExternalModuleDependency> providerConvertibleToDependency)
Provider
to a MinimalExternalModuleDependency
and modifies the dependency to select the variant of the given module as described in modify(ModuleDependency)
.providerConvertibleToDependency
- the providerpublic final <D extends ModuleDependency> Provider<D> modify(Provider<D> providerToDependency)
Provider
to a ExternalModuleDependency
and modifies the dependency to select the variant of the given module as described in modify(ModuleDependency)
.providerToDependency
- the providerpublic final <D extends ModuleDependency> D modify(D dependency)
ModuleDependency
and modifies the dependency to select the variant of the given module. Dependency resolution may fail if the given module does not have a compatible variant.
The dependency will be copied, so the original dependency will not be modified.
D
- the type of the ModuleDependency
dependency
- the dependency to modifyprotected abstract void modifyImplementation(ModuleDependency dependency)
dependency
- the dependency to modify