public void messageLogged(BuildEvent event) { if (event.getPriority() == Project.MSG_INFO || event.getPriority() == Project.MSG_WARN || event.getPriority() == Project.MSG_ERR) { MyBuildFileTest.this.logBuffer.append(event.getMessage()); MyBuildFileTest.this.logBuffer.append('\n'); } }
@Override public void messageLogged(BuildEvent be) { TraceManager.GetTrace() .trace( new Entry( String.format("", be.getMessage()), be.getPriority() != Project.MSG_ERR ? SeverityType.INFO : SeverityType.ERROR)); }
/** * Fired when a task starts building, this pushes a timed element for the task onto the stack of * elements for the current thread, remembering the current time and the name of the task. * * @param event An event with any relevant extra information. Will not be <code>null</code>. */ public void taskStarted(BuildEvent event) { TimedElement taskElement = new TimedElement(); taskElement.startTime = System.currentTimeMillis(); taskElement.element = doc.createElement(TASK_TAG); Task task = event.getTask(); String name = event.getTask().getTaskName(); if (name == null) { name = ""; } taskElement.element.setAttribute(NAME_ATTR, name); taskElement.element.setAttribute(LOCATION_ATTR, event.getTask().getLocation().toString()); tasks.put(task, taskElement); getStack().push(taskElement); }
/** * Fired when a task finishes building, this adds the time taken and any error stacktrace to the * appropriate task element in the log. * * @param event An event with any relevant extra information. Will not be <code>null</code>. */ public void taskFinished(BuildEvent event) { Task task = event.getTask(); TimedElement taskElement = (TimedElement) tasks.get(task); if (taskElement != null) { long totalTime = System.currentTimeMillis() - taskElement.startTime; // taskElement.element.setAttribute(TIME_ATTR, // DefaultLogger.formatTime(totalTime)); Target target = task.getOwningTarget(); TimedElement targetElement = null; if (target != null) { targetElement = (TimedElement) targets.get(target); } if (targetElement == null) { buildElement.element.appendChild(taskElement.element); } else { targetElement.element.appendChild(taskElement.element); } Stack threadStack = getStack(); if (!threadStack.empty()) { TimedElement poppedStack = (TimedElement) threadStack.pop(); if (poppedStack != taskElement) { throw new RuntimeException( "Mismatch - popped element = " + poppedStack + " finished task element = " + taskElement); } } tasks.remove(task); } else { throw new RuntimeException("Unknown task " + task + " not in " + tasks); } }
/** * Fired when a target finishes building, this adds the time taken and any error stacktrace to the * appropriate target element in the log. * * @param event An event with any relevant extra information. Will not be <code>null</code>. */ public void targetFinished(BuildEvent event) { System.out.println("target finished in cruise control HeliumCCLogger"); Target target = event.getTarget(); TimedElement targetElement = (TimedElement) targets.get(target); if (targetElement != null) { long totalTime = System.currentTimeMillis() - targetElement.startTime; // targetElement.element.setAttribute(TIME_ATTR, // DefaultLogger.formatTime(totalTime)); TimedElement parentElement = null; Stack threadStack = getStack(); if (!threadStack.empty()) { TimedElement poppedStack = (TimedElement) threadStack.pop(); if (poppedStack != targetElement) { throw new RuntimeException( "Mismatch - popped element = " + poppedStack + " finished target element = " + targetElement); } if (!threadStack.empty()) { parentElement = (TimedElement) threadStack.peek(); } } if (parentElement == null) { buildElement.element.appendChild(targetElement.element); } else { parentElement.element.appendChild(targetElement.element); } } targets.remove(target); }
@Override public void buildStarted(BuildEvent be) { TraceManager.BeginTrace(); if (autoTrace) TraceManager.GetTrace() .beginEntry( String.format("Start build '%'.", be.getProject().getName()), SeverityType.INFO); }
/** * Fired when a target starts building, this pushes a timed element for the target onto the stack * of elements for the current thread, remembering the current time and the name of the target. * * @param event An event with any relevant extra information. Will not be <code>null</code>. */ public void targetStarted(BuildEvent event) { System.out.println("target started in cruise control HeliumCCLogger"); Target target = event.getTarget(); TimedElement targetElement = new TimedElement(); targetElement.startTime = System.currentTimeMillis(); targetElement.element = doc.createElement(TARGET_TAG); targetElement.element.setAttribute(NAME_ATTR, target.getName()); targets.put(target, targetElement); getStack().push(targetElement); }
@Override void preModule(BuildEvent event) throws InterruptedException, IOException, AbortException { File baseDir = event.getProject().getBaseDir(); // TODO: find the module that contains this path? // ModuleName name = new ModuleName(event.getProject().getBaseDir()); // IvyBuildProxy2 proxy = proxies.get(name); // listener.getLogger().flush(); // make sure the data until here are all written // proxy.start(); // for (IvyReporter r : reporters.get(name)) // if(!r.preBuild(proxy,event,listener)) // throw new AbortException(r+" failed"); }
/** * Fired when the build finishes, this adds the time taken and any error stacktrace to the build * element and writes the document to disk. * * @param event An event with any relevant extra information. Will not be <code>null</code>. */ public void buildFinished(BuildEvent event) { long totalTime = System.currentTimeMillis() - buildElement.startTime; // buildElement.element.setAttribute(TIME_ATTR, // DefaultLogger.formatTime(totalTime)); System.out.println("Build finished in cruise control HeliumCCLogger"); if (event.getException() != null) { System.out.println("Build finished exception occured in cruise control HeliumCCLogger"); System.out.println("Build finished exception is:-----" + event.getException().toString()); buildElement.element.setAttribute(ERROR_ATTR, event.getException().toString()); // print the stacktrace in the build file it is always useful... // better have too much info than not enough. Throwable t = event.getException(); Text errText = doc.createCDATASection(StringUtils.getStackTrace(t)); Element stacktrace = doc.createElement(STACKTRACE_TAG); stacktrace.appendChild(errText); buildElement.element.appendChild(stacktrace); } String outFilename = event.getProject().getProperty("HeliumCCLogger.file"); System.out.println("Build finished writing to log file1" + outFilename); if (outFilename == null) { outFilename = "log.xml"; } System.out.println("Build finished writing to log file2"); String xslUri = event.getProject().getProperty("ant.HeliumCCLogger.stylesheet.uri"); if (xslUri == null) { xslUri = "log.xsl"; } System.out.println("Build finished writing to log file3"); Writer out = null; try { // specify output in UTF8 otherwise accented characters will blow // up everything System.out.println("Build finished writing to log file3"); OutputStream stream = outStream; if (stream == null) { stream = new FileOutputStream(outFilename); } out = new OutputStreamWriter(stream, "UTF8"); System.out.println("Build finished writing to log file4"); out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); if (xslUri.length() > 0) { out.write("<?xml-stylesheet type=\"text/xsl\" href=\"" + xslUri + "\"?>\n\n"); } System.out.println("Build finished writing to log file5"); (new DOMElementWriter()).write(buildElement.element, out, 0, "\t"); out.flush(); } catch (IOException exc) { System.out.println("Build finished writing to log file6"); throw new BuildException("Unable to write log file", exc); } finally { System.out.println("Build finished writing to log file7"); if (out != null) { try { out.close(); } catch (IOException e) { // ignore e = null; } } } buildElement = null; }
/* (non-Javadoc) * @see org.apache.tools.ant.BuildListener#taskStarted(org.apache.tools.ant.BuildEvent) */ public void taskStarted(BuildEvent event) { logger.debug("Ant Task Started: " + event.getTask().getTaskName()); }
/* (non-Javadoc) * @see org.apache.tools.ant.BuildListener#targetStarted(org.apache.tools.ant.BuildEvent) */ public void targetStarted(BuildEvent event) { logger.info("Ant Target Started: " + event.getTarget().getName()); }
/* (non-Javadoc) * @see org.apache.tools.ant.BuildListener#messageLogged(org.apache.tools.ant.BuildEvent) */ public void messageLogged(BuildEvent event) { logger.info("Ant Message: " + event.getMessage()); }
public void targetFinished(BuildEvent event) { targetsFinished.add(event.getTarget().getName()); }
public void targetFinished(BuildEvent buildEvent) { String targetName = buildEvent.getTarget().getName(); String eventName = GrailsNameUtils.getClassNameRepresentation(targetName) + "End"; triggerEvent(eventName, binding); }
/** * Fired when a message is logged, this adds a message element to the most appropriate parent * element (task, target or build) and records the priority and text of the message. * * @param event An event with any relevant extra information. Will not be <code>null</code>. */ public void messageLogged(BuildEvent event) { if (buildElement == null) { buildElement = new TimedElement(); buildElement.startTime = System.currentTimeMillis(); buildElement.element = doc.createElement(BUILD_TAG); } int priority = event.getPriority(); if (priority > msgOutputLevel) { return; } Element messageElement = doc.createElement(MESSAGE_TAG); String name = "debug"; switch (event.getPriority()) { case MSG_ERR: name = "error"; break; case MSG_WARN: name = "warn"; break; case MSG_INFO: name = "info"; break; default: name = "debug"; break; } messageElement.setAttribute(PRIORITY_ATTR, name); Throwable ex = event.getException(); if (MSG_DEBUG <= msgOutputLevel && ex != null) { Text errText = doc.createCDATASection(StringUtils.getStackTrace(ex)); Element stacktrace = doc.createElement(STACKTRACE_TAG); stacktrace.appendChild(errText); buildElement.element.appendChild(stacktrace); } Text messageText = doc.createCDATASection(event.getMessage()); messageElement.appendChild(messageText); TimedElement parentElement = null; Task task = event.getTask(); Target target = event.getTarget(); if (task != null) { parentElement = getTaskElement(task); } if (parentElement == null && target != null) { parentElement = (TimedElement) targets.get(target); } /* * if (parentElement == null) { Stack threadStack = (Stack) * threadStacks.get(Thread.currentThread()); if (threadStack != null) { * if (!threadStack.empty()) { parentElement = (TimedElement) * threadStack.peek(); } } } */ if (parentElement != null) { parentElement.element.appendChild(messageElement); } else { buildElement.element.appendChild(messageElement); } }
@Override public void taskStarted(BuildEvent be) { TraceManager.GetTrace() .beginEntry(String.format("Start task '%'.", be.getTarget().getName()), SeverityType.INFO); }
public void messageLogged(BuildEvent event) { messagesLogged.add(event.getMessage()); }
public void taskFinished(BuildEvent event) { tasksFinished.add(event.getTask().getTaskName()); }
public void taskStarted(BuildEvent event) { tasksStarted.add(event.getTask().getTaskName()); }
public void messageLogged(BuildEvent arg0) { fireModelChanged(new Event(arg0.getMessage(), 0, 0, action, PLATFORM)); }
/* (non-Javadoc) * @see org.apache.tools.ant.BuildListener#buildStarted(org.apache.tools.ant.BuildEvent) */ public void buildStarted(BuildEvent event) { logger.info("Ant Started Build: " + event.getMessage()); }
public void targetStarted(BuildEvent event) { targetsStarted.add(event.getTarget().getName()); }
/* (non-Javadoc) * @see org.apache.tools.ant.BuildListener#buildFinished(org.apache.tools.ant.BuildEvent) */ public void buildFinished(BuildEvent event) { logger.info("Ant Finished Build: " + event.getMessage()); }
public void targetFinished(BuildEvent event) { if (event.getTarget().getName().equals("spawn")) { buildFinished = true; } }