Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork132
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 ourterms of service andprivacy 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?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
autonomousapps left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
@@ -64,6 +64,10 @@ internal fun Iterable<File>.filterToClassFiles(): List<File> { | |||
return filter { it.extension == "class" && !it.name.endsWith("module-info.class") } | |||
} | |||
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 excludingR.jar
?
dkostyrevJan 12, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 excludedR.jar
because of the transitive dependencies false positives. For example, if the project usesandroidx.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 tousage-dependencies.json
this advice was given because ofandroidx.**.R
classes in theR.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 theExplodedClass.nonAnnotationClasses
and vice versa (inner class names will be added to the parent classnonAnnotationClasses
),I've added a fix similar to the exclusion of the class own name infixup
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
toc541d6f
CompareDo not ignore R.jar file.Filter parent class name for inner class and vice versa.
c541d6f
tod52436f
Compare@autonomousapps Hi, could you take a look at this PR please? |
Fixes the issue#1346.
ClassReferenceParser
andgetBinaryAPI
extension functions now handlejar
files 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 insideAndroidClassesTask
by 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.