Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dae4578

Browse filesBrowse files
author
liabao
committed
[feat] 完成agp 700 版本适配工作
1 parent df42611 commit dae4578
Copy full SHA for dae4578

21 files changed

+123-88Lines changed: 123 additions & 88 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.idea/misc.xml‎

Copy file name to clipboardExpand all lines: .idea/misc.xml
+2-2Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎Plugin/AutoTrackPlugin/build.gradle‎

Copy file name to clipboardExpand all lines: Plugin/AutoTrackPlugin/build.gradle
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ gradlePlugin {
2121
implementationClass = 'com.wallstreetcn.autotrack.AutoTrackPlugin'
2222
}
2323
}
24+
}
25+
26+
java {
27+
sourceCompatibility = JavaVersion.VERSION_11
28+
targetCompatibility = JavaVersion.VERSION_11
2429
}
Collapse file

‎Plugin/AutoTrackPlugin/src/main/java/com/wallstreetcn/autotrack/AutoTrackPluginProvider.kt‎

Copy file name to clipboardExpand all lines: Plugin/AutoTrackPlugin/src/main/java/com/wallstreetcn/autotrack/AutoTrackPluginProvider.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AutoTrackPluginProvider : PluginProvider {
1919
override fun dependOn(): List<String> {
2020
return arrayListOf<String>().apply {
2121
// add("com.kronos.doubletap.DoubleTapProvider")
22-
add("com.kronos.plugin.thread.ThreadHookProvider")
22+
// add("com.kronos.plugin.thread.ThreadHookProvider")
2323
}
2424
}
2525

Collapse file

‎Plugin/BasePlugin/build.gradle‎

Copy file name to clipboardExpand all lines: Plugin/BasePlugin/build.gradle
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@ dependencies {
99
api "com.android.tools.build:gradle-api:$apgVersion"
1010
api "com.android.tools.build:gradle:$apgVersion"
1111
implementation 'commons-io:commons-io:2.6'
12+
implementation "commons-codec:commons-codec:1.15"
1213
api 'org.ow2.asm:asm:9.2'
1314
api 'org.ow2.asm:asm-tree:9.2'
1415
}
1516

1617

1718
Properties config = new Properties()
1819
config.load(project.file("nexus.properties").newDataInputStream())
19-
group = config.getProperty('nexus_groupId')
20+
group = config.getProperty('nexus_groupId')
21+
22+
23+
java {
24+
sourceCompatibility = JavaVersion.VERSION_11
25+
targetCompatibility = JavaVersion.VERSION_11
26+
}
Collapse file

‎Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/BaseTransform.kt‎

Copy file name to clipboardExpand all lines: Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/BaseTransform.kt
+20-20Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.kronos.plugin.base
22

33
import com.android.build.api.transform.*
4+
import com.kronos.plugin.base.utils.DigestUtils
45
import com.kronos.plugin.base.utils.copyIfLegal
56
import com.kronos.plugin.base.utils.deleteAll
67
import com.kronos.plugin.base.utils.filterTest
78
import org.apache.commons.io.FileUtils
89
import org.apache.commons.io.IOUtils
9-
import org.gradle.internal.impldep.org.apache.commons.codec.digest.DigestUtils
1010
import java.io.File
1111
import java.io.FileInputStream
1212
import java.io.IOException
@@ -149,7 +149,7 @@ class BaseTransform(
149149
private fun deleteDirectory(destFile: File, dest: File) {
150150
try {
151151
if (destFile.isDirectory) {
152-
destFile.walk().forEach { classFile ->
152+
destFile.walkTopDown().forEach { classFile ->
153153
deleteSingle(classFile, dest)
154154
}
155155
} else {
@@ -231,25 +231,26 @@ class BaseTransform(
231231
private fun changeFile(dir: File, dest: File) {
232232
if (dir.isDirectory) {
233233
FileUtils.copyDirectory(dir, dest)
234-
dir.walk().forEach { classFile ->
235-
if (classFile.name.endsWith(".class")) {
236-
val task = Callable<Void> {
237-
val absolutePath = classFile.absolutePath.replace(
238-
dir.absolutePath + File.separator, ""
239-
)
240-
val className = ClassUtils.path2Classname(absolutePath)
241-
if (!simpleScan) {
242-
val bytes = IOUtils.toByteArray(FileInputStream(classFile))
243-
val modifiedBytes = process(className, bytes)
244-
modifiedBytes?.let { saveClassFile(it, dest, absolutePath) }
245-
} else {
246-
process(className, null)
234+
dir.walkTopDown().filter { it.isFile }
235+
.forEach { classFile ->
236+
if (classFile.name.endsWith(".class")) {
237+
val task = Callable<Void> {
238+
val absolutePath = classFile.absolutePath.replace(
239+
dir.absolutePath + File.separator, ""
240+
)
241+
val className = ClassUtils.path2Classname(absolutePath)
242+
if (!simpleScan) {
243+
val bytes = IOUtils.toByteArray(FileInputStream(classFile))
244+
val modifiedBytes = process(className, bytes)
245+
modifiedBytes?.let { saveClassFile(it, dest, absolutePath) }
246+
} else {
247+
process(className, null)
248+
}
249+
null
250+
}
251+
tasks.add(task)
247252
}
248-
null
249253
}
250-
tasks.add(task)
251-
}
252-
}
253254
}
254255
}
255256

@@ -269,7 +270,6 @@ class BaseTransform(
269270
}
270271

271272
private fun foreachJar(dest: File, jarInput: JarInput) {
272-
273273
val task = Callable<Void> {
274274
try {
275275
if (!simpleScan) {
Collapse file

‎Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/ClassUtils.kt‎

Copy file name to clipboardExpand all lines: Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/ClassUtils.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object ClassUtils {
2424
}
2525

2626
fun saveFile(mTempDir: File?, modifiedClassBytes: ByteArray?): File? {
27-
val modified: File? = null
27+
val modified: File? = mTempDir
2828
modifiedClassBytes?.apply {
2929
if (mTempDir!!.exists()) {
3030
mTempDir.delete()
Collapse file

‎Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/JarUtils.kt‎

Copy file name to clipboardExpand all lines: Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/JarUtils.kt
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.kronos.plugin.base
22

3-
import org.gradle.internal.impldep.org.apache.commons.codec.digest.DigestUtils
3+
import com.kronos.plugin.base.utils.DigestUtils
44
import java.io.File
55
import java.io.FileOutputStream
6-
import java.io.IOException
76
import java.util.*
87
import java.util.jar.JarFile
98
import java.util.jar.JarOutputStream
Collapse file

‎Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/constant/TransformManager.kt‎

Copy file name to clipboardExpand all lines: Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/constant/TransformManager.kt
-21Lines changed: 0 additions & 21 deletions
This file was deleted.
Collapse file
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.kronos.plugin.base.utils
2+
3+
import org.apache.commons.codec.binary.Hex
4+
import org.apache.commons.codec.digest.DigestUtils.getMd5Digest
5+
import java.nio.charset.Charset
6+
import kotlin.text.Charsets.UTF_8
7+
8+
/**
9+
* @Author LiABao
10+
* @Since 2021/7/31
11+
*/
12+
object DigestUtils {
13+
14+
fun md5Hex(data: String?): String {
15+
return Hex.encodeHexString(md5(data)) ?: ""
16+
}
17+
18+
fun md5(data: String?): ByteArray? {
19+
return md5(data?.getBytes())
20+
}
21+
22+
fun md5(data: ByteArray?): ByteArray? {
23+
return getMd5Digest().digest(data)
24+
}
25+
26+
private fun String.getBytes(charset: Charset = UTF_8): ByteArray = this.toByteArray(charset)
27+
28+
}
Collapse file

‎Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/utils/Java9ClassAdapter.kt‎

Copy file name to clipboardExpand all lines: Plugin/BasePlugin/src/main/java/com/kronos/plugin/base/utils/Java9ClassAdapter.kt
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.kronos.plugin.base.utils
22

33
import com.kronos.plugin.base.Log
4+
import org.apache.commons.io.FileUtils
45
import java.io.File
56

67
/**
@@ -12,7 +13,7 @@ fun copyIfLegal(srcFile: File?, destFile: File) {
1213
if (srcFile?.name?.contains("module-info") != true) {
1314
try {
1415
srcFile?.apply {
15-
org.apache.commons.io.FileUtils.copyFile(srcFile, destFile)
16+
FileUtils.copyFile(srcFile, destFile)
1617
}
1718
} catch (e: Exception) {
1819
e.printStackTrace()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.