return !element.equals(GradleVersion.current());
}
};
}
if (trimmed.startsWith("=")) {
final GradleVersion target = GradleVersion.version(trimmed.substring(1)).getBaseVersion();
return new Spec<GradleVersion>() {
public boolean isSatisfiedBy(GradleVersion element) {
return element.getBaseVersion().equals(target);
}
};
}
List<Spec> specs = new ArrayList<Spec>();
String[] patterns = trimmed.split("\\s+");
for (String value : patterns) {
if (value.startsWith(">=")) {
final GradleVersion minVersion = GradleVersion.version(value.substring(2));
specs.add(new Spec<GradleVersion>() {
public boolean isSatisfiedBy(GradleVersion element) {
return element.getBaseVersion().compareTo(minVersion) >= 0;
}
});
} else if (value.startsWith(">")) {
final GradleVersion minVersion = GradleVersion.version(value.substring(1));
specs.add(new Spec<GradleVersion>() {
public boolean isSatisfiedBy(GradleVersion element) {
return element.getBaseVersion().compareTo(minVersion) > 0;
}
});
} else if (value.startsWith("<=")) {
final GradleVersion maxVersion = GradleVersion.version(value.substring(2));
specs.add(new Spec<GradleVersion>() {
public boolean isSatisfiedBy(GradleVersion element) {
return element.getBaseVersion().compareTo(maxVersion) <= 0;
}
});
} else if (value.startsWith("<")) {
final GradleVersion maxVersion = GradleVersion.version(value.substring(1));
specs.add(new Spec<GradleVersion>() {
public boolean isSatisfiedBy(GradleVersion element) {
return element.getBaseVersion().compareTo(maxVersion) < 0;
}
});