public static boolean isCompatible()

in nuget-common/src/jetbrains/buildServer/nuget/common/version/VersionUtility.java [177:217]


  public static boolean isCompatible(FrameworkName projectFrameworkName, FrameworkName packageTargetFrameworkName) {
    if (projectFrameworkName == null || packageTargetFrameworkName == null) return true;

    projectFrameworkName = normalizeFrameworkName(projectFrameworkName);
    packageTargetFrameworkName = normalizeFrameworkName(packageTargetFrameworkName);

    final String projectFrameworkIdentifier = projectFrameworkName.getIdentifier();
    final String packageTargetFrameworkIdentifier = packageTargetFrameworkName.getIdentifier();

    if (!projectFrameworkIdentifier.equalsIgnoreCase(packageTargetFrameworkIdentifier)){
      if (EQUIVALENT_PROJECT_FRAMEWORKS.containsKey(projectFrameworkIdentifier)){
        FrameworkName equivalentFrameworkName = EQUIVALENT_PROJECT_FRAMEWORKS.get(projectFrameworkIdentifier);
        if(equivalentFrameworkName.getIdentifier().equalsIgnoreCase(packageTargetFrameworkIdentifier)){
          projectFrameworkName = equivalentFrameworkName;
        }
      }
      else return false;
    }

    final Version projectFrameworkVersion = projectFrameworkName.getVersion();
    final Version packageTargetFrameworkVersion = packageTargetFrameworkName.getVersion();
    if (projectFrameworkVersion != null && packageTargetFrameworkVersion != null && projectFrameworkVersion.compareTo(packageTargetFrameworkVersion) < 0){
      return false;
    }

    final String projectFrameworkProfile = projectFrameworkName.getProfile();
    final String packageTargetFrameworkProfile = packageTargetFrameworkName.getProfile();

    if (StringUtil.areEqual(projectFrameworkProfile, packageTargetFrameworkProfile)){
      return true;
    }

    if (COMPATIBILTY_MAPPINGS.containsKey(projectFrameworkName.getIdentifier())){
      final Map<String, String> mapping = COMPATIBILTY_MAPPINGS.get(projectFrameworkName.getIdentifier());
      if (mapping.containsKey(packageTargetFrameworkProfile)) {
        return mapping.get(packageTargetFrameworkProfile).equalsIgnoreCase(projectFrameworkProfile);
      }
    }

    return false;
  }