org.apache.tools.ant.taskdefs.CallTarget Java Examples
The following examples show how to use
org.apache.tools.ant.taskdefs.CallTarget.
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: InsertModuleAllTargetsTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testInstallAllTargetWithClusters() { InsertModuleAllTargets insert = new InsertModuleAllTargets(); insert.setProject(p); insert.execute(); Object obj = p.getTargets().get("all-java.source.queries"); assertNotNull("Target found", obj); Target t = (Target)obj; Set<String> s = depsToNames(t.getDependencies()); assertEquals("Five dependencies: " + s, 5, s.size()); assertEquals(new HashSet<>(Arrays.asList("init", "all-openide.dialogs", "all-openide.util", "all-openide.util.lookup", "all-api.annotations.common")), s); int callTargets = 0; for (Task task : t.getTasks()) { if (task instanceof CallTarget) { callTargets++; } } assertEquals("No call targes", 0, callTargets); }
Example #2
Source File: InsertModuleAllTargetsTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testInstallAllTargetWithoutClusters() { InsertModuleAllTargets insert = new InsertModuleAllTargets(); insert.setProject(p); insert.setUseClusters(false); insert.execute(); Object obj = p.getTargets().get("all-java.source.queries"); assertNotNull("Target found", obj); Target t = (Target)obj; Set<String> s = depsToNames(t.getDependencies()); assertEquals("Three dependencies: " + s, 5, s.size()); assertTrue("on init", s.contains("init")); assertTrue("on all-openide.util", s.contains("all-openide.util")); assertTrue("on all-openide.util.lookup", s.contains("all-openide.util.lookup")); assertTrue("on all-api.annotations.common", s.contains("all-api.annotations.common")); assertTrue("on all-openide.dialogs", s.contains("all-openide.dialogs")); int callTargets = 0; for (Task task : t.getTasks()) { if (task instanceof CallTarget) { callTargets++; } } assertEquals("No call targes", 0, callTargets); }
Example #3
Source File: Repeat.java From netbeans with Apache License 2.0 | 6 votes |
/** 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 #4
Source File: Repeat.java From visualvm with GNU General Public License v2.0 | 6 votes |
/** 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 #5
Source File: IvyDeliver.java From ant-ivy with Apache License 2.0 | 5 votes |
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 #6
Source File: AntCallTrigger.java From ant-ivy with Apache License 2.0 | 5 votes |
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); } }