commit | author | age
|
2e303f
|
1 |
/* |
U |
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package de.uhilger.filecms.api; |
|
7 |
|
|
8 |
import org.apache.tools.ant.BuildEvent; |
|
9 |
import org.apache.tools.ant.BuildListener; |
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* @author ulrich |
|
14 |
*/ |
|
15 |
public class FileCmsBuildListener implements BuildListener { |
|
16 |
|
|
17 |
private final StringBuilder output; |
|
18 |
|
|
19 |
public FileCmsBuildListener() { |
|
20 |
output = new StringBuilder(); |
|
21 |
} |
|
22 |
|
|
23 |
public String getOutput() { |
|
24 |
return output.toString(); |
|
25 |
} |
|
26 |
|
|
27 |
private void appendEventInfo(BuildEvent be) { |
|
28 |
Object elem; |
|
29 |
output.append("Project: "); |
|
30 |
output.append(be.getProject().getName()); |
|
31 |
elem = be.getTarget(); |
|
32 |
if(elem != null) { |
|
33 |
output.append(", Target: "); |
|
34 |
output.append(be.getTarget().getName()); |
|
35 |
} |
|
36 |
elem = be.getTask(); |
|
37 |
if(elem != null) { |
|
38 |
output.append(", Task: "); |
|
39 |
output.append(be.getTask().getTaskName()); |
|
40 |
} |
|
41 |
output.append(", Message: "); |
|
42 |
output.append(be.getMessage()); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public void buildStarted(BuildEvent be) { |
|
47 |
output.append("<br/>"); |
|
48 |
output.append("BUILD STARTED - "); |
|
49 |
appendEventInfo(be); |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public void buildFinished(BuildEvent be) { |
|
54 |
output.append("<br/>"); |
|
55 |
output.append("BUILD FINISHED - "); |
|
56 |
appendEventInfo(be); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public void targetStarted(BuildEvent be) { |
|
61 |
output.append("<br/>"); |
|
62 |
output.append("TARGET STARTED - "); |
|
63 |
appendEventInfo(be); |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public void targetFinished(BuildEvent be) { |
|
68 |
output.append("<br/>"); |
|
69 |
output.append("TARGET FINISHED - "); |
|
70 |
appendEventInfo(be); |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public void taskStarted(BuildEvent be) { |
|
75 |
output.append("<br/>"); |
|
76 |
output.append("TASK STARTED - "); |
|
77 |
appendEventInfo(be); |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public void taskFinished(BuildEvent be) { |
|
82 |
output.append("<br/>"); |
|
83 |
output.append("TASK FNISHED - "); |
|
84 |
appendEventInfo(be); |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 |
public void messageLogged(BuildEvent be) { |
|
89 |
output.append("<br/>"); |
|
90 |
output.append("MESSAGE LOGGED - "); |
|
91 |
appendEventInfo(be); |
|
92 |
} |
|
93 |
|
|
94 |
} |