org.apache.tools.ant.BuildEvent Java Examples
The following examples show how to use
org.apache.tools.ant.BuildEvent.
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: MyBuildFileRule.java From ph-schematron with Apache License 2.0 | 6 votes |
/** * 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'); }
Example #2
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@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; } } }
Example #3
Source File: NbBuildLogger.java From netbeans with Apache License 2.0 | 6 votes |
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(); } }
Example #4
Source File: NbBuildLogger.java From netbeans with Apache License 2.0 | 6 votes |
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(); } }
Example #5
Source File: AntLoggingAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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()); } }
Example #6
Source File: AntLoggingAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
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()); } }
Example #7
Source File: AntLoggingAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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()); } }
Example #8
Source File: LangtoolsIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@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; } } }
Example #9
Source File: LangtoolsIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void messageLogged(BuildEvent event) { String msg = event.getMessage(); boolean processed = false; if (!tasks.isEmpty()) { Task task = tasks.peek(); for (MessageKind messageKind : task.msgs) { if (messageKind.matches(msg)) { event.setMessage(msg, messageKind.priority); processed = true; if (messageKind == MessageKind.JAVAC_CRASH) { crashFound = true; } break; } } } if (event.getPriority() == MSG_ERR || crashFound) { //we log errors regardless of owning task logger.messageLogged(event); suppressTaskFailures = true; } else if (processed) { logger.messageLogged(event); } }
Example #10
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void targetFinished(BuildEvent event) { if (!statusEvents.isEmpty()) { StatusEvent lastEvent = statusEvents.pop(); if (lastEvent.target.matches(event.getTarget().getName())) { logger.taskFinished(lastEvent); } } }
Example #11
Source File: NbBuildLogger.java From netbeans with Apache License 2.0 | 5 votes |
/** * Create a new regular event. * @param e the Ant build event * @param msgLogged true for logged events */ public Event(BuildEvent e, boolean msgLogged) { this.e = e; exception = e.getException(); if (msgLogged) { level = e.getPriority(); } else { level = -1; } }
Example #12
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void taskStarted(BuildEvent event) { String taskName = event.getTask().getTaskName(); System.err.println("task started " + taskName); for (Task task : Task.values()) { if (task.matches(taskName)) { tasks.push(task); return; } } }
Example #13
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void messageLogged(BuildEvent event) { String msg = event.getMessage(); boolean processed = false; if (!tasks.isEmpty()) { Task task = tasks.peek(); for (MessageKind messageKind : task.msgs) { if (messageKind.matches(msg)) { event.setMessage(msg, messageKind.priority); processed = true; if (messageKind == MessageKind.JAVAC_CRASH) { crashFound = true; } break; } } } if (event.getPriority() == MSG_ERR || crashFound) { //we log errors regardless of owning task logger.messageLogged(event); suppressTaskFailures = true; } else if (processed) { logger.messageLogged(event); } }
Example #14
Source File: NbBuildLogger.java From netbeans with Apache License 2.0 | 5 votes |
public @Override void taskStarted(BuildEvent ev) { AntBridge.suspendDelegation(); try { checkForStop(); setLastTask(ev.getTask()); AntEvent e = LoggerTrampoline.ANT_EVENT_CREATOR.makeAntEvent(new Event(ev, false)); LOG.log(Level.FINE, "taskStarted: {0}", e); for (AntLogger l : getInterestedLoggersByEvent(e)) { try { l.taskStarted(e); } catch (RuntimeException x) { LOG.log(Level.WARNING, null, x); } } if ("input".equals(e.getTaskName())) { // #81139; NOI18N TaskStructure s = e.getTaskStructure(); if (s != null) { String def = s.getAttribute("defaultvalue"); // NOI18N if (def != null) { NbInputHandler.setDefaultValue(e.evaluate(def)); } } } if (isRunTask(e)) { insideRunTask = true; } } finally { AntBridge.resumeDelegation(); } }
Example #15
Source File: TestRunner.java From compliance with Apache License 2.0 | 5 votes |
/** * Signals that the last target has finished. This event * will still be fired if an error occurred during the build. * * @param event An event with any relevant extra information. * Must not be <code>null</code>. * @see BuildEvent#getException() */ @Override public void buildFinished(BuildEvent event) { /* ******* post-Test reporting ********* */ // ant file runs junitreporter, so those reports are done // just log the traffic, until we write the coverage-tests for (Table.Cell<String, String, Integer> cell : Base.getMessages().cellSet()) { trafficlog.info(cell.getRowKey() + " " + cell.getColumnKey() + " " + cell.getValue()); } String todir = event.getProject().getUserProperty("ctk.todir"); log.debug("buildFinished for " + todir); // signal the listener to proceed result.complete(todir +"report/html/index.html"); }
Example #16
Source File: LangtoolsIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void targetFinished(BuildEvent event) { if (!statusEvents.isEmpty()) { StatusEvent lastEvent = statusEvents.pop(); if (lastEvent.target.matches(event.getTarget().getName())) { logger.taskFinished(lastEvent); } } }
Example #17
Source File: LangtoolsIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void taskStarted(BuildEvent event) { String taskName = event.getTask().getTaskName(); for (Task task : Task.values()) { if (task.matches(taskName)) { tasks.push(task); return; } } }
Example #18
Source File: AntTestListener.java From ant-ivy with Apache License 2.0 | 5 votes |
/** * Fired whenever a message is logged. * * @param event * BuildEvent * @see BuildEvent#getMessage() * @see BuildEvent#getPriority() */ public void messageLogged(BuildEvent event) { if (event.getPriority() > logLevel) { // ignore event return; } buildLog.append(event.getMessage()); }
Example #19
Source File: NameBearerHandle.java From gate-core with GNU Lesser General Public License v3.0 | 5 votes |
/** * This is called for every log message (of any priority). If the * current process has been interrupted (the user pressed the stop * button) then we throw an exception to interrupt the currently * executing Ant task. Other than that, we simply pass INFO and * higher messages to the GATE status listener. */ @Override public void messageLogged(BuildEvent buildEvent) { // check for interruption if(interrupted) { interrupted = false; throw new BuildException("Export interrupted"); } if(buildEvent.getPriority() <= Project.MSG_INFO) { statusChanged(buildEvent.getMessage()); } // log the message to log4j for debugging purposes log.debug(buildEvent.getPriority() + ": " + buildEvent.getMessage()); }
Example #20
Source File: LangtoolsIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void taskFinished(BuildEvent event) { if (tasks.peek() == Task.ROOT) { //we need to 'close' the root task to get nicer output logger.taskFinished(event); } else if (!suppressTaskFailures && event.getException() != null) { //the first (innermost) task failure should always be logged event.setMessage(event.getException().toString(), 0); event.setException(null); //note: we turn this into a plain message to avoid stack trace being logged by Idea logger.messageLogged(event); suppressTaskFailures = true; } tasks.pop(); }
Example #21
Source File: NameBearerHandle.java From gate-core with GNU Lesser General Public License v3.0 | 5 votes |
/** * Set status message appropriately when task completes or fails. */ @Override public void taskFinished(BuildEvent buildEvent) { if(buildEvent.getException() != null) { statusChanged("Error exporting application"); } else { statusChanged("Export complete"); } }
Example #22
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override String getDisplayMessage(BuildEvent e) { return "Executing Ant target(s): " + e.getProject().getProperty("ant.project.invoked-targets"); }
Example #23
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override String getDisplayMessage(BuildEvent e) { return "Building images..."; }
Example #24
Source File: AntSLF4JLogger.java From spoofax with Apache License 2.0 | 4 votes |
@Override public void targetFinished(BuildEvent event) { log.info("Finished target {}", event.getTarget().getName()); }
Example #25
Source File: VfsTask.java From commons-vfs with Apache License 2.0 | 4 votes |
@Override public void buildFinished(final BuildEvent event) { closeManager(); }
Example #26
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override String getDisplayMessage(BuildEvent e) { return "Configuring build..."; }
Example #27
Source File: LangtoolsIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public void buildFinished(BuildEvent event) { //do nothing }
Example #28
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override String getDisplayMessage(BuildEvent e) { return "Building modules: " + e.getProject().getProperty("module.name") + "..."; }
Example #29
Source File: JdkIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override String getDisplayMessage(BuildEvent e) { return "Running jtreg tests: " + e.getProject().getProperty("jtreg.tests"); }
Example #30
Source File: LangtoolsIdeaAntLogger.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
StatusEvent(BuildEvent e, Target target) { super(new StatusTask(e, target.getDisplayMessage(e))); this.target = target; setMessage(getTask().getTaskName(), 2); }