org.apache.tools.ant.Project.executeSortedTargets()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.apache.tools.ant.Project.executeSortedTargets()方法的一些代码示例,展示了Project.executeSortedTargets()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.executeSortedTargets()方法的具体详情如下:
包路径:org.apache.tools.ant.Project
类名称:Project
方法名:executeSortedTargets

Project.executeSortedTargets介绍

[英]Execute a Vector of sorted targets.
[中]

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Execute the specified target and any targets it depends on.
 *
 * @param targetName The name of the target to execute.
 *                   Must not be <code>null</code>.
 *
 * @exception BuildException if the build failed.
 */
public void executeTarget(final String targetName) throws BuildException {
  // sanity check ourselves, if we've been asked to build nothing
  // then we should complain
  if (targetName == null) {
    final String msg = "No target specified";
    throw new BuildException(msg);
  }
  // Sort and run the dependency tree.
  // Sorting checks if all the targets (and dependencies)
  // exist, and if there is any cycle in the dependency
  // graph.
  executeSortedTargets(topoSort(targetName, targets, false));
}

代码示例来源:origin: org.apache.ant/ant

/** {@inheritDoc}. */
public void executeTargets(Project project, String[] targetNames)
  throws BuildException {
    project.executeSortedTargets(
      project.topoSort(targetNames, project.getTargets(), false));
}

代码示例来源:origin: apache/groovy

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector<Target> targets = new Vector<Target>();
    for (final Enumeration<String> deps = newTarget.getDependencies(); deps.hasMoreElements();) {
      final String targetName = deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps=newTarget.getDependencies(); deps.hasMoreElements();)
    {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  } 
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps = newTarget.getDependencies(); deps.hasMoreElements();) {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.kohsuke.droovy/groovy

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps=newTarget.getDependencies(); deps.hasMoreElements();)
    {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  } 
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.codehaus.groovy/groovy-ant

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector<Target> targets = new Vector<Target>();
    for (final Enumeration<String> deps = newTarget.getDependencies(); deps.hasMoreElements();) {
      final String targetName = deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps=newTarget.getDependencies(); deps.hasMoreElements();)
    {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  } 
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

相关文章