Jelajahi Sumber

add asm lib

weiguo 7 tahun lalu
induk
melakukan
51131a11de

+ 1 - 0
buildSrc/build.gradle

@@ -8,5 +8,6 @@ repositories {
 dependencies {
     compile gradleApi()
     compile localGroovy()
+    compile 'org.ow2.asm:asm:5.2'
     compile 'com.android.tools.build:gradle:2.1.0'
 }

+ 13 - 13
buildSrc/src/main/groovy/com/gradle/AresTransform.groovy

@@ -21,20 +21,20 @@ public class AresTransform extends ModifyClassTransform {
             } else if (path.endsWith(".jar")) {
                 if (path.contains("exploded-aar")) {
                     if (!path.contains("com.android.support")) {
-//                        //需要处理的jar包
-//                        File tmp = new File(input.getParent() + File.separator + "tmp")
-//                        tmp.deleteOnExit()
+                        //需要处理的jar包
+                        File tmp = new File(input.getParent() + File.separator + "tmp")
+                        tmp.deleteOnExit()
 
-//                        boolean modify = false
-//                        if (!modify) JarZipUtil.unzipJar(input, tmp.absolutePath)
-//                        tmp.eachFileRecurse { File file ->
-//                            if (file.isFile()) {
-//                                if (modifyClass(file)) {
-//                                    modify = true
-//                                }
-//                            }
-//                        }
-//                        if (modify) JarZipUtil.zipJar(tmp.absolutePath, input)
+                        boolean modify = false
+                        if (!modify) JarZipUtil.unzipJar(input, tmp.absolutePath)
+                        tmp.eachFileRecurse { File file ->
+                            if (file.isFile()) {
+                                if (modifyClass(file)) {
+                                    modify = true
+                                }
+                            }
+                        }
+                        if (modify) JarZipUtil.zipJar(tmp.absolutePath, input)
                     }
                 }
             }