Skip to content

Commit 5379adc

Browse files
committed
Release 2.0.0
1 parent 9928fd4 commit 5379adc

14 files changed

+1215
-101
lines changed

aop/build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ dependencies {
2828
jcenter()
2929
}
3030

31-
compile gradleApi()
32-
compile localGroovy()
31+
implementation gradleApi()
32+
implementation localGroovy()
3333

34-
compile 'com.android.tools.build:gradle:2.0.0'
35-
compile "org.aspectj:aspectjtools:1.8.10"
36-
compile "org.aspectj:aspectjrt:1.8.10"
34+
implementation 'com.android.tools.build:gradle:3.0.0'
3735
}
3836

3937
apply from: 'bintray.gradle'

aop/ext.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
project.ext {
2-
aspectjVersion = '1.8.10'
3-
pluginVersion = '1.0.3'
2+
pluginVersion = '2.0.0'
43
Properties properties = new Properties()
54
if (project.file('local.properties').exists()) {
65
properties.load(project.file('local.properties').newDataInputStream())
Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
package com.sensorsdata.analytics.android.plugin
2+
3+
import java.lang.reflect.Array
4+
5+
public class Logger {
6+
private static boolean debug = false
7+
public static HashMap<Integer, String> accCodeMap = new HashMap<>()
8+
public static HashMap<Integer, String> opCodeMap = new HashMap<>()
9+
10+
/**
11+
* 设置是否打印日志
12+
*/
13+
static void setDebug(boolean isDebug) {
14+
this.debug = isDebug
15+
}
16+
17+
static boolean isDebug() {
18+
return debug
19+
}
20+
21+
/**
22+
* 打印日志
23+
*/
24+
def static info(Object msg) {
25+
if (!debug) {
26+
return
27+
}
28+
try {
29+
println "[SensorsAnalytics]: ${msg}"
30+
} catch (Exception e) {
31+
e.printStackTrace()
32+
}
33+
}
34+
35+
def static logForEach(Object... msg) {
36+
if (!debug) {
37+
return
38+
}
39+
msg.each {
40+
Object m ->
41+
try {
42+
if (m != null) {
43+
if (m.class.isArray()) {
44+
print "["
45+
def length = Array.getLength(m);
46+
if (length > 0) {
47+
for (int i = 0; i < length; i++) {
48+
def get = Array.get(m, i);
49+
if (get != null) {
50+
print "${get}\t"
51+
} else {
52+
print "null\t"
53+
}
54+
}
55+
}
56+
print "]\t"
57+
} else {
58+
print "${m}\t"
59+
}
60+
} else {
61+
print "null\t"
62+
}
63+
} catch (Exception e) {
64+
e.printStackTrace()
65+
}
66+
}
67+
println ""
68+
}
69+
70+
static String getOpName(int opCode) {
71+
return getOpMap().get(opCode);
72+
}
73+
74+
static String accCode2String(int access) {
75+
def builder = new StringBuilder()
76+
def map = getAccCodeMap()
77+
map.entrySet().each {
78+
entry ->
79+
if ((entry.getKey().intValue() & access) > 0) {
80+
builder.append(entry.getValue() + ' ')
81+
}
82+
}
83+
return builder.toString()
84+
}
85+
86+
public static Map<Integer, String> getAccCodeMap() {
87+
if (accCodeMap.size() == 0) {
88+
HashMap<String, Integer> map = new HashMap<>()
89+
map.put("ACC_PUBLIC", 1)
90+
map.put("ACC_PRIVATE", 2)
91+
map.put("ACC_PROTECTED", 4)
92+
map.put("ACC_STATIC", 8)
93+
map.put("ACC_FINAL", 16)
94+
map.put("ACC_SUPER", 32)
95+
map.put("ACC_SYNCHRONIZED", 32)
96+
map.put("ACC_VOLATILE", 64)
97+
map.put("ACC_BRIDGE", 64)
98+
map.put("ACC_VARARGS", 128)
99+
map.put("ACC_TRANSIENT", 128)
100+
map.put("ACC_NATIVE", 256)
101+
map.put("ACC_INTERFACE", 512)
102+
map.put("ACC_ABSTRACT", 1024)
103+
map.put("ACC_STRICT", 2048)
104+
map.put("ACC_SYNTHETIC", 4096)
105+
map.put("ACC_ANNOTATION", 8192)
106+
map.put("ACC_ENUM", 16384)
107+
map.put("ACC_DEPRECATED", 131072)
108+
for (Map.Entry<String, Integer> entry : map.entrySet()) {
109+
accCodeMap.put(entry.getValue(), entry.getKey())
110+
}
111+
}
112+
return accCodeMap
113+
}
114+
115+
static Map<Integer, String> getOpMap() {
116+
if (opCodeMap.size() == 0) {
117+
HashMap<String, Integer> map = new HashMap<>()
118+
map.put("NOP", 0)
119+
map.put("ACONST_NULL", 1)
120+
map.put("ICONST_M1", 2)
121+
map.put("ICONST_0", 3)
122+
map.put("ICONST_1", 4)
123+
map.put("ICONST_2", 5)
124+
map.put("ICONST_3", 6)
125+
map.put("ICONST_4", 7)
126+
map.put("ICONST_5", 8)
127+
map.put("LCONST_0", 9)
128+
map.put("LCONST_1", 10)
129+
map.put("FCONST_0", 11)
130+
map.put("FCONST_1", 12)
131+
map.put("FCONST_2", 13)
132+
map.put("DCONST_0", 14)
133+
map.put("DCONST_1", 15)
134+
map.put("BIPUSH", 16)
135+
map.put("SIPUSH", 17)
136+
map.put("LDC", 18)
137+
map.put("ILOAD", 21)
138+
map.put("LLOAD", 22)
139+
map.put("FLOAD", 23)
140+
map.put("DLOAD", 24)
141+
map.put("ALOAD", 25)
142+
map.put("IALOAD", 46)
143+
map.put("LALOAD", 47)
144+
map.put("FALOAD", 48)
145+
map.put("DALOAD", 49)
146+
map.put("AALOAD", 50)
147+
map.put("BALOAD", 51)
148+
map.put("CALOAD", 52)
149+
map.put("SALOAD", 53)
150+
map.put("ISTORE", 54)
151+
map.put("LSTORE", 55)
152+
map.put("FSTORE", 56)
153+
map.put("DSTORE", 57)
154+
map.put("ASTORE", 58)
155+
map.put("IASTORE", 79)
156+
map.put("LASTORE", 80)
157+
map.put("FASTORE", 81)
158+
map.put("DASTORE", 82)
159+
map.put("AASTORE", 83)
160+
map.put("BASTORE", 84)
161+
map.put("CASTORE", 85)
162+
map.put("SASTORE", 86)
163+
map.put("POP", 87)
164+
map.put("POP2", 88)
165+
map.put("DUP", 89)
166+
map.put("DUP_X1", 90)
167+
map.put("DUP_X2", 91)
168+
map.put("DUP2", 92)
169+
map.put("DUP2_X1", 93)
170+
map.put("DUP2_X2", 94)
171+
map.put("SWAP", 95)
172+
map.put("IADD", 96)
173+
map.put("LADD", 97)
174+
map.put("FADD", 98)
175+
map.put("DADD", 99)
176+
map.put("ISUB", 100)
177+
map.put("LSUB", 101)
178+
map.put("FSUB", 102)
179+
map.put("DSUB", 103)
180+
map.put("IMUL", 104)
181+
map.put("LMUL", 105)
182+
map.put("FMUL", 106)
183+
map.put("DMUL", 107)
184+
map.put("IDIV", 108)
185+
map.put("LDIV", 109)
186+
map.put("FDIV", 110)
187+
map.put("DDIV", 111)
188+
map.put("IREM", 112)
189+
map.put("LREM", 113)
190+
map.put("FREM", 114)
191+
map.put("DREM", 115)
192+
map.put("INEG", 116)
193+
map.put("LNEG", 117)
194+
map.put("FNEG", 118)
195+
map.put("DNEG", 119)
196+
map.put("ISHL", 120)
197+
map.put("LSHL", 121)
198+
map.put("ISHR", 122)
199+
map.put("LSHR", 123)
200+
map.put("IUSHR", 124)
201+
map.put("LUSHR", 125)
202+
map.put("IAND", 126)
203+
map.put("LAND", 127)
204+
map.put("IOR", 128)
205+
map.put("LOR", 129)
206+
map.put("IXOR", 130)
207+
map.put("LXOR", 131)
208+
map.put("IINC", 132)
209+
map.put("I2L", 133)
210+
map.put("I2F", 134)
211+
map.put("I2D", 135)
212+
map.put("L2I", 136)
213+
map.put("L2F", 137)
214+
map.put("L2D", 138)
215+
map.put("F2I", 139)
216+
map.put("F2L", 140)
217+
map.put("F2D", 141)
218+
map.put("D2I", 142)
219+
map.put("D2L", 143)
220+
map.put("D2F", 144)
221+
map.put("I2B", 145)
222+
map.put("I2C", 146)
223+
map.put("I2S", 147)
224+
map.put("LCMP", 148)
225+
map.put("FCMPL", 149)
226+
map.put("FCMPG", 150)
227+
map.put("DCMPL", 151)
228+
map.put("DCMPG", 152)
229+
map.put("IFEQ", 153)
230+
map.put("IFNE", 154)
231+
map.put("IFLT", 155)
232+
map.put("IFGE", 156)
233+
map.put("IFGT", 157)
234+
map.put("IFLE", 158)
235+
map.put("IF_ICMPEQ", 159)
236+
map.put("IF_ICMPNE", 160)
237+
map.put("IF_ICMPLT", 161)
238+
map.put("IF_ICMPGE", 162)
239+
map.put("IF_ICMPGT", 163)
240+
map.put("IF_ICMPLE", 164)
241+
map.put("IF_ACMPEQ", 165)
242+
map.put("IF_ACMPNE", 166)
243+
map.put("GOTO", 167)
244+
map.put("JSR", 168)
245+
map.put("RET", 169)
246+
map.put("TABLESWITCH", 170)
247+
map.put("LOOKUPSWITCH", 171)
248+
map.put("IRETURN", 172)
249+
map.put("LRETURN", 173)
250+
map.put("FRETURN", 174)
251+
map.put("DRETURN", 175)
252+
map.put("ARETURN", 176)
253+
map.put("RETURN", 177)
254+
map.put("GETSTATIC", 178)
255+
map.put("PUTSTATIC", 179)
256+
map.put("GETFIELD", 180)
257+
map.put("PUTFIELD", 181)
258+
map.put("INVOKEVIRTUAL", 182)
259+
map.put("INVOKESPECIAL", 183)
260+
map.put("INVOKESTATIC", 184)
261+
map.put("INVOKEINTERFACE", 185)
262+
map.put("INVOKEDYNAMIC", 186)
263+
map.put("NEW", 187)
264+
map.put("NEWARRAY", 188)
265+
map.put("ANEWARRAY", 189)
266+
map.put("ARRAYLENGTH", 190)
267+
map.put("ATHROW", 191)
268+
map.put("CHECKCAST", 192)
269+
map.put("INSTANCEOF", 193)
270+
map.put("MONITORENTER", 194)
271+
map.put("MONITOREXIT", 195)
272+
map.put("MULTIANEWARRAY", 197)
273+
map.put("IFNULL", 198)
274+
map.put("IFNONNULL", 199)
275+
for (Map.Entry<String, Integer> entry : map.entrySet()) {
276+
opCodeMap.put(entry.getValue(), entry.getKey())
277+
}
278+
}
279+
return opCodeMap
280+
}
281+
}

0 commit comments

Comments
 (0)