Android: add javac intermediates to classpath#3867
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3867 +/- ##
=========================================
Coverage 83.64% 83.64%
Complexity 3116 3116
=========================================
Files 456 456
Lines 8966 8966
Branches 1747 1747
=========================================
Hits 7500 7500
Misses 552 552
Partials 914 914 Continue to review full report at Codecov.
|
picklebento
approved these changes
Jun 12, 2021
picklebento
left a comment
Member
There was a problem hiding this comment.
Thank you for the improvements. I think the long-term goal is to build detekt as a compiler plugin, but we should help improve the existing android integration at the same time.
BraisGabin
approved these changes
Jun 16, 2021
picklebento
pushed a commit
to picklebento/detekt
that referenced
this pull request
Jul 16, 2021
This reverts commit 69749f6
schalkms
pushed a commit
that referenced
this pull request
Jul 16, 2021
This was referenced Aug 12, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the classes from
build/intermediates/javacto the classpath used to compile the code, in order for the compiler to be able to resolve references to Java code (included that which is generated). This resolves issues such as #3488 among probably others.A test is included which enables
viewBindingon a sample project and verifies that the Detekt invocation doesn't produce any errors about unresolved references to the generated classes.Downside: invoking Detekt (with type resolution) now depends on the full assembly of the variant. Before (I think?) this was not a requirement. This is a bit of a trade-off, although in practice I don't think it makes too much of a difference considering the "expensive" type resolution tasks are typically run on CI (we configure Detekt in this way already in a fairly large codebase and haven't found it to be especially burdensome). It would be possible to make this an opt-in option if needed though. 🙃