Пример #1
0
  /**
   * Makes sure that all the dependencies exist, and then accept optional dependencies as real
   * dependencies.
   *
   * @throws IOException thrown if one or several mandatory dependencies doesn't exists.
   */
  /*package*/ void resolvePluginDependencies() throws IOException {
    List<String> missingDependencies = new ArrayList<String>();
    // make sure dependencies exist
    for (Dependency d : dependencies) {
      if (parent.getPlugin(d.shortName) == null) missingDependencies.add(d.toString());
    }
    if (!missingDependencies.isEmpty())
      throw new IOException(
          "Dependency " + Util.join(missingDependencies, ", ") + " doesn't exist");

    // add the optional dependencies that exists
    for (Dependency d : optionalDependencies) {
      if (parent.getPlugin(d.shortName) != null) dependencies.add(d);
    }
  }
 private String obtainClassOwnership() {
   if (this.classOwnership != null) {
     return this.classOwnership;
   }
   if (pm == null) {
     Jenkins j = Jenkins.getInstance();
     if (j != null) {
       pm = j.getPluginManager();
     }
   }
   if (pm == null) {
     return null;
   }
   // TODO: possibly recursively scan super class to discover dependencies
   PluginWrapper p = pm.whichPlugin(hudson.plugins.promoted_builds.PromotionProcess.class);
   this.classOwnership = p != null ? p.getShortName() + '@' + trimVersion(p.getVersion()) : null;
   return this.classOwnership;
 }