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


Java BuildListener类代码示例

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


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

示例1: configureProject

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
@Override
public void configureProject( String filename, int logLevel )
{
	super.configureProject( filename, logLevel );

	// The current listener that BuildFileTest uses does not add newlines with each log message.
	// Thus you cannot distinguish between separate log messages.
	// So we remove the default listener and add our own.
	// TODO Need to signal this to the Ant project

	int count = 0;
	Iterator< BuildListener > iterator = this.project.getBuildListeners().iterator();
	while( iterator.hasNext() )
	{
		BuildListener listener = iterator.next();
		if( listener.getClass().getName().equals( "org.apache.tools.ant.BuildFileTest$AntTestListener" ) )
		{
			iterator.remove();
			count++;
		}
	}
	Assert.assertEquals( count, 1 );

	this.logBuffer = new StringBuilder();
	this.project.addBuildListener( new MyAntTestListener( logLevel ) );
}
 
开发者ID:sindicate,项目名称:solidbase,代码行数:27,代码来源:MyBuildFileTest.java

示例2: getBuildListener

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
private BuildListener getBuildListener() {
   if (antListener == null) {
      DefaultLogger logger = new DefaultLogger();
      PrintStream ps = null;
      try {
         ps = new PrintStream(new File("log/bugReportLog.txt").getAbsolutePath());
         ps.print("");
      } catch (FileNotFoundException e) {
         StringWriter sw = new StringWriter();
         e.printStackTrace(new PrintWriter(sw));
         String exceptionDetails = sw.toString();
         LOG.warning(exceptionDetails);
      }
      if (ps == null) {
         logger.setErrorPrintStream(System.err);
         logger.setOutputPrintStream(System.out);
      } else {
         logger.setErrorPrintStream(ps);
         logger.setOutputPrintStream(ps);
      }
      logger.setMessageOutputLevel(Project.MSG_INFO);
      antListener = logger;
   }
   return antListener;
}
 
开发者ID:Loreinator,项目名称:Shuffle-Move,代码行数:26,代码来源:ShuffleModel.java

示例3: execute

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
/**
 * Executes this task.
 */
@SuppressWarnings("rawtypes")
public void execute() {
    if (logLevel == -1) {
        throw new BuildException("You must specify a log level");
    }

    Vector listeners = this.getProject().getBuildListeners();
    for (Iterator i = listeners.iterator(); i.hasNext();) {
        BuildListener listener = (BuildListener) i.next();

        if (listener instanceof BuildLogger) {
            BuildLogger logger = (BuildLogger) listener;
            logger.setMessageOutputLevel(logLevel);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:20,代码来源:SetLogLevelTask.java

示例4: disableAll

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
/**
    * Disable all blame listeners in the current project.
    */
@SuppressWarnings("deprecation")
private void disableAll() {
       int count = 0;

       // Obtain a list of listeners in the project
       @SuppressWarnings("unchecked")
	Vector<BuildListener> listeners = project.getBuildListeners();
       Object current = null;
       for (Enumeration<BuildListener> e = listeners.elements(); e.hasMoreElements(); ) {
           current = e.nextElement();
           if (current instanceof P4BlameListener) {
               P4BlameListener blame = (P4BlameListener) current;
               project.removeBuildListener(blame);
               blame.disable();
               count++;
           }
       }

       log("Disabled " + count + " P4BlameListeners in the current project.");
}
 
开发者ID:ModelN,项目名称:build-management,代码行数:24,代码来源:P4BlameDelete.java

示例5: addBuildListeners

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
/**
 * Adds the listeners specified in the command line arguments, along with
 * the default listener, to the specified project.
 * 
 * @param project
 *            The project to add listeners to. Must not be <code>null</code>
 *            .
 */
protected void addBuildListeners(Project project) {

	// Add the default listener
	project.addBuildListener(createLogger());

	final int count = listeners.size();
	for (int i = 0; i < count; i++) {
		String className = (String) listeners.elementAt(i);
		BuildListener listener = (BuildListener) ClasspathUtils
				.newInstance(className, Main.class.getClassLoader(),
						BuildListener.class);
		project.setProjectReference(listener);

		project.addBuildListener(listener);
	}
}
 
开发者ID:pmeisen,项目名称:ant-processenabler,代码行数:25,代码来源:Main.java

示例6: LangtoolsIdeaAntLogger

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
public LangtoolsIdeaAntLogger(Project project) {
    for (Object o : project.getBuildListeners()) {
        if (o instanceof DefaultLogger) {
            this.logger = (DefaultLogger)o;
            project.removeBuildListener((BuildListener)o);
            project.addBuildListener(this);
        }
    }
    logger.setMessageOutputLevel(3);
    tasks.push(Task.ROOT);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:LangtoolsIdeaAntLogger.java

示例7: JdkIdeaAntLogger

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
public JdkIdeaAntLogger(Project project) {
    for (Object o : project.getBuildListeners()) {
        if (o instanceof DefaultLogger) {
            this.logger = (DefaultLogger)o;
            project.removeBuildListener((BuildListener)o);
            project.addBuildListener(this);
        }
    }
    tasks.push(Task.ROOT);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:JdkIdeaAntLogger.java

示例8: LangtoolsIdeaAntLogger

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
public LangtoolsIdeaAntLogger(Project project) {
    for (Object o : project.getBuildListeners()) {
        if (o instanceof DefaultLogger) {
            this.logger = (DefaultLogger)o;
            project.removeBuildListener((BuildListener)o);
            project.addBuildListener(this);
        }
    }
    tasks.push(Task.ROOT);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:11,代码来源:LangtoolsIdeaAntLogger.java

示例9: parse

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
/**
 *
 * build.xml파일을 파싱처리하여
 * 빌드처리 준비상태로 처리한다.
 * 이후 run 함수를 호출하여 빌드를 실행할 수 있다.
 *
 * @작성자 : KYJ
 * @작성일 : 2017. 3. 7.
 */
public void parse() {

	p = new Project();
	p.setUserProperty("ant.file", buildFile.getAbsolutePath());
	p.setUserProperty("encoding", encoding.displayName());

	p.init();
	helper = ProjectHelper.getProjectHelper();
	p.addReference("ant.projectHelper", helper);

	if (baseDir != null && baseDir.exists())
		p.setBaseDir(baseDir);
	else
		p.setBaseDir(buildFile.getParentFile());

	//setting console
	DefaultLogger consoleLogger = getLogger();

	consoleLogger.setOutputPrintStream(new PrintStream(out));
	consoleLogger.setErrorPrintStream(new PrintStream(err));

	consoleLogger.setMessageOutputLevel(Project.MSG_VERBOSE);
	p.addBuildListener(consoleLogger);

	//parse build.xml
	helper.parse(p, buildFile);

	LOGGER.debug("  ##### base dir : " + p.getBaseDir());
	LOGGER.debug("  ##### default target : " + p.getDefaultTarget());

	//append build debugger.
	BuildListener buildListener = getBuildListener();
	if (buildListener != null)
		p.addBuildListener(buildListener);

	wasParse = true;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:47,代码来源:AntJavaCompiler.java

示例10: getBuildListener

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
protected BuildListener getBuildListener() {
	return null;
	/* debug.
	return new BuildListener() {

		@Override
		public void taskStarted(BuildEvent arg0) {
		}

		@Override
		public void taskFinished(BuildEvent arg0) {
		}

		@Override
		public void targetStarted(BuildEvent arg0) {
			write(String.format("### Target : %s [%s]\n", arg0.getTarget().getName(), "started"));
		}

		@Override
		public void targetFinished(BuildEvent arg0) {
			write(String.format("### Target : %s [%s]\n", arg0.getTarget().getName(), "finished"));
		}

		@Override
		public void messageLogged(BuildEvent arg0) {
		}

		@Override
		public void buildStarted(BuildEvent arg0) {
			write("build start\n");
		}

		@Override
		public void buildFinished(BuildEvent arg0) {
			write("build finished\n");
			compiled = true;
		}
	};
	*/
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:41,代码来源:AntJavaCompiler.java

示例11: AntRunner

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
public AntRunner(IResourceService resourceService, FileObject antFile, FileObject baseDir,
    Map<String, String> properties, @SuppressWarnings("unused") @Nullable URL[] classpaths,
    @Nullable BuildListener listener) {
    this.antProject = new Project();

    final File localAntFile = resourceService.localFile(antFile);
    final File localBaseDir = resourceService.localPath(baseDir);

    // TODO: use classpaths

    antProject.setProperty(MagicNames.ANT_FILE, localAntFile.getPath());
    antProject.setBaseDir(localBaseDir);
    antProject.init();
    if(listener != null) {
        antProject.addBuildListener(listener);
    }

    final PropertyHelper propHelper = PropertyHelper.getPropertyHelper(antProject);
    antProject.addReference(MagicNames.REFID_PROPERTY_HELPER, propHelper);
    for(Entry<String, String> property : properties.entrySet()) {
        propHelper.setUserProperty(property.getKey(), property.getValue());
    }

    final ProjectHelper projectHelper = ProjectHelper.getProjectHelper();
    antProject.addReference(MagicNames.REFID_PROJECT_HELPER, projectHelper);
    projectHelper.parse(antProject, localAntFile);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:28,代码来源:AntRunner.java

示例12: initialize

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
@FXML
public void initialize() {
	c = new AntJavaCompiler(this.buildFile.getParentFile(), this.buildFile) {
		@Override
		protected BuildListener getBuildListener() {
			return progressListener;
		}
	};
	c.parse();

	this.txtBuildFileLocation.setText(this.buildFile.getAbsolutePath());
	this.txtProjectName.setText(c.getProjectName());

	//		tcTargetName.setCellFactory(value);
	tcChkTarget.setCellFactory(CheckBoxTableCell.forTableColumn(tcChkTarget));
	tcChkTarget.setCellValueFactory(param -> param.getValue().chkProperty());

	tcTargetName.setCellFactory(TextFieldTableCell.forTableColumn());
	tcTargetName.setCellValueFactory(param -> param.getValue().targetNameProperty());
	tcTargetDesc.setCellFactory(TextFieldTableCell.forTableColumn());
	tcTargetDesc.setCellValueFactory(param -> param.getValue().targetDescProperty());

	List<AntRunConfigItem> collect = c.getTargets().entrySet().stream().map(ent -> {
		String key = ent.getKey();
		if (ValueUtil.isEmpty(key))
			return null;

		String desc = ent.getValue().getDescription() == null ? "" : ent.getValue().getDescription();
		AntRunConfigItem item = new AntRunConfigItem(key, desc);
		item.chkProperty().addListener(new ChangeListenerImpl(item));

		boolean equals = key.equals(c.getDefaultTarget());
		item.setChk(equals);
		if (equals)
			item.setTargetDesc("[default]  ".concat(desc));

		return item;
	}).filter(v -> v != null).collect(Collectors.toList());

	tbTargets.getItems().addAll(collect);

	tbTargets.setEditable(true);
	tcChkTarget.setEditable(true);
	tcTargetName.setEditable(false);
	tcTargetDesc.setEditable(false);

	//		Platform.runLater(()->{
	//
	//		});

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:52,代码来源:AntRunConfigView.java

示例13: DefaultAntBuilderFactory

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
public DefaultAntBuilderFactory(BuildListener buildListener, Project project) {
    this.buildListener = buildListener;
    this.project = project;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:5,代码来源:DefaultAntBuilderFactory.java

示例14: addBuildListener

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
public void addBuildListener(BuildListener arg0) {
	delegate.addBuildListener(arg0);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:4,代码来源:ProjectDelegate.java

示例15: removeBuildListener

import org.apache.tools.ant.BuildListener; //导入依赖的package包/类
public void removeBuildListener(BuildListener arg0) {
	delegate.removeBuildListener(arg0);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:4,代码来源:ProjectDelegate.java


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