Java Code Examples for org.apache.tools.ant.taskdefs.CallTarget#setTarget()

The following examples show how to use org.apache.tools.ant.taskdefs.CallTarget#setTarget() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Repeat.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Execute this task. */
public void execute () throws BuildException {        
    if ( values.isEmpty() ) {
        throw new BuildException("You must set at least one value!", getLocation());
    }

    if ( target == null ) {
        throw new BuildException("Target must be set!", getLocation());
    }

    for (String val : values) {
        log ("Process '" + val + "' location with '" + target + "' target ...", Project.MSG_VERBOSE);
        
        CallTarget antCall = (CallTarget) getProject().createTask("antcall");
        antCall.init();
        antCall.setLocation(getLocation());
        
        // ant.setDir (dir);
        antCall.setTarget (target);
        Property prop = antCall.createParam();
        prop.setName(name);
        prop.setValue(val);
        
        antCall.execute();
    }
}
 
Example 2
Source File: Repeat.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
/** Execute this task. */
public void execute () throws BuildException {        
    if ( values.isEmpty() ) {
        throw new BuildException("You must set at least one value!", getLocation());
    }

    if ( target == null ) {
        throw new BuildException("Target must be set!", getLocation());
    }

    for (String val : values) {
        log ("Process '" + val + "' location with '" + target + "' target ...", Project.MSG_VERBOSE);
        
        CallTarget antCall = (CallTarget) getProject().createTask("antcall");
        antCall.init();
        antCall.setLocation(getLocation());
        
        // ant.setDir (dir);
        antCall.setTarget (target);
        Property prop = antCall.createParam();
        prop.setName(name);
        prop.setValue(val);
        
        antCall.execute();
    }
}
 
Example 3
Source File: IvyDeliver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public void deliverDependency(ModuleRevisionId depMrid, String version, String status,
        String depStatus) {
    if (isNullOrEmpty(deliverTarget)) {
        return;
    }
    // call deliver target if any
    CallTarget ct = (CallTarget) getProject().createTask("antcall");
    ct.setOwningTarget(getOwningTarget());
    ct.init();
    ct.setTarget(deliverTarget);
    ct.setInheritAll(true);
    ct.setInheritRefs(true);
    Property param = ct.createParam();
    param.setName("dependency.name");
    param.setValue(depMrid.getName());
    param = ct.createParam();
    param.setName("dependency.published.status");
    param.setValue(status);
    param = ct.createParam();
    param.setName("dependency.published.version");
    param.setValue(version);
    param = ct.createParam();
    param.setName("dependency.version");
    param.setValue(depMrid.getRevision());
    param = ct.createParam();
    param.setName("dependency.status");
    param.setValue(depStatus == null ? "null" : depStatus);

    ct.perform();

    String deliveredProperty = depMrid.getName() + "." + depMrid.getRevision()
            + ".delivered";
    getProject().setProperty(deliveredProperty, "true");
    appendDeliveryList(deliveredProperty + " = true");

    getProject().setProperty("recursive." + depMrid.getName() + ".delivered", "true");
    appendDeliveryList("recursive." + depMrid.getName() + ".delivered" + " = true");
}
 
Example 4
Source File: AntCallTrigger.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public void progress(IvyEvent event) {
    Project project = (Project) IvyContext.peekInContextStack(IvyTask.ANT_PROJECT_CONTEXT_KEY);
    if (project == null) {
        Message.info("ant call trigger can only be used from an ant build. Ignoring.");
        return;
    }
    if (onlyonce && isTriggered(event)) {
        Message.verbose("call already triggered for this event, skipping: " + event);
    } else {
        CallTarget call = new CallTarget();

        call.setProject(project);
        call.setTaskName("antcall");

        Map<String, String> attributes = event.getAttributes();
        String target = IvyPatternHelper.substituteTokens(getTarget(), attributes);
        call.setTarget(target);

        for (Map.Entry<String, String> entry : attributes.entrySet()) {
            Property p = call.createParam();
            p.setName(prefix == null ? entry.getKey() : prefix + entry.getKey());
            p.setValue(entry.getValue() == null ? "" : entry.getValue());
        }

        Message.verbose("triggering ant call: target=" + target + " for " + event);
        call.execute();
        markTriggered(event);

        Message.debug("triggered ant call finished: target=" + target + " for " + event);
    }
}