-
-
Couldn't load subscription status.
- Fork 138
fix: fixes issue 1346 #1347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: fixes issue 1346 #1347
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very reasonable. Thanks for the contribution! Left you a question.
Please note I think you'll have to rebase and fix some (hopefully minor) conflicts after I merge #1349.
| } | ||
|
|
||
| internal fun Iterable<File>.filterToJarFiles(): List<File> { | ||
| return filter { it.extension == "jar" && !it.name.endsWith("R.jar") } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we excluding R.jar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I've excluded R.jar because of the transitive dependencies false positives. For example, if the project uses androidx.appcompat:appcompat:1.1.0 as a dependency, the plugin would report following transitive dependencies, although none of them were really used:
These transitive dependencies should be declared directly:
implementation 'androidx.activity:activity:1.0.0'
implementation 'androidx.appcompat:appcompat-resources:1.1.0'
implementation 'androidx.core:core:1.1.0'
implementation 'androidx.customview:customview:1.0.0'
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'androidx.loader:loader:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
According to usage-dependencies.json this advice was given because of androidx.**.R classes in the R.jar:
Uses 11 classes, 5 of which are shown: androidx.core.R, androidx.core.R$attr, androidx.core.R$color, androidx.core.R$dimen, androidx.core.R$drawable
I've dug a bit deeper and find out that the plugin will add inner's class parent name to the ExplodedClass.nonAnnotationClasses and vice versa (inner class names will be added to the parent class nonAnnotationClasses), I've added a fix similar to the exclusion of the class own name in fixup functions.
| /** Will be empty for this task. */ | ||
| /** May be empty. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the comment!
32dfa7c to
c541d6f
Compare
Do not ignore R.jar file. Filter parent class name for inner class and vice versa.
c541d6f to
d52436f
Compare
|
@autonomousapps Hi, could you take a look at this PR please? |
Fixes the issue #1346.
ClassReferenceParserandgetBinaryAPIextension functions now handlejarfiles as an input alongside with class files. There is a bit of duplication with regard to to reading jar files, maybe it would be better to hide two sources of class files insideAndroidClassesTaskby unpacking jars into intermediate directory. I've also added a test that fails without aforementioned fixes, it is a bit verbose because of the actual implementation of the transform task.