Skip to content

Commit

Permalink
fix: no effects while building with java8
Browse files Browse the repository at this point in the history
  • Loading branch information
firefly1126 committed Dec 13, 2017
1 parent 16b1fc4 commit ceab272
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
### v1.1.1(2017-12-12)
* fix: no effects while building with java8
* this version disable `includeJarFilter` and `excludeJarFilter`configuration, and will be fixed in the next version.

### v1.1.0(2017-11-02)
* fix: exception occurs on android plugin 3.0.0: "Unexpected scopes found in folder xx, Required: PROJECT, SUB_PROJECTS, EXTERNAL_LIBRARIES. Found: EXTERNAL_LIBRARIES, PROJECT, PROJECT_LOCAL_DEPS, SUB_PROJECTS, SUB_PROJECTS_LOCAL_DEPS

Expand Down
Expand Up @@ -25,6 +25,7 @@ import com.android.build.api.transform.Transform
import com.android.build.api.transform.TransformException
import com.android.build.api.transform.TransformInput
import com.android.build.api.transform.TransformOutputProvider
import com.android.build.gradle.internal.pipeline.TransformTask
import com.google.common.collect.ImmutableSet
import org.aspectj.util.FileUtil
import org.gradle.api.Project
Expand All @@ -38,9 +39,6 @@ import org.gradle.api.tasks.compile.JavaCompile
* @since 2016-03-29
*/
class AspectTransform extends Transform {

static final ASPECTJRT = "aspectjrt"

Project project
String encoding
String bootClassPath
Expand Down Expand Up @@ -107,25 +105,42 @@ class AspectTransform extends Transform {
, TransformOutputProvider outputProvider
, boolean isIncremental) throws IOException, TransformException, InterruptedException {

def hasAjRt = false
for (TransformInput transformInput : inputs) {
for (JarInput jarInput : transformInput.jarInputs) {
if (jarInput.file.absolutePath.contains(ASPECTJRT)) {
hasAjRt = true
break
}
TransformTask transformTask = (TransformTask)context

println "task name:" + transformTask.variantName
println("isIncremental:" + isIncremental)
for (TransformInput input : inputs) {
println "inputs-jar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
for (JarInput jInput : input.jarInputs) {
println(jInput.file.absolutePath)
}

println "inputs-dir>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
for (DirectoryInput dInput : input.directoryInputs) {
println(dInput.file.absolutePath)
}
}

for (TransformInput input : referencedInputs) {
println "referenced Input jar>>>>>>>>>>>>>>>>>>>>>>>>>>>"
for (JarInput jInput : input.jarInputs) {
println(jInput.file.absolutePath)
}

println "referenced Input dir>>>>>>>>>>>>>>>>>>>>>>>>>>>"
for (DirectoryInput dInput : input.directoryInputs) {
println(dInput.file.absolutePath)
}
if (hasAjRt) break
}

println "inputs end<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"

//clean
if (!isIncremental){
outputProvider.deleteAll()
}

if (hasAjRt){
doAspectTransform(outputProvider, inputs)
} else {
if (transformTask.variantName.contains("AndroidTest")){
println "there is no aspectjrt dependencies in classpath, do nothing "
inputs.each {TransformInput input ->
input.directoryInputs.each {DirectoryInput directoryInput->
Expand All @@ -145,6 +160,8 @@ class AspectTransform extends Transform {
println "jarInput = ${jarInput.name}"
}
}
} else {
doAspectTransform(outputProvider, inputs)
}
}

Expand Down
8 changes: 6 additions & 2 deletions build.gradle
Expand Up @@ -17,15 +17,19 @@ allprojects {
repositories {
mavenLocal()
mavenCentral()
jcenter()
jcenter {
url 'http://jcenter.bintray.com'
}
}
}

dependencies {
repositories {
mavenLocal()
mavenCentral()
jcenter()
jcenter {
url 'http://jcenter.bintray.com'
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,6 +1,6 @@
LIB_GROUP=com.hujiang.aspectjx
LIB_ARTIFACT = gradle-android-plugin-aspectjx
LIB_VERSION=1.1.0
LIB_VERSION=1.1.1
LIB_DES=A Gradle plugin which enables AspectJ for Android builds. supports Kotlin, aar, jar aspect
LIB_ISRELEASE=true

Expand Down
Binary file added product/gradle-android-plugin-aspectjx-1.1.1.jar
Binary file not shown.

2 comments on commit ceab272

@greedbell
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@wangzhzh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好!

我们 merge 这个修改之后,会报如下错误:
java.lang.ClassCastException: org.aspectj.apache.bcel.classfile.ConstantClass cannot be cast to org.aspectj.apache.bcel.classfile.ConstantUtf8

请问一下知道是什么原因导致的吗?

谢谢

Please sign in to comment.