/*
|
* To change this license header, choose License Headers in Project Properties.
|
* To change this template file, choose Tools | Templates
|
* and open the template in the editor.
|
*/
|
package de.uhilger.filecms.api;
|
|
import org.apache.tools.ant.BuildEvent;
|
import org.apache.tools.ant.BuildListener;
|
|
/**
|
*
|
* @author ulrich
|
*/
|
public class FileCmsBuildListener implements BuildListener {
|
|
private final StringBuilder output;
|
|
public FileCmsBuildListener() {
|
output = new StringBuilder();
|
}
|
|
public String getOutput() {
|
return output.toString();
|
}
|
|
private void appendEventInfo(BuildEvent be) {
|
Object elem;
|
output.append("Project: ");
|
output.append(be.getProject().getName());
|
elem = be.getTarget();
|
if(elem != null) {
|
output.append(", Target: ");
|
output.append(be.getTarget().getName());
|
}
|
elem = be.getTask();
|
if(elem != null) {
|
output.append(", Task: ");
|
output.append(be.getTask().getTaskName());
|
}
|
output.append(", Message: ");
|
output.append(be.getMessage());
|
}
|
|
@Override
|
public void buildStarted(BuildEvent be) {
|
output.append("<br/>");
|
output.append("BUILD STARTED - ");
|
appendEventInfo(be);
|
}
|
|
@Override
|
public void buildFinished(BuildEvent be) {
|
output.append("<br/>");
|
output.append("BUILD FINISHED - ");
|
appendEventInfo(be);
|
}
|
|
@Override
|
public void targetStarted(BuildEvent be) {
|
output.append("<br/>");
|
output.append("TARGET STARTED - ");
|
appendEventInfo(be);
|
}
|
|
@Override
|
public void targetFinished(BuildEvent be) {
|
output.append("<br/>");
|
output.append("TARGET FINISHED - ");
|
appendEventInfo(be);
|
}
|
|
@Override
|
public void taskStarted(BuildEvent be) {
|
output.append("<br/>");
|
output.append("TASK STARTED - ");
|
appendEventInfo(be);
|
}
|
|
@Override
|
public void taskFinished(BuildEvent be) {
|
output.append("<br/>");
|
output.append("TASK FNISHED - ");
|
appendEventInfo(be);
|
}
|
|
@Override
|
public void messageLogged(BuildEvent be) {
|
output.append("<br/>");
|
output.append("MESSAGE LOGGED - ");
|
appendEventInfo(be);
|
}
|
|
}
|