Skip to content

Commit

Permalink
Use delegate annotation on ResolutionStrategyWithCurrent
Browse files Browse the repository at this point in the history
  • Loading branch information
ferinagy committed Aug 28, 2019
1 parent 3d5119a commit 118f516
Showing 1 changed file with 2 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,21 @@ import groovy.transform.TupleConstructor
import org.gradle.api.Action
import org.gradle.api.artifacts.DependencyResolveDetails
import org.gradle.api.artifacts.DependencySubstitutions
import org.gradle.api.artifacts.ModuleVersionSelector
import org.gradle.api.artifacts.ResolutionStrategy
import org.gradle.api.artifacts.ResolutionStrategy.SortOrder

@TupleConstructor(includeFields = true)
class ResolutionStrategyWithCurrent {

@Delegate(interfaces = false, excludes = ['componentSelection', 'getComponentSelection'])
private ResolutionStrategy delegate

private Map<Coordinate.Key, Coordinate> currentCoordinates

ResolutionStrategyWithCurrent failOnVersionConflict() {
delegate.failOnVersionConflict()
return this
}

void preferProjectModules() {
delegate.preferProjectModules()
}

ResolutionStrategyWithCurrent activateDependencyLocking() {
delegate.activateDependencyLocking()
return this
Expand All @@ -39,31 +35,11 @@ class ResolutionStrategyWithCurrent {
return this
}

Set<ModuleVersionSelector> getForcedModules() {
return delegate.getForcedModules()
}

ResolutionStrategyWithCurrent eachDependency(Action<? super DependencyResolveDetails> rule) {
delegate.eachDependency(rule)
return this
}

void cacheDynamicVersionsFor(int value, String units) {
delegate.cacheDynamicVersionsFor(value, units)
}

void cacheDynamicVersionsFor(int value, TimeUnit units) {
delegate.cacheDynamicVersionsFor(value, units)
}

void cacheChangingModulesFor(int value, String units) {
delegate.cacheChangingModulesFor(value, units)
}

void cacheChangingModulesFor(int value, TimeUnit units) {
delegate.cacheChangingModulesFor(value, units)
}

ComponentSelectionRulesWithCurrent getComponentSelection() {
return new ComponentSelectionRulesWithCurrent(delegate.getComponentSelection(),
currentCoordinates)
Expand All @@ -85,17 +61,9 @@ class ResolutionStrategyWithCurrent {
})
}

DependencySubstitutions getDependencySubstitution() {
return delegate.getDependencySubstitution()
}

ResolutionStrategyWithCurrent dependencySubstitution(
Action<? super DependencySubstitutions> action) {
delegate.dependencySubstitution(action)
return this
}

void sortArtifacts(SortOrder sortOrder) {
delegate.sortArtifacts(sortOrder)
}
}

0 comments on commit 118f516

Please sign in to comment.