コード例 #1
0
  /** Note: Used by Grails tooling */
  public static boolean isGroovyVersionDisabledOrMissing(SpecifiedVersion version) {
    BundleDescription disabledBundle = null;
    disabledBundle = getDisabledBundleDescription(version);
    if (disabledBundle != null) {
      return true;
    }

    Bundle[] active = Platform.getBundles("org.codehaus.groovy", version.toVersionString());
    if (active == null) {
      return true;
    }

    // getBundles returns bundles with version >= specified version,
    // so must do one more check to see if there is a bundle where the
    // major.minor version matches
    for (Bundle bundle : active) {
      Version bundleVersion = bundle.getVersion();
      if (bundleVersion.getMajor() == version.majorVersion
          && bundleVersion.getMajor() == version.majorVersion) {
        return false;
      }
    }
    // no bundle with specifed version has been found
    return true;
  }