-
Notifications
You must be signed in to change notification settings - Fork 413
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
Overcome fastutil issue #3409
Overcome fastutil issue #3409
Conversation
@@ -29,6 +29,7 @@ kotlinx-html = "0.9.1" | |||
|
|||
## Markdown | |||
jetbrains-markdown = "0.5.2" | |||
fastutil = "8.5.12" |
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.
just in case, I haven't mentioned it, but this is the same version, which is used in jetbrains-markdown
right now
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.
Does this version need to be aligned with the version of fastutil
from some other dependency, like the version used in jetbrains-markdown
or in kotlin-compiler
?
If it needs to be aligned, I think there should definitely be a comment about it with a link, similar to how it's done for intellij-platform
up above, so that we are not trigger-happy with updating it
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.
Overall, the version should be compatible with what is used in kotlin-compiler
(AFAIK the same version is used in IntelliJ
dependencies) and with markdown-jb
library.
For now, markdown-jb
uses newer version - so I would think we need to align with it.
I will write additional comment here
Thank you for such a detailed explanation, and especially for the in-code comments! Everything makes sense now, and I think this solution is indeed decent given the constraints
oof, this doesn't look right; I must've forgotten about it when breaking analysis down. after #3366 it should be pretty easy to get rid of the dependency on
I think I researched it a bit, and yeah, I definitely remember having problems with it. If I recall correctly, kotlin-compiler ships with its own relocated PSIs, but we actually need PSIs in Java analysis, especially when it comes to inheriting documentation, and so I think I couldn't pass PSIs from |
Note, that in
Hm, yes, that sounds legit. Then, I think, may be we need to somehow discuss with team developing |
That's why the |
fixes #3329
I've added description of the issue directly in code (same for both K1 and K2 modules). Will duplicate/expand on it here:
Related KT issue: https://youtrack.jetbrains.com/issue/KT-47150
What is the issue:
kotlin-compiler
artifact includes unshaded (not-relocated) STRIPPEDfastutil
dependency, STRIPPED here means, that it doesn't provide fullfastutil
classpath, but only a part of it which is used and so when shadowJar task is executed it takes classes fromfastutil
fromkotlin-compiler
and adds it to shadow-jar then adds all other classes fromfastutil
coming frommarkdown-jb
, but becausefastutil
fromkotlin-compiler
is STRIPPED, some classes (likeIntStack
) lacks some methods and so such classes are not replaced afterward byshadowJar
task - it visits every class onceCurrent solution (presented in PR) is to exclude
fastutil
fromshadowJar
and add runtime dependency onfastutil
which will be resolved like if usingruntimeOnly
.This is not ideal solution, as
theoretically
we could have issues with third-party plugins, that could providefastutil
on their side, but I think, that it should be more-or-less fine for now because:fastutil
fastutil
asapi
- and so it will be available in classpath anywayOther ways to fix the issue:
fastutil
in shadow JAR - in this case we will need to create additional shadowJar task, which will first build jar withoutfastutil
fromkotlin-compiler
and then build another shadowJar task which will depend on it + will include fullfastutil
(same as used in markdown lib). There is no now possibility inshadow
plugin to select, from which dependency to get classes, when they differs (because it's really should not happen in real world).kotlin-compiler-embeddable
which shoud correctly embed and shade dependencies (such asfastutil
), but in this case, we should explicitly add other dependencies fromkotlin-compiler
which are relocated inkotlin-compiler-embeddable
- then it will be needed to investigate which dependencies are really used (from my experiment I found, that at least some of the intelliij dependencies will be needed). Though, it gets more complicated with K2 analysis as on current moment there is nokotlin-compiler-embeddable
artifact in declared repositories for version 2.0.0-dev-8561, even kotlin/dev doesn't contain it - most likely analysis API andkotlin/dev
are published independently.fastutil
will be correctly relocated inkotlin-compiler
So, in the end, what is implemented in PR is fine, but if there are some concerns we can do what described above in point1 - other ways are not available at the moment.