com.prezi.pride.ivyversions.ResolverStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-pride-plugin Show documentation
Show all versions of gradle-pride-plugin Show documentation
Pride manages multiple Gradle modules as a single Gradle project
package com.prezi.pride.ivyversions;
import com.google.common.collect.ImmutableList;
import java.util.List;
public class ResolverStrategy {
private final List matchers;
public ResolverStrategy() {
ImmutableList.Builder matcherBuilder = ImmutableList.builder();
matcherBuilder.add(new VersionRangeMatcher(new ExactVersionMatcher()));
matcherBuilder.add(new SubVersionMatcher(new ExactVersionMatcher()));
matcherBuilder.add(new LatestVersionMatcher());
matcherBuilder.add(new ExactVersionMatcher());
this.matchers = matcherBuilder.build();
}
public boolean accept(String selector, String candidate) {
for (VersionMatcher matcher : matchers) {
if (matcher.canHandle(selector)) {
return matcher.accept(selector, candidate);
}
}
throw new IllegalArgumentException("Invalid version selector: " + selector);
}
}