1
2
3
4
5
6
7
8
9
10 package com.simpligility.maven.plugins.android;
11
12 import com.android.annotations.NonNull;
13 import com.android.builder.core.ErrorReporter;
14 import com.android.builder.model.SyncIssue;
15 import com.android.ide.common.blame.Message;
16 import com.android.utils.ILogger;
17
18
19
20
21 public class MavenErrorReporter extends ErrorReporter
22 {
23
24 private ILogger logger;
25
26 public MavenErrorReporter( ILogger logger, @NonNull EvaluationMode mode )
27 {
28 super( mode );
29 this.logger = logger;
30 }
31
32 @Override
33 public SyncIssue handleIssue( String data, int type, int i1, String msg )
34 {
35 logger.info( "Sync Error. Data: " + data + "\tmsg: " + msg );
36 return new SyncIssueImpl( 0, type, data, msg );
37 }
38
39 @Override
40 public void receiveMessage( Message message )
41 {
42 logger.info( message .toString() );
43
44 }
45
46 }
47
48 class SyncIssueImpl implements SyncIssue
49 {
50 private int severity;
51 private int type;
52 private String data;
53 private String message;
54
55 SyncIssueImpl( int severity, int type, String data, String message )
56 {
57 this.severity = severity;
58 this.type = type;
59 this.data = data;
60 this.message = message;
61 }
62
63 @Override
64 public int getSeverity()
65 {
66 return severity;
67 }
68
69 @Override
70 public int getType()
71 {
72 return type;
73 }
74
75 @Override
76 public String getData()
77 {
78 return data;
79 }
80
81 @Override
82 public String getMessage()
83 {
84 return message;
85 }
86 }