mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix NewMultiplatformProjectImportingTest for newer plugin versions
GitOrigin-RevId: 72e3ad5f8d4eead2fb97fcc864e53bbc1f50c5a5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8b66f4c464
commit
ecd1b3aafe
+23
-17
@@ -20,38 +20,44 @@ public final class VersionMatcher {
|
||||
}
|
||||
|
||||
public boolean isVersionMatch(@Nullable TargetVersions targetVersions) {
|
||||
if (targetVersions == null || targetVersions.value().isEmpty()) return true;
|
||||
if (targetVersions == null) return true;
|
||||
return isVersionMatch(targetVersions.value(), targetVersions.checkBaseVersions());
|
||||
}
|
||||
|
||||
final GradleVersion current = adjust(myGradleVersion, targetVersions.checkBaseVersions());
|
||||
public boolean isVersionMatch(@Nullable String targetVersions, boolean checkBaseVersions) {
|
||||
if (targetVersions == null || targetVersions.isEmpty()) return true;
|
||||
|
||||
if (targetVersions.value().endsWith("+")) {
|
||||
String minVersion = targetVersions.value().substring(0, targetVersions.value().length() - 1);
|
||||
return compare(current, minVersion, targetVersions.checkBaseVersions()) >= 0;
|
||||
final GradleVersion current = adjust(myGradleVersion, checkBaseVersions);
|
||||
|
||||
if (targetVersions.endsWith("+")) {
|
||||
String minVersion = targetVersions.substring(0, targetVersions.length() - 1);
|
||||
return compare(current, minVersion, checkBaseVersions) >= 0;
|
||||
}
|
||||
else if (targetVersions.value().startsWith("<")) {
|
||||
if (targetVersions.value().startsWith("<=")) {
|
||||
String maxVersion = targetVersions.value().substring(2);
|
||||
return compare(current, maxVersion, targetVersions.checkBaseVersions()) <= 0;
|
||||
else if (targetVersions.startsWith("<")) {
|
||||
if (targetVersions.startsWith("<=")) {
|
||||
String maxVersion = targetVersions.substring(2);
|
||||
return compare(current, maxVersion, checkBaseVersions) <= 0;
|
||||
}
|
||||
else {
|
||||
String maxVersion = targetVersions.value().substring(1);
|
||||
return compare(current, maxVersion, targetVersions.checkBaseVersions()) < 0;
|
||||
String maxVersion = targetVersions.substring(1);
|
||||
return compare(current, maxVersion, checkBaseVersions) < 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
final int rangeIndex = targetVersions.value().indexOf(RANGE_TOKEN);
|
||||
final int rangeIndex = targetVersions.indexOf(RANGE_TOKEN);
|
||||
if (rangeIndex != -1) {
|
||||
String minVersion = targetVersions.value().substring(0, rangeIndex);
|
||||
String maxVersion = targetVersions.value().substring(rangeIndex + RANGE_TOKEN.length());
|
||||
return compare(current, minVersion, targetVersions.checkBaseVersions()) >= 0 &&
|
||||
compare(current, maxVersion, targetVersions.checkBaseVersions()) <= 0;
|
||||
String minVersion = targetVersions.substring(0, rangeIndex);
|
||||
String maxVersion = targetVersions.substring(rangeIndex + RANGE_TOKEN.length());
|
||||
return compare(current, minVersion, checkBaseVersions) >= 0 &&
|
||||
compare(current, maxVersion, checkBaseVersions) <= 0;
|
||||
}
|
||||
else {
|
||||
return compare(current, targetVersions.value(), targetVersions.checkBaseVersions()) == 0;
|
||||
return compare(current, targetVersions, checkBaseVersions) == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static int compare(@NotNull GradleVersion gradleVersion, @NotNull String otherGradleVersion, boolean checkBaseVersions) {
|
||||
return gradleVersion.compareTo(adjust(GradleVersion.version(otherGradleVersion), checkBaseVersions));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user