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
KSP resolves dependencies too early #1568
Comments
I haven't been able to reduce the test case to confirm the root cause yet but commenting out the line you pointed out did make the error away. The fix could be a bit tricky though because, unlike other platforms, |
I played with this a bit, have a possible solution: This branch is off of v13 so it might be a bit different but there were 2 problems:
With these two changes, i can run
I'm not sure if the https://github.com/google/ksp/compare/main...yigit:ksp:yigit/early-classpath-resolution-fix?expand=1 |
I added tests for it, seems like it would merge to the 1.0.14 branch but I'm not sure if that is where i should send the PR for. 1.0.14 is using kotlin 1.9.0 while 1.0.13 is using 1.9.20. Lmk where I should send the PR to and i'll prepare that. |
Btw, I tried using it in AndroidX but it is hitting another problem with configuration cache: https://ge.androidx.dev/s/qv4vctftkgrps
So my solution is not good enough yet 😢 |
ok, fixed that by using a file collection: |
Thanks for the patch! We usually create PRs to main branch, and let them cherry-picked to 1.0.14-release automatically if no conflict, or we cherry-pick it manually. Feel free to keep it with 1.0.14 though. I'll pick it to the main branch. |
👍 . I'm trying to validate this in AndroidX, after that, i'll send a PR. Seems like We also don't have a working processor so it is a bit hard to validate it works :) |
So that is a different problem. this line is returning false for
It seems like https://youtrack.jetbrains.com/issue/KT-61657. Changing that line to:
Fixes that issue. Now the processor runs and fails with a different error: https://ge.androidx.dev/s/zg46diayiniug That error might be still because of KSP, not sure yet. It fails to find https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html |
Ok sent a PR for Note that this is still not enough for AndroidX, i've asked the team to take a look at the java.sql import problem as a followup. |
We are unable to use KSP in AndroidX Multiplatform project.
Here is the repro:
https://android-review.googlesource.com/c/platform/frameworks/support/+/2787012
Build scan
It will fail with an error which is caused by KSP resolving configurations early (my guess)
I think KSP should be configuring its tasks with a provider so that the configuration is only resolved when the task is needed, not when it is configured. The early resolution causes some other AndroidX code to fail so I'm not 100% sure if this is just a KSP issue or an integration problem. But it seems like KSP should avoid resolving these collections at configuration time as they may not necessarily have the files ready yet.
The text was updated successfully, but these errors were encountered: