From c5b7f30cd935a6db3edf03d7a6dded03711de866 Mon Sep 17 00:00:00 2001 From: "jinxl@julive.com" Date: Tue, 1 Dec 2020 15:27:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7gradle=E3=80=81=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=8F=92=E4=BB=B6=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/codeStyles/Project.xml | 122 ------------------ .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/encodings.xml | 6 - .idea/gradle.xml | 19 --- .idea/misc.xml | 52 -------- .idea/runConfigurations.xml | 12 -- build.gradle | 26 ++-- gradle/wrapper/gradle-wrapper.properties | 4 +- settings.gradle | 4 +- tracemanplugin/build.gradle | 34 +++-- .../tracemanplugin/TraceManTransform.groovy | 4 +- .../java/cn/cxzheng/tracemanplugin/Config.kt | 1 + 12 files changed, 44 insertions(+), 245 deletions(-) delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index a88ded0..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
- - -
-
\ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 169fd0d..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 95631a7..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 197c800..d644b23 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,22 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.4.10' repositories { - google() - jcenter() + maven { + url 'https://maven.aliyun.com/repository/public' + } + maven { + url 'https://maven.aliyun.com/repository/google' + } maven { url uri('./repo') } maven { url 'https://jitpack.io' } - maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://maven.aliyun.com/repository/gradle-plugin" } } dependencies { - classpath 'com.android.tools.build:gradle:3.5.1' + classpath 'com.android.tools.build:gradle:4.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath "gradle.plugin.cn.cxzheng.methodTracePlugin:tracemanplugin:1.0.4" // classpath "cn.cxzheng:asmtraceman-plugin:0.0.1-test" // NOTE: Do not place your application dependencies here; they belong @@ -22,11 +26,15 @@ buildscript { allprojects { repositories { - google() - jcenter() + maven { + url 'https://maven.aliyun.com/repository/public' + } + maven { + url 'https://maven.aliyun.com/repository/google' + } maven { url uri('./repo') } maven { url 'https://jitpack.io' } - maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://maven.aliyun.com/repository/gradle-plugin" } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7daa78e..bf37ecb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Oct 25 00:03:47 CST 2019 +#Tue Dec 01 14:13:32 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-6.5-all.zip diff --git a/settings.gradle b/settings.gradle index db51c3d..888ea8d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -include ':app' -//include ':app', ':tracemanui',':tracemanplugin', ':tracemanui-noop' \ No newline at end of file +//include ':app' +include ':app', ':tracemanui',':tracemanplugin', ':tracemanui-noop' \ No newline at end of file diff --git a/tracemanplugin/build.gradle b/tracemanplugin/build.gradle index aafcbdd..42d691b 100644 --- a/tracemanplugin/build.gradle +++ b/tracemanplugin/build.gradle @@ -5,12 +5,12 @@ apply plugin: 'kotlin' apply plugin: "com.gradle.plugin-publish" dependencies { - compile gradleApi() - compile localGroovy() + implementation gradleApi() + implementation localGroovy() //这里根据插件需要,添加对应的依赖 - compile 'com.android.tools.build:gradle:3.0.0' - compile 'org.javassist:javassist:3.20.0-GA' + implementation 'com.android.tools.build:gradle:3.0.0' + implementation 'org.javassist:javassist:3.25.0-GA' } repositories { @@ -20,7 +20,13 @@ repositories { buildscript { repositories { maven { - url "https://plugins.gradle.org/m2/" + url "https://maven.aliyun.com/repository/gradle-plugin" + } + maven { + url 'https://maven.aliyun.com/repository/public' + } + maven { + url 'https://maven.aliyun.com/repository/google' } } dependencies { @@ -73,15 +79,15 @@ sourceSets { dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - compile gradleApi() - compile localGroovy() - compile group: 'org.ow2.asm', name: 'asm', version: '5.1' - compile group: 'org.ow2.asm', name: 'asm-commons', version: '5.1' - compile 'com.android.tools.build:gradle:3.2.1' - compile 'com.android.tools.lint:lint:26.0.1' - compile 'com.android.tools.lint:lint-api:26.0.1' - compile 'com.android.tools.lint:lint-checks:26.0.1' + api fileTree(include: ['*.jar'], dir: 'libs') + api gradleApi() + api localGroovy() + api group: 'org.ow2.asm', name: 'asm', version: '6.0' + api group: 'org.ow2.asm', name: 'asm-commons', version: '6.0' + api 'com.android.tools.build:gradle:3.2.1' + api 'com.android.tools.lint:lint:26.0.1' + api 'com.android.tools.lint:lint-api:26.0.1' + api 'com.android.tools.lint:lint-checks:26.0.1' } compileGroovy { diff --git a/tracemanplugin/src/main/groovy/cn/cxzheng/tracemanplugin/TraceManTransform.groovy b/tracemanplugin/src/main/groovy/cn/cxzheng/tracemanplugin/TraceManTransform.groovy index 08c86e9..ee2f8ff 100644 --- a/tracemanplugin/src/main/groovy/cn/cxzheng/tracemanplugin/TraceManTransform.groovy +++ b/tracemanplugin/src/main/groovy/cn/cxzheng/tracemanplugin/TraceManTransform.groovy @@ -110,7 +110,7 @@ class TraceManTransform extends Transform { if (traceConfig.isNeedTraceClass(name)) { ClassReader classReader = new ClassReader(file.bytes) ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_MAXS) - ClassVisitor cv = new TraceClassVisitor(Opcodes.ASM5, classWriter, traceConfig) + ClassVisitor cv = new TraceClassVisitor(Opcodes.ASM6, classWriter, traceConfig) classReader.accept(cv, EXPAND_FRAMES) byte[] code = classWriter.toByteArray() FileOutputStream fos = new FileOutputStream( @@ -157,7 +157,7 @@ class TraceManTransform extends Transform { jarOutputStream.putNextEntry(zipEntry) ClassReader classReader = new ClassReader(IOUtils.toByteArray(inputStream)) ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_MAXS) - ClassVisitor cv = new TraceClassVisitor(Opcodes.ASM5, classWriter, traceConfig) + ClassVisitor cv = new TraceClassVisitor(Opcodes.ASM6, classWriter, traceConfig) classReader.accept(cv, EXPAND_FRAMES) byte[] code = classWriter.toByteArray() jarOutputStream.write(code) diff --git a/tracemanplugin/src/main/java/cn/cxzheng/tracemanplugin/Config.kt b/tracemanplugin/src/main/java/cn/cxzheng/tracemanplugin/Config.kt index b0008c0..a5dd45c 100644 --- a/tracemanplugin/src/main/java/cn/cxzheng/tracemanplugin/Config.kt +++ b/tracemanplugin/src/main/java/cn/cxzheng/tracemanplugin/Config.kt @@ -1,6 +1,7 @@ package cn.cxzheng.tracemanplugin import java.io.File +import java.io.FileNotFoundException import java.util.HashSet /**