Browse Source

add asm lib

weiguo 7 years ago
parent
commit
51131a11de
2 changed files with 14 additions and 13 deletions
  1. 1 0
      buildSrc/build.gradle
  2. 13 13
      buildSrc/src/main/groovy/com/gradle/AresTransform.groovy

+ 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)
                     }
                 }
             }