Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
304 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
component-plugin/build/classes/groovy/main/com/plugin/component/ComponentPlugin$1.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...ld/classes/groovy/main/com/plugin/component/ComponentPlugin$_handleProject_closure1.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.../groovy/main/com/plugin/component/ComponentPlugin$_handleProject_closure2$_closure8.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...ld/classes/groovy/main/com/plugin/component/ComponentPlugin$_handleProject_closure2.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...ld/classes/groovy/main/com/plugin/component/ComponentPlugin$_handleProject_closure3.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...groovy/main/com/plugin/component/ComponentPlugin$_handleProject_closure4$_closure10.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.../groovy/main/com/plugin/component/ComponentPlugin$_handleProject_closure4$_closure9.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...ld/classes/groovy/main/com/plugin/component/ComponentPlugin$_handleProject_closure4.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...lasses/groovy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure5.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...vy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure6$_closure11.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...lasses/groovy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure6.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...vy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure7$_closure12.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...vy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure7$_closure13.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...vy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure7$_closure14.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...ponent/ComponentPlugin$_handleRootProject_closure7$_closure15$_closure16$_closure19.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.../plugin/component/ComponentPlugin$_handleRootProject_closure7$_closure15$_closure16.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.../plugin/component/ComponentPlugin$_handleRootProject_closure7$_closure15$_closure17.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...ponent/ComponentPlugin$_handleRootProject_closure7$_closure15$_closure18$_closure20.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.../plugin/component/ComponentPlugin$_handleRootProject_closure7$_closure15$_closure18.class
Binary file not shown.
Binary file modified
BIN
-64 Bytes
(99%)
...vy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure7$_closure15.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...lasses/groovy/main/com/plugin/component/ComponentPlugin$_handleRootProject_closure7.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
component-plugin/build/classes/groovy/main/com/plugin/component/ComponentPlugin.class
Binary file not shown.
Binary file added
BIN
+490 Bytes
...nent-plugin/build/classes/groovy/main/com/plugin/component/anno/AutoInjectComponent.class
Binary file not shown.
Binary file added
BIN
+397 Bytes
component-plugin/build/classes/groovy/main/com/plugin/component/anno/MethodCost.class
Binary file not shown.
Binary file added
BIN
+5.46 KB
component-plugin/build/classes/groovy/main/com/plugin/component/asm/AsmManager.class
Binary file not shown.
Binary file added
BIN
+2.71 KB
...-plugin/build/classes/groovy/main/com/plugin/component/asm/MethodCostClassVisitor$1.class
Binary file not shown.
Binary file added
BIN
+1.26 KB
...nt-plugin/build/classes/groovy/main/com/plugin/component/asm/MethodCostClassVisitor.class
Binary file not shown.
Binary file added
BIN
+4.52 KB
...ugin/component/transform/AutoInjectComponentTransform$_transform_closure1$_closure2.class
Binary file not shown.
Binary file added
BIN
+2.75 KB
...nent/transform/AutoInjectComponentTransform$_transform_closure1$_closure3$_closure4.class
Binary file not shown.
Binary file added
BIN
+4.29 KB
...ugin/component/transform/AutoInjectComponentTransform$_transform_closure1$_closure3.class
Binary file not shown.
Binary file added
BIN
+3.65 KB
...ain/com/plugin/component/transform/AutoInjectComponentTransform$_transform_closure1.class
Binary file not shown.
Binary file added
BIN
+4.83 KB
...ild/classes/groovy/main/com/plugin/component/transform/AutoInjectComponentTransform.class
Binary file not shown.
Binary file removed
BIN
-2.92 KB
...lasses/groovy/main/com/plugin/component/transform/CodeTransform$_transform_closure1.class
Binary file not shown.
Binary file removed
BIN
-4.39 KB
...ovy/main/com/plugin/component/transform/CodeTransform$_transform_closure2$_closure3.class
Binary file not shown.
Binary file removed
BIN
-4.72 KB
...om/plugin/component/transform/CodeTransform$_transform_closure2$_closure4$_closure5.class
Binary file not shown.
Binary file removed
BIN
-5.45 KB
...ovy/main/com/plugin/component/transform/CodeTransform$_transform_closure2$_closure4.class
Binary file not shown.
Binary file removed
BIN
-4.34 KB
...lasses/groovy/main/com/plugin/component/transform/CodeTransform$_transform_closure2.class
Binary file not shown.
Binary file removed
BIN
-11.3 KB
...onent-plugin/build/classes/groovy/main/com/plugin/component/transform/CodeTransform.class
Binary file not shown.
Binary file added
BIN
+4.49 KB
...in/com/plugin/component/transform/MethodCostTransform$_transform_closure1$_closure2.class
Binary file not shown.
Binary file added
BIN
+2.72 KB
...gin/component/transform/MethodCostTransform$_transform_closure1$_closure3$_closure4.class
Binary file not shown.
Binary file added
BIN
+4.25 KB
...in/com/plugin/component/transform/MethodCostTransform$_transform_closure1$_closure3.class
Binary file not shown.
Binary file added
BIN
+3.59 KB
.../groovy/main/com/plugin/component/transform/MethodCostTransform$_transform_closure1.class
Binary file not shown.
Binary file added
BIN
+4.8 KB
...plugin/build/classes/groovy/main/com/plugin/component/transform/MethodCostTransform.class
Binary file not shown.
Binary file modified
BIN
+849 Bytes
(120%)
component-plugin/build/classes/groovy/main/com/plugin/component/utils/FileUtil.class
Binary file not shown.
Binary file removed
BIN
-4.25 KB
...ovy/main/com/plugin/component/utils/Utils$_toCtClasses_closure1$_closure3$_closure5.class
Binary file not shown.
Binary file removed
BIN
-3.69 KB
...lasses/groovy/main/com/plugin/component/utils/Utils$_toCtClasses_closure1$_closure3.class
Binary file not shown.
Binary file removed
BIN
-4.77 KB
...lasses/groovy/main/com/plugin/component/utils/Utils$_toCtClasses_closure1$_closure4.class
Binary file not shown.
Binary file removed
BIN
-3.49 KB
...in/build/classes/groovy/main/com/plugin/component/utils/Utils$_toCtClasses_closure1.class
Binary file not shown.
Binary file removed
BIN
-3.66 KB
...in/build/classes/groovy/main/com/plugin/component/utils/Utils$_toCtClasses_closure2.class
Binary file not shown.
Binary file modified
BIN
-1.24 KB
(73%)
component-plugin/build/classes/groovy/main/com/plugin/component/utils/Utils.class
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
component-plugin/src/main/groovy/com/plugin/component/anno/AutoInjectComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.plugin.component.anno; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* 用于注解 IComponent接口,自动注入 | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.CLASS) | ||
public @interface AutoInjectComponent { | ||
|
||
String name() default "DEFAULT"; | ||
} |
14 changes: 14 additions & 0 deletions
14
component-plugin/src/main/groovy/com/plugin/component/anno/MethodCost.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.plugin.component.anno; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* 方法耗时 | ||
*/ | ||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.CLASS) | ||
public @interface MethodCost { | ||
} |
13 changes: 13 additions & 0 deletions
13
component-plugin/src/main/groovy/com/plugin/component/asm/ComponentClassVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.plugin.component.asm; | ||
|
||
|
||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
|
||
public class ComponentClassVisitor extends ClassVisitor { | ||
|
||
public ComponentClassVisitor(ClassVisitor classVisitor) { | ||
super(Opcodes.ASM7, classVisitor); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
component-plugin/src/main/groovy/com/plugin/component/asm/MethodCostClassVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.plugin.component.asm; | ||
|
||
import com.android.ddmlib.Log; | ||
import com.plugin.component.anno.MethodCost; | ||
|
||
import org.objectweb.asm.AnnotationVisitor; | ||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
import org.objectweb.asm.Type; | ||
import org.objectweb.asm.commons.AdviceAdapter; | ||
|
||
public class MethodCostClassVisitor extends ClassVisitor { | ||
|
||
private static final String sCostCachePath = "com.plugin.component/CostCache"; | ||
|
||
public MethodCostClassVisitor(ClassVisitor classVisitor) { | ||
super(Opcodes.ASM7, classVisitor); | ||
} | ||
|
||
@Override | ||
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { | ||
MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); | ||
mv = new AdviceAdapter(Opcodes.ASM7, mv, access, name, descriptor) { | ||
|
||
private boolean cost = false; | ||
|
||
@Override | ||
protected void onMethodEnter() { | ||
if (cost) { | ||
mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); | ||
mv.visitLdcInsn("========start========="); | ||
mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", | ||
"(Ljava/lang/String;)V", false); | ||
|
||
mv.visitLdcInsn(name); | ||
mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "nanoTime", "()J", false); | ||
mv.visitMethodInsn(INVOKESTATIC, sCostCachePath, "setStartTime", | ||
"(Ljava/lang/String;J)V", false); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onMethodExit(int opcode) { | ||
if (cost) { | ||
mv.visitLdcInsn(name); | ||
mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "nanoTime", "()J", false); | ||
mv.visitMethodInsn(INVOKESTATIC, sCostCachePath, "setEndTime", | ||
"(Ljava/lang/String;J)V", false); | ||
|
||
mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); | ||
mv.visitLdcInsn(name); | ||
mv.visitMethodInsn(INVOKESTATIC, sCostCachePath, "getCostTime", | ||
"(Ljava/lang/String;)Ljava/lang/String;", false); | ||
mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", | ||
"(Ljava/lang/String;)V", false); | ||
|
||
mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); | ||
mv.visitLdcInsn("========end========="); | ||
mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", | ||
"(Ljava/lang/String;)V", false); | ||
} | ||
} | ||
|
||
@Override | ||
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { | ||
//判断是否使用某个注解 | ||
if (Type.getDescriptor(MethodCost.class).equals(descriptor)) { | ||
cost = true; | ||
} | ||
return super.visitAnnotation(descriptor, visible); | ||
} | ||
}; | ||
return mv; | ||
} | ||
} |
198 changes: 0 additions & 198 deletions
198
component-plugin/src/main/groovy/com/plugin/component/transform/CodeTransform.groovy
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.