-
Notifications
You must be signed in to change notification settings - Fork 213
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
WIP: Fix missing jdeps by consistently using collectTypeReferences
#1044
WIP: Fix missing jdeps by consistently using collectTypeReferences
#1044
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
collectTypeReferences
instead of addImplicitDep
collectTypeReferences
instead of addImplicitDep
collectTypeReferences
instead of addImplicitDep
…ncy' failing test, by adding a param to avoid collecting type params for function return types
collectTypeReferences
instead of addImplicitDep
collectTypeReferences
instead of addImplicitDep
@@ -444,6 +444,62 @@ class KotlinBuilderJvmJdepsTest(private val enableK2Compiler: Boolean) { | |||
assertIncomplete(jdeps).isEmpty() | |||
} | |||
|
|||
@Test | |||
fun `kotlin indirect property reference on object 2`() { |
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.
TODO: Rename test case and add additional tests
collectTypeReferences
instead of addImplicitDep
collectTypeReferences
Replaced this PR with #1045 |
Problem
Kotlin jdeps are missing in some cases which is preventing Airbnb from enabling certain compile-time pruning optimizations in our fork of the IntelliJ Bazel Plugin. For example, in the below repro case, Airbnb's IntelliJ Bazel Plugin compile time pruning drops the jar containing
Base
which results in the following compilation error:Without the change in this PR,
ReferencesClassWithSuperClass
has a missing jdep on superclassBase
:Solution
Use
collectTypeReferences
instead of directly callingaddImplicitDep
oraddExplicitDep
ascollectTypeReferences
additionally always adds superclasses as implicit deps.Note that the initial fix originally caused two existing test cases to fail:
This existing test failure seems related to both:
To fix this test, I added
c.addTransitiveDependencies(depWithReturnTypesSuperType)
asSomeSuperType
is required to compileReferencesClassWithSuperClass
.