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


Java BuildEvent类代码示例

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


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

示例1: messageLogged

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = getLogLevelForMessagePriority(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:AntLoggingAdapter.java

示例2: buildStarted

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public @Override void buildStarted(BuildEvent ev) {
    AntBridge.suspendDelegation();
    try {
        checkForStop();
        AntEvent e = LoggerTrampoline.ANT_EVENT_CREATOR.makeAntEvent(new Event(ev, false));
        LOG.log(Level.FINE, "buildStarted: {0}", e);
        for (AntLogger l : getInterestedLoggers()) {
            try {
                l.buildStarted(e);
            } catch (RuntimeException x) {
                LOG.log(Level.WARNING, null, x);
            }
        }
    } finally {
        AntBridge.resumeDelegation();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NbBuildLogger.java

示例3: targetFinished

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public @Override void targetFinished(BuildEvent ev) {
    AntBridge.suspendDelegation();
    try {
        checkForStop();
        setLastTask(null);
        AntEvent e = LoggerTrampoline.ANT_EVENT_CREATOR.makeAntEvent(new Event(ev, false));
        LOG.log(Level.FINE, "targetFinished: {0}", e);
        for (AntLogger l : getInterestedLoggersByEvent(e)) {
            try {
                l.targetFinished(e);
            } catch (RuntimeException x) {
                LOG.log(Level.WARNING, null, x);
            }
        }
    } finally {
        AntBridge.resumeDelegation();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:NbBuildLogger.java

示例4: taskFinished

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public @Override void taskFinished(BuildEvent ev) {
    AntBridge.suspendDelegation();
    try {
        checkForStop();
        setLastTask(null);
        AntEvent e = LoggerTrampoline.ANT_EVENT_CREATOR.makeAntEvent(new Event(ev, false));
        LOG.log(Level.FINE, "taskFinished: {0}", e);
        for (AntLogger l : getInterestedLoggersByEvent(e)) {
            try {
                l.taskFinished(e);
            } catch (RuntimeException x) {
                LOG.log(Level.WARNING, null, x);
            }
        }
        NbInputHandler.setDefaultValue(null);
        if (isRunTask(e)) {
            insideRunTask = false;
        }
    } finally {
        AntBridge.resumeDelegation();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:NbBuildLogger.java

示例5: messageLogged

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public synchronized void messageLogged(BuildEvent event) {
    final boolean failOnError = isFailOnError(event);
    if (sendException(event, failOnError)) {
        return;
    }

    int priority = event.getPriority();
    if (priority == Project.MSG_ERR && !failOnError) {
        // some ant tasks (like Copy) with 'failOnError' attribute set to 'false'
        // send warnings with priority level = Project.MSG_ERR
        // this heuristic corrects the priority level, so that IDEA considers the message not as an error but as a warning
        priority = Project.MSG_WARN;
    }

    final String message = event.getMessage();

    if (priority == Project.MSG_ERR) {
        myMessagePriority.sendMessage(ERROR, priority, message);
    } else {
        myMessagePriority.sendMessage(MESSAGE, priority, message);
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:HybrisIdeaAntLogger.java

示例6: processAnsiColor

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
private void processAnsiColor(final BuildEvent event) {
    String message = event.getMessage();
    if (message == null) {
        return;
    }
    message = message.replace(END_COLOR, "");
    message = removeLeadingChars(message, "\b ");
    Integer priorityOverride = getPriorityOverride(message);
    if (!message.startsWith(PREFIX)) {
        event.setMessage(message, getPriority(event.getPriority(), priorityOverride));
        return;
    }
    int mIndex = message.indexOf(SUFFIX);
    if (mIndex < 0) {
        event.setMessage(message, getPriority(event.getPriority(), priorityOverride));
        return;
    }
    String attribute = message.substring(PREFIX.length(), mIndex);
    int priority = getPriority(attribute);
    message = message.substring(mIndex + 1);
    event.setMessage(message, getPriority(priority, priorityOverride));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:HybrisAnsiAntLogger.java

示例7: targetStarted

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
@Override
public void targetStarted(BuildEvent event) {
    EnumSet<Target> statusKinds = firstTarget ?
            EnumSet.allOf(Target.class) :
            EnumSet.complementOf(EnumSet.of(Target.ANY));

    String targetName = event.getTarget().getName();

    for (Target statusKind : statusKinds) {
        if (statusKind.matches(targetName)) {
            StatusEvent statusEvent = new StatusEvent(event, statusKind);
            statusEvents.push(statusEvent);
            logger.taskStarted(statusEvent);
            firstTarget = false;
            return;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:LangtoolsIdeaAntLogger.java

示例8: buildPlugins

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public void buildPlugins() {
	BuildException be = null;
	try {
		BuildEvent startEvent = new BuildEvent(_builderProject);
		if (_cleanOnly) {
			startEvent.setMessage("CLEAN STARTED",0);
		} else {
			startEvent.setMessage("BUILD STARTED",0);
		}
		_pbListener.buildStarted(startEvent);
		_antBuilder.execute();
	} catch (BuildException e) {
		be = e;
	} finally {
		BuildEvent endEvent = new BuildEvent(_builderProject);
		if (be != null) {
			endEvent.setException(be);
		}
		_pbListener.buildFinished(endEvent);
		_pbListener.cleanup();
	}
}
 
开发者ID:drftpd-ng,项目名称:drftpd3,代码行数:23,代码来源:PluginBuilder.java

示例9: messageLogged

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public synchronized void messageLogged(BuildEvent event) {
  final boolean failOnError = isFailOnError(event);
  if (sendException(event, failOnError)) {
    return;
  }

  int priority = event.getPriority();
  if (priority == Project.MSG_ERR && !failOnError) {
    // some ant tasks (like Copy) with 'failOnError' attribute set to 'false'
    // send warnings with priority level = Project.MSG_ERR
    // this heuristic corrects the priority level, so that IDEA considers the message not as an error but as a warning
    priority = Project.MSG_WARN;
  }

  final String message = event.getMessage();

  if (priority == Project.MSG_ERR) {
    myMessagePriority.sendMessage(ERROR, priority, message);
  }
  else {
    myMessagePriority.sendMessage(MESSAGE, priority, message);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:IdeaAntLogger2.java

示例10: messageLogged

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:AntLoggingAdapter.java

示例11: messageLogged

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
/**
 * Fired whenever a message is logged.
 *
 * @see BuildEvent#getMessage()
 * @see BuildEvent#getPriority()
 */
public void messageLogged (final BuildEvent event)
{
  if (event.getPriority () > m_nLogLevel)
  {
    // ignore event
    return;
  }

  if (event.getPriority () == Project.MSG_INFO ||
      event.getPriority () == Project.MSG_WARN ||
      event.getPriority () == Project.MSG_ERR)
  {
    logBuffer.append (event.getMessage ()).append ('\n');
  }
  fullLogBuffer.append (event.getMessage ()).append ('\n');
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:23,代码来源:MyBuildFileRule.java

示例12: targetFinished

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
/**
 * @see BuildListener#targetFinished
 * {@inheritDoc}.
 */
@Override
public void targetFinished(final BuildEvent event) {
    if (initialized) {
        final String targetName = event.getTarget().getName();
        final Log log = getLog(TARGET_LOG,
                event.getTarget().getName());
        if (event.getException() == null) {
            realLog(log, "Target end: " + targetName, Project.MSG_DEBUG, null);
        } else {
            realLog(log, "Target \"" + targetName
                    + "\" finished with error.", Project.MSG_ERR,
                    event.getException());
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:20,代码来源:CommonsLoggingListener.java

示例13: taskStarted

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
/**
 * @see BuildListener#taskStarted
 * {@inheritDoc}.
 */
@Override
public void taskStarted(final BuildEvent event) {
    if (initialized) {
        final Task task = event.getTask();
        Object real = task;
        if (task instanceof UnknownElement) {
            final Object realObj = ((UnknownElement) task).getTask();
            if (realObj != null) {
                real = realObj;
            }
        }
        final Log log = getLog(real.getClass().getName(), null);
        if (log.isTraceEnabled()) {
            realLog(log, "Task \"" + task.getTaskName() + "\" started ",
                    Project.MSG_VERBOSE, null);
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:23,代码来源:CommonsLoggingListener.java

示例14: taskFinished

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
/**
 * @see BuildListener#taskFinished
 * {@inheritDoc}.
 */
@Override
public void taskFinished(final BuildEvent event) {
    if (initialized) {
        final Task task = event.getTask();
        Object real = task;
        if (task instanceof UnknownElement) {
            final Object realObj = ((UnknownElement) task).getTask();
            if (realObj != null) {
                real = realObj;
            }
        }
        final Log log = getLog(real.getClass().getName(), null);
        if (event.getException() == null) {
            if (log.isTraceEnabled()) {
                realLog(log, "Task \"" + task.getTaskName() + "\" finished.",
                        Project.MSG_VERBOSE, null);
            }
        } else {
            realLog(log, "Task \"" + task.getTaskName()
                    + "\" finished with error.", Project.MSG_ERR,
                    event.getException());
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:29,代码来源:CommonsLoggingListener.java

示例15: messageLogged

import org.apache.tools.ant.BuildEvent; //导入依赖的package包/类
public void messageLogged (@Nonnull final BuildEvent aEvent)
{
  if (aEvent.getPriority () <= Project.MSG_ERR)
    s_aLogger.error (aEvent.getMessage (), aEvent.getException ());
  else
    if (aEvent.getPriority () <= Project.MSG_WARN)
      s_aLogger.warn (aEvent.getMessage (), aEvent.getException ());
    else
      if (aEvent.getPriority () <= Project.MSG_INFO)
        s_aLogger.info (aEvent.getMessage (), aEvent.getException ());
      else
      {
        // Switch this from "debug" to "info" to get more output
        if (m_bDebugMode)
          s_aLogger.info (aEvent.getMessage (), aEvent.getException ());
        else
          s_aLogger.debug (aEvent.getMessage (), aEvent.getException ());
      }
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:20,代码来源:LoggingBuildListener.java


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