Skip to content

Commit 8d61e55

Browse files
author
Vens Chen
committed
update
1 parent adb7661 commit 8d61e55

File tree

2 files changed

+83
-83
lines changed

2 files changed

+83
-83
lines changed

app/build.gradle

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -28,69 +28,69 @@ dependencies {
2828
}
2929

3030

31-
buildscript {
32-
repositories {
33-
maven {
34-
url uri('../repo')
35-
}
36-
}
37-
dependencies {
38-
classpath 'com.threetrees.plugin:plugin:1.0.0'
39-
}
40-
}
41-
42-
apply plugin: 'ttreeplugin'
43-
44-
import com.threetrees.plugin.asm.AutoMethodVisitor
45-
import org.objectweb.asm.MethodVisitor
46-
import org.objectweb.asm.Opcodes
47-
48-
ttree {
49-
isDebug = true
50-
//具体配置
51-
matchData = [
52-
'AnnotationPath' : 'com.threetree.ttreeplugin.annotation',
53-
'AnnotationReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
54-
'ClassReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
55-
'ClassFilter' : [
56-
//根据类型匹配
57-
['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
58-
'MethodName': 'testClassName', 'MethodDes': '()V'],
59-
//根据类型匹配
60-
['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
61-
'MethodName': 'testBoolean', 'MethodDes': '(Z)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, String className ->
75-
AutoMethodVisitor adapter = new AutoMethodVisitor(methodVisitor, access, name, desc, className) {
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-
}
31+
//buildscript {
32+
// repositories {
33+
// maven {
34+
// url uri('../repo')
35+
// }
36+
// }
37+
// dependencies {
38+
// classpath 'com.threetrees.plugin:plugin:1.0.0'
39+
// }
40+
//}
41+
//
42+
//apply plugin: 'ttreeplugin'
43+
//
44+
//import com.threetrees.plugin.asm.AutoMethodVisitor
45+
//import org.objectweb.asm.MethodVisitor
46+
//import org.objectweb.asm.Opcodes
47+
//
48+
//ttree {
49+
// isDebug = true
50+
// //具体配置
51+
// matchData = [
52+
// 'AnnotationPath' : 'com.threetree.ttreeplugin.annotation',
53+
// 'AnnotationReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
54+
// 'ClassReceiver' : 'com.threetree.ttreeplugin.MyReceiver',
55+
// 'ClassFilter' : [
56+
// //根据类型匹配
57+
// ['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
58+
// 'MethodName': 'testClassName', 'MethodDes': '()V'],
59+
// //根据类型匹配
60+
// ['ClassName' : 'com/threetree/ttreeplugin/MainActivity',
61+
// 'MethodName': 'testBoolean', 'MethodDes': '(Z)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, String className ->
75+
// AutoMethodVisitor adapter = new AutoMethodVisitor(methodVisitor, access, name, desc, className) {
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+
//}
9696

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)