Skip to content

Commit 412c6b4

Browse files
author
Vens Chen
committed
update
1 parent 837d0c7 commit 412c6b4

File tree

4 files changed

+82
-86
lines changed

4 files changed

+82
-86
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ buildscript {
102102
}
103103
}
104104
dependencies {
105-
classpath 'com.github.chenthreetrees:ttreeplugin:2.0.0'
105+
classpath 'com.github.chenthreetrees:ttreeplugin:2.0.1'
106106
}
107107
}
108108
```

app/build.gradle

Lines changed: 62 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -31,70 +31,66 @@ dependencies {
3131
compile project(":pluginutil")
3232
}
3333

34-
buildscript {
35-
repositories {
36-
maven {
37-
url uri('../repo')
38-
}
39-
}
40-
dependencies {
41-
classpath 'com.threetrees.plugin:plugin:1.0.0'
42-
}
43-
}
44-
45-
apply plugin: 'ttreeplugin'
46-
47-
48-
49-
50-
51-
import com.threetrees.plugin.asm.AutoMethodVisitor
52-
import org.objectweb.asm.MethodVisitor
53-
import org.objectweb.asm.Opcodes
54-
55-
ttree {
56-
isDebug = true
57-
//具体配置
58-
matchData = [
59-
'AnnotationPath' : 'com.threetree.ttreeplugin.annotation',
60-
'AnnotationReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
61-
'ClassReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
62-
'ClassFilter' : [
63-
//根据类型匹配
64-
['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
65-
'MethodName': 'testClassName', 'MethodDes': '()V'],
66-
//根据关键字匹配
67-
['ContainName' : 'Activity',
68-
'MethodName': 'testContainName', 'MethodDes': '(Ljava/lang/String;)V'],
69-
//根据接口名匹配
70-
['InterfaceName': 'android/view/View$OnClickListener',
71-
'MethodName': 'onClick', 'MethodDes': '(Landroid/view/View;)V'],
72-
//根据类型匹配
73-
['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
74-
'MethodName': 'testOverride', 'MethodDes': '()V', 'Override' : true]
75-
],
76-
//插入的字节码,方法的执行顺序visitAnnotation->onMethodEnter->onMethodExit
77-
'MethodVisitor': {
78-
MethodVisitor methodVisitor, int access, String name, String desc ->
79-
AutoMethodVisitor adapter = new AutoMethodVisitor(methodVisitor, access, name, desc) {
80-
@Override
81-
protected void onMethodEnter() {
82-
super.onMethodEnter();
83-
if("testOverride".equals(name))
84-
{
85-
methodVisitor.visitLdcInsn(name)
86-
methodVisitor.visitLdcInsn("========start=========")
87-
methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, "android/util/Log", "e", "(Ljava/lang/String;Ljava/lang/String;)I", false)
88-
}
89-
}
90-
91-
@Override
92-
protected void onMethodExit(int opcode) {
93-
super.onMethodExit(opcode)
94-
}
95-
}
96-
return adapter
97-
}
98-
]
99-
}
34+
//buildscript {
35+
// repositories {
36+
// maven {
37+
// url uri('../repo')
38+
// }
39+
// }
40+
// dependencies {
41+
// classpath 'com.threetrees.plugin:plugin:1.0.0'
42+
// }
43+
//}
44+
//
45+
//apply plugin: 'ttreeplugin'
46+
//
47+
//import com.threetrees.plugin.asm.AutoMethodVisitor
48+
//import org.objectweb.asm.MethodVisitor
49+
//import org.objectweb.asm.Opcodes
50+
//
51+
//ttree {
52+
// isDebug = true
53+
// //具体配置
54+
// matchData = [
55+
// 'AnnotationPath' : 'com.threetree.ttreeplugin.annotation',
56+
// 'AnnotationReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
57+
// 'ClassReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
58+
// 'ClassFilter' : [
59+
// //根据类型匹配
60+
// ['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
61+
// 'MethodName': 'testClassName', 'MethodDes': '()V'],
62+
// //根据关键字匹配
63+
// ['ContainName' : 'Activity',
64+
// 'MethodName': 'testContainName', 'MethodDes': '(Ljava/lang/String;)V'],
65+
// //根据接口名匹配
66+
// ['InterfaceName': 'android/view/View$OnClickListener',
67+
// 'MethodName': 'onClick', 'MethodDes': '(Landroid/view/View;)V'],
68+
// //根据类型匹配
69+
// ['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
70+
// 'MethodName': 'testOverride', 'MethodDes': '()V', 'Override' : true]
71+
// ],
72+
// //插入的字节码,方法的执行顺序visitAnnotation->onMethodEnter->onMethodExit
73+
// 'MethodVisitor': {
74+
// MethodVisitor methodVisitor, int access, String name, String desc ->
75+
// AutoMethodVisitor adapter = new AutoMethodVisitor(methodVisitor, access, name, desc) {
76+
// @Override
77+
// protected void onMethodEnter() {
78+
// super.onMethodEnter();
79+
// if("testOverride".equals(name))
80+
// {
81+
// methodVisitor.visitLdcInsn(name)
82+
// methodVisitor.visitLdcInsn("========start=========")
83+
// methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, "android/util/Log", "e", "(Ljava/lang/String;Ljava/lang/String;)I", false)
84+
// }
85+
// }
86+
//
87+
// @Override
88+
// protected void onMethodExit(int opcode) {
89+
// super.onMethodExit(opcode)
90+
// }
91+
// }
92+
// return adapter
93+
// }
94+
// ]
95+
//}
10096

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
classpath 'com.android.tools.build:gradle:2.3.1'
1313
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1414

15-
// classpath 'com.github.chenthreetrees:ttreeplugin:1.0.1'
15+
// classpath 'com.github.chenthreetrees:ttreeplugin:2.0.0'
1616
}
1717
}
1818

plugin/build.gradle

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apply plugin: 'groovy'
22
apply plugin: 'java'//导入java插件用于,编译打包我们的插件
3-
apply plugin: 'maven'//maven插件,用于上传插件到仓库
3+
//apply plugin: 'maven'//maven插件,用于上传插件到仓库
44

5-
//// JitPack Maven
6-
//apply plugin: 'com.github.dcendents.android-maven'
7-
//// Your Group
8-
//group='com.github.chenthreetrees'
5+
// JitPack Maven
6+
apply plugin: 'com.github.dcendents.android-maven'
7+
// Your Group
8+
group='com.github.chenthreetrees'
99

1010
compileGroovy {
1111
sourceCompatibility = 1.7
@@ -26,16 +26,16 @@ repositories {
2626
mavenCentral()
2727
}
2828

29-
group='com.threetrees.plugin'
30-
version='1.0.0'
31-
32-
//uploadArchives 类型是upload,这个task不是'maven'创建的
33-
//而是'maven'定义了一个rule,而后由我们自己创建的
34-
uploadArchives{
35-
//本地仓库的一种
36-
repositories{
37-
mavenDeployer {
38-
repository(url: uri('../repo'))
39-
}
40-
}
41-
}
29+
//group='com.threetrees.plugin'
30+
//version='1.0.0'
31+
//
32+
////uploadArchives 类型是upload,这个task不是'maven'创建的
33+
////而是'maven'定义了一个rule,而后由我们自己创建的
34+
//uploadArchives{
35+
// //本地仓库的一种
36+
// repositories{
37+
// mavenDeployer {
38+
// repository(url: uri('../repo'))
39+
// }
40+
// }
41+
//}

0 commit comments

Comments
 (0)