当前位置: 首页>>代码示例>>Java>>正文


Java Task类代码示例

本文整理汇总了Java中org.apache.tools.ant.Task的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Task类属于org.apache.tools.ant包,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTaskName

import org.apache.tools.ant.Task; //导入依赖的package包/类
public @Override String getTaskName() {
    verifyRunning();
    if (e == null) {
        return null;
    }
    Task task = e.getTask();
    if (task != null) {
        return task.getRuntimeConfigurableWrapper().getElementTag();
    }
    // #49464: guess at task.
    Task lastTask = getLastTask();
    if (lastTask != null) {
        return lastTask.getRuntimeConfigurableWrapper().getElementTag();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NbBuildLogger.java

示例2: testPrescan

import org.apache.tools.ant.Task; //导入依赖的package包/类
public void testPrescan() throws Exception {
    File j = new File(getWorkDir(), "x.jar");
    try (OutputStream os = new FileOutputStream(j)) {
        JarOutputStream jos = new JarOutputStream(os, new Manifest(new ByteArrayInputStream("Manifest-Version: 1.0\nBundle-SymbolicName: org.eclipse.mylyn.bugzilla.core;singleton:=true\nExport-Package: org.eclipse.mylyn.internal.bugzilla.core;x-friends:=\"org.eclipse.mylyn.bugzilla.ide,org.eclipse.mylyn.bugzilla.ui\",org.eclipse.mylyn.internal.bugzilla.core.history;x-friends:=\"org.eclipse.mylyn.bugzilla.ide,org.eclipse.mylyn.bugzilla.ui\",org.eclipse.mylyn.internal.bugzilla.core.service;x-internal:=true\n".getBytes())));
        jos.flush();
        jos.close();
    }
    Info info = new MakeOSGi.Info();
    JarFile jf = new JarFile(j);
    try {
        assertEquals("org.eclipse.mylyn.bugzilla.core", MakeOSGi.prescan(jf, info, new Task() {}));
    } finally {
        jf.close();
    }
    assertEquals("[org.eclipse.mylyn.internal.bugzilla.core, org.eclipse.mylyn.internal.bugzilla.core.history, org.eclipse.mylyn.internal.bugzilla.core.service]", info.exportedPackages.toString());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:MakeOSGiTest.java

示例3: testInstallAllTargetWithClusters

import org.apache.tools.ant.Task; //导入依赖的package包/类
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("One dep: " + s, 1, s.size());
    assertEquals("Just dep on init", "init", s.iterator().next());
    
    int callTargets = 0;
    for (Task task : t.getTasks()) {
        if (task instanceof CallTarget) {
            callTargets++;
        }
    }
    assertEquals("One call target to build super cluster", 1, callTargets);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:InsertModuleAllTargetsTest.java

示例4: testInstallAllTargetWithoutClusters

import org.apache.tools.ant.Task; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:InsertModuleAllTargetsTest.java

示例5: validateAgainstAUDTDs

import org.apache.tools.ant.Task; //导入依赖的package包/类
static void validateAgainstAUDTDs(InputSource input, final Path updaterJar, final Task task) throws IOException, SAXException {
    XMLUtil.parse(input, true, false, XMLUtil.rethrowHandler(), new EntityResolver() {
        ClassLoader loader = new AntClassLoader(task.getProject(), updaterJar);
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            String remote = "http://www.netbeans.org/dtds/";
            if (systemId.startsWith(remote)) {
                String rsrc = "org/netbeans/updater/resources/" + systemId.substring(remote.length());
                URL u = loader.getResource(rsrc);
                if (u != null) {
                    return new InputSource(u.toString());
                } else {
                    task.log(rsrc + " not found in " + updaterJar, Project.MSG_WARN);
                }
            }
            return null;
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:MakeNBM.java

示例6: scanClasses

import org.apache.tools.ant.Task; //导入依赖的package包/类
private static void scanClasses(JarFile module, Set<String> importedPackages, Set<String> availablePackages, Task task) throws Exception {
    Map<String, byte[]> classfiles = new TreeMap<>();
    VerifyClassLinkage.read(module, classfiles, new HashSet<>(Collections.singleton(new File(module.getName()))), task, null);
    for (Map.Entry<String,byte[]> entry : classfiles.entrySet()) {
        String available = entry.getKey();
        int idx = available.lastIndexOf('.');
        if (idx != -1) {
            availablePackages.add(available.substring(0, idx));
        }
        for (String clazz : VerifyClassLinkage.dependencies(entry.getValue())) {
            if (classfiles.containsKey(clazz)) {
                // Part of the same module; probably not an external import.
                continue;
            }
            if (clazz.startsWith("java.")) {
                // No need to declare as an import.
                continue;
            }
            idx = clazz.lastIndexOf('.');
            if (idx != -1) {
                importedPackages.add(clazz.substring(0, idx));
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:MakeOSGi.java

示例7: execute

import org.apache.tools.ant.Task; //导入依赖的package包/类
public void execute() throws BuildException {
    // execute all nested tasks
    for ( Enumeration e = tasks.elements(); e.hasMoreElements(); ) {
        Task task = ( Task ) e.nextElement();
        if ( task instanceof Breakable ) {
            task.perform();
            if ( ( ( Breakable ) task ).doBreak() ) {
                setBreak( true );
                return ;
            }
        }
        else {
            task.perform();
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:ElseTask.java

示例8: addTask

import org.apache.tools.ant.Task; //导入依赖的package包/类
/**
 * Add a nested task to execute. <p>
 *
 * @param task  Nested task to execute. <p>
 */
public void addTask( Task task ) {
   if ( task instanceof ElseTask ) {
      if ( else_task == null ) {
         else_task = task;
         return ;
      }
      else {
         throw new BuildException( "Only one <else> allowed per If." );
      }
   }
   else if ( task instanceof BooleanConditionTask ) {
      if ( condition_task == null ) {
         condition_task = task;
         return ;
      }
      else {
         throw new BuildException( "Only one <bool> allowed per If." );
      }
   }
   tasks.addElement( task );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:IfTask.java

示例9: doIf

import org.apache.tools.ant.Task; //导入依赖的package包/类
/**
 * Do the 'if' part of the if/else.
 *
 * @exception BuildException  Description of the Exception
 */
private void doIf() throws BuildException {
   // execute all nested tasks
   for ( Enumeration e = tasks.elements(); e.hasMoreElements(); ) {
      Task task = ( Task ) e.nextElement();
      if ( task instanceof Breakable ) {
         task.perform();
         if ( ( ( Breakable ) task ).doBreak() ) {
            setBreak( true );
            return ;
         }
      }
      else {
         task.perform();
      }
   }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:IfTask.java

示例10: execute

import org.apache.tools.ant.Task; //导入依赖的package包/类
/**
 * Execute this task and all nested Tasks.
 *
 * @exception BuildException  Description of Exception
 */
public void execute() throws BuildException {
    Unset unset = new Unset();
    StringTokenizer st = new StringTokenizer(values, separator);
    while (st.hasMoreTokens()) {
        String value = st.nextToken();
        value = trim ? value.trim() : value;
        if (name != null) {
            unset.setName(name);
            unset.execute();
            getProject().setProperty(name, value);
        }
        for (Enumeration e = tasks.elements(); e.hasMoreElements(); ) {
            try {
                Task task = (Task) e.nextElement();
                task.perform();
            }
            catch (Exception ex) {
                if (failOnError)
                    throw new BuildException(ex.getMessage());
                else
                    log(ex.getMessage());
            }
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:Foreach.java

示例11: addTask

import org.apache.tools.ant.Task; //导入依赖的package包/类
/**
 * Add a nested task to Try.
 *
 * @param task  Nested task to try to execute
 */
public void addTask( Task task ) {
   if ( task instanceof CatchTask ) {
      if ( catchTask == null ) {
         catchTask = task;
         return ;
      } else {
         throw new BuildException( "Only one Catch allowed per Try." );
      }
   } else if ( task instanceof FinallyTask ) {
      if ( finallyTask == null ) {
         finallyTask = task;
         return ;
      } else {
         throw new BuildException( "Only one Finally allowed per Try." );
      }
   }
   tasks.addElement( task );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:TryTask.java

示例12: execute

import org.apache.tools.ant.Task; //导入依赖的package包/类
/**
 * Execute all tasks.
 *
 * @exception BuildException  Description of Exception
 */
public void execute() throws BuildException {
   for ( int i = initValue; i < maxValue; i += inc ) {
      if ( initName != null ) {
         getProject().setUserProperty( initName, String.valueOf( i ) );
      }
      Target target = new Target();
      target.setName( "for.subtarget" );
      getProject().addOrReplaceTarget( target );
      for ( Enumeration e = tasks.elements(); e.hasMoreElements();  ) {
         Task task = (Task)e.nextElement();
         addTaskToTarget( target, task );
      }
      
      target.execute();
   }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:ForTask.java

示例13: addTaskToTarget

import org.apache.tools.ant.Task; //导入依赖的package包/类
private void addTaskToTarget( Target target, Task task ) {
   UnknownElement replacement = new UnknownElement( taskType );  // shouldn't do taskType, for Ant 1.6 and later there is a getTaskType method
   replacement.setProject( getProject() );
   invokeMethod( replacement, "setTaskType", taskType );
   replacement.setTaskName( task.getTaskName() );
   replacement.setLocation( task.getLocation() );
   replacement.setOwningTarget( target );
   replacement.setRuntimeConfigurableWrapper( task.getRuntimeConfigurableWrapper() );
   invokeMethod( task.getRuntimeConfigurableWrapper(), "setProxy", replacement );
   replacement.maybeConfigure();
   log("replacement is a " + replacement.getTaskName() + ", " + replacement.getClass().getName());
   if (replacement instanceof TaskContainer) {
      log("replacement is a TaskContainer");
      invokeMethod(replacement, "handleChildren", new Object[]{this, this.getRuntimeConfigurableWrapper()});
   }
   target.addTask(replacement);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:ForTask.java

示例14: toArgument

import org.apache.tools.ant.Task; //导入依赖的package包/类
/**
 * <p>toArgument.</p>
 *
 * @param task a {@link org.apache.tools.ant.Task} object.
 * @return a {@link java.lang.String} object.
 */
public String toArgument(Task task)
{
	task.log(String.format("System Under Development Class \"%s\"", className), Project.MSG_VERBOSE);

	StringBuilder argumentBuilder = new StringBuilder(className);

	for (TextData argument : arguments)
	{
		task.log(String.format("\tArgument \"%s\"", argument), Project.MSG_VERBOSE);

		argumentBuilder.append(";").append(escapeSemiColon(argument.getText()));
	}

	return argumentBuilder.toString();
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:22,代码来源:SystemUnderDevelopmentElement.java

示例15: toArgument

import org.apache.tools.ant.Task; //导入依赖的package包/类
/**
 * <p>toArgument.</p>
 *
 * @param task a {@link org.apache.tools.ant.Task} object.
 * @return a {@link java.lang.String} object.
 */
public String toArgument(Task task)
{
	StringBuilder argumentBuilder = new StringBuilder();

	for(TextData include : includes) {

		if (argumentBuilder.length() > 0)
           {
			argumentBuilder.append(";");
		}

		argumentBuilder.append(include.getText());
		
		task.log(String.format("\tSection \"%s\"", include), Project.MSG_VERBOSE);
       }

	return argumentBuilder.toString();
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:25,代码来源:SectionElement.java


注:本文中的org.apache.tools.ant.Task类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。