Skip to content

Commit

Permalink
update javasisst classpath impl
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenWei committed Apr 15, 2020
1 parent d5b38cb commit c5c3a1c
Show file tree
Hide file tree
Showing 26 changed files with 67 additions and 22 deletions.
2 changes: 1 addition & 1 deletion modules-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ publish {
userOrg = 'beyondxia'
groupId = 'com.beyondxia.modules'
artifactId = 'transform-plugin'
publishVersion = '1.2.1'
publishVersion = '1.2.4'
desc = 'This is a plugin for modules'
website = 'https://github.com/beyondxia/transform'
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Constant {


//框架生成文件的class文件地址
static final def DIRECTORYS_MODULES_API_CLASS_DEBUG = ["/modules_services_api/build/intermediates/classes/debug", "/modules_services_api/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes"] as String[]
static final def DIRECTORYS_MODULES_API_CLASS_RELEASE = ["/modules_services_api/build/intermediates/classes/release", "/modules_services_api/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes"] as String[]
static final def DIRECTORYS_MODULES_API_CLASS_DEBUG = ["/build/intermediates/classes/debug", "/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes"] as String[]
static final def DIRECTORYS_MODULES_API_CLASS_RELEASE = ["/build/intermediates/classes/release", "/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes"] as String[]


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ class TransformUtil {
if (path.replace("\\", "/").matches(Constant.DIRECTORY_DEBUG) ||
path.replace("\\", "/").matches(Constant.DIRECTORY_KOTLIN_DEBUG)) {
Constant.DIRECTORYS_MODULES_API_CLASS_DEBUG.each {
mPool.appendClassPath(project.rootDir.toString() + SystemUtils.getPathByOs(it))
println("添加的classPath路径为: ${project.rootDir.toString() + SystemUtils.getPathByOs(it)}")
def classPath = project.rootProject.project("modules_services_api").projectDir.absolutePath + SystemUtils.getPathByOs(it)
mPool.appendClassPath(classPath)
println("添加的classPath路径为: ${classPath}")
}
// mPool.appendClassPath(project.rootDir.toString() + SystemUtils.getPathByOs("/modules_services_api/build/intermediates/classes/debug"))
// println("添加的classPath路径为:/modules_services_api/build/intermediates/classes/debug")
} else if (path.replace("\\", "/").matches(Constant.DIRECTORY_RELEASE) ||
path.replace("\\", "/").matches(Constant.DIRECTORY_KOTLIN_RELEASE)) {
Constant.DIRECTORYS_MODULES_API_CLASS_RELEASE.each {
mPool.appendClassPath(project.rootDir.toString() + SystemUtils.getPathByOs(it))
println("添加的classPath路径为: $it")
def classPath = project.rootProject.project("modules_services_api").projectDir.absolutePath + SystemUtils.getPathByOs(it)
mPool.appendClassPath(classPath)
println("添加的classPath路径为: $classPath")
}
// mPool.appendClassPath(project.rootDir.toString() + SystemUtils.getPathByOs("/modules_services_api/build/intermediates/classes/release"))
// println("添加的classPath路径为:/modules_services_api/build/intermediates/classes/release")
Expand Down Expand Up @@ -59,7 +61,7 @@ class TransformUtil {
}

static void handleJarInput(String path, Project project) {
// println("***********************handleJarInput:${path}")
println("=========>handleJarInput:${path}<============")
File jarFile = new File(path)
// jar包解压后的保存路径
String jarUnZipDir = jarFile.getParent() + File.separator + jarFile.getName().replace('.jar', '')
Expand All @@ -79,7 +81,7 @@ class TransformUtil {
CtClass ctClass = mPool.getCtClass(className)
def annotation = ctClass.getAnnotation(ExportService.class)
if (annotation != null) {
println("=====================handleJarClass:${className}")
println("handleJarClass:${className}")
hasAnnotation = true
if (ctClass.isFrozen()) {
ctClass.defrost()
Expand Down Expand Up @@ -116,7 +118,7 @@ class TransformUtil {
}
// 删除目录
FileUtils.deleteDirectory(new File(jarUnZipDir))
// println("delete******** completed")
println("===========>handleJarInput:${path}finish<==============")
}


Expand Down Expand Up @@ -173,7 +175,7 @@ class TransformUtil {
* @return
*/
static boolean isValidClass(String classFilePath) {
return classFilePath.endsWith(".class") && !classFilePath.endsWith("R.class") && !classFilePath.contains('R$')
return classFilePath.endsWith(".class") && !classFilePath.endsWith("R.class") && !classFilePath.contains('$')
}

/**
Expand Down
Binary file modified repos/com/beyondxia/modules/plugin_dev/1.0.4/plugin_dev-1.0.4.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eacb7907e6564837251b07416467f8c2
312d804825d71f0d319c47200913ffe8
Original file line number Diff line number Diff line change
@@ -1 +1 @@
83e826da327c5105f329cbde36a06a38a683e21b
d5834792317892b2610f94619d70a8014a1968f8
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4d94dff0aa3859e49e9034f71ddbed9e
c9c2f4f1790aa85afb6eee6291e2bbc6
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5d051002ef8d551999e845aab0c27db3d884bb2d
2aba43e4f4a7680c8beec6ef89eac6c0261ad977
2 changes: 1 addition & 1 deletion repos/com/beyondxia/modules/plugin_dev/maven-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<version>1.0.3</version>
<version>1.0.4</version>
</versions>
<lastUpdated>20191206094529</lastUpdated>
<lastUpdated>20200415074353</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
151d10aeddf5b4ab19748d486b0c514b
2dbdce9859dd8b5156e144d23517fd9f
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ae7b2ad5bc7b0fcbf05ef785778b3d13279e1d86
8a18984ef8791d4fcbfd9e80cb1017c247764002
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
533b1fd9cca17eb615fe7a2ce0cd5991
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dcae51539eb34997369066ec716c08ee7d334e13
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
48b0c2219e71d5e4b37415b415b20ff9
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3309e33ca674942a5a400b656ec920cceda368fb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
312d804825d71f0d319c47200913ffe8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d5834792317892b2610f94619d70a8014a1968f8
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.beyondxia.modules</groupId>
<artifactId>transform-plugin</artifactId>
<version>1.2.3</version>
<dependencies>
<dependency>
<groupId>com.android.tools.build</groupId>
<artifactId>gradle</artifactId>
<version>2.1.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.beyondxia.modules</groupId>
<artifactId>annotation_dev</artifactId>
<version>1.0.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e143f858c936dcfb005be478a4377dea
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
36c0876111670697dbd95ca7f01a0ee1af6ebda7
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<groupId>com.beyondxia.modules</groupId>
<artifactId>transform-plugin</artifactId>
<versioning>
<release>1.1.5</release>
<release>1.2.3</release>
<versions>
<version>1.1.2</version>
<version>1.1.5</version>
<version>1.2.3</version>
</versions>
<lastUpdated>20190621095512</lastUpdated>
<lastUpdated>20200415074355</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
450914e2f3de7589a8a8c9909f921d57
bd321c99c58d6a7da692404f0bcb59bc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
030733b992961b4abb5645671d85d7823a9f27ff
415390cecd0d1481f38f1fb07971ed56c61b80f6

0 comments on commit c5c3a1c

Please sign in to comment.