コード例 #1
0
 static BuildNumber getBuildNumber() {
   if (ourBuildNumber == null) {
     ourBuildNumber = BuildNumber.fromString(System.getProperty("idea.plugins.compatible.build"));
     if (ourBuildNumber == null) {
       ourBuildNumber = BUILD_NUMBER == null ? null : BuildNumber.fromString(BUILD_NUMBER);
       if (ourBuildNumber == null) {
         ourBuildNumber = BuildNumber.fallback();
       }
     }
   }
   return ourBuildNumber;
 }
コード例 #2
0
  public static boolean isIncompatible(final IdeaPluginDescriptor descriptor) {
    try {
      BuildNumber buildNumber = getBuildNumber();

      if (!StringUtil.isEmpty(descriptor.getSinceBuild())) {
        BuildNumber sinceBuild =
            BuildNumber.fromString(descriptor.getSinceBuild(), descriptor.getName());
        if (sinceBuild.compareTo(buildNumber) > 0) {
          return true;
        }
      }

      if (!StringUtil.isEmpty(descriptor.getUntilBuild()) && !buildNumber.isSnapshot()) {
        BuildNumber untilBuild =
            BuildNumber.fromString(descriptor.getUntilBuild(), descriptor.getName());
        if (untilBuild.compareTo(buildNumber) < 0) {
          return true;
        }
      }
    } catch (RuntimeException ignored) {
    }

    return false;
  }