-
Notifications
You must be signed in to change notification settings - Fork 80
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
Make Kotlin compileOnly dependency #16
base: master
Are you sure you want to change the base?
Conversation
I believe this PR fixes the issue indeed, however I am not sure it should be fixed in the second level libraries from the IJ POV. If I understand how this works correctly, after this PR I neither think this is a work for rust nor markdown IJ plugins. I think this is a work for |
Yes, that is indeed the case!
Sounds reasonable. @zolotov what do you think? For completeness sake, the jars can be excluded from the plugins with
|
Regarding your last snippet, I would like to emphasize that this is not the particular directly imported module (markdown) problem rather than the general one. So I think something like that could be used to exclude |
Not for me. The markdown plugin explicitly adds |
@valich what's the restriction? |
Hi @zolotov,
As far as I get the current Kotlin ABI compatibility status this is not necessary; also in the SDK tutorial which was already posted here quite the opposite is stated:
As long as I understand there might be incompatibilities theoretically, that will affect so many plugins (mainly the ones built outside of JB) so that this is undesirable.
Well, I suppose if different kotlin classes will be loaded by platform and the plugin this may lead to some CCE or smth similar. Not sure we have a public kotlin-using API at the moment. By the way, I think @yole can shed some light on the matter? |
What is not necessary? Explicitly adding kotlin dependencies? You're right, but this is not the point. The point is that since you have added these dependencies – remove them, make them |
Bundling a Kotlin runtime with a plugin will not cause conflicts (the Kotlin plugin does that because it uses a newer version of the runtime than the one bundled with IDEA), but is unnecessary and in general not recommended. (And actually because plugins can use a newer version of kotlin-runtime, it would be wrong for gradle-intellij-plugin to change the dependency to compileOnly automatically.) |
Dealing with my Kotlin dependencies is problematic (not transparent) in the case of a Kotlinless parent project. But I am not talking about particularly my lib, this is a general problem. Currently any library written in Kotlin used in IJ plugin leads to the need to disable Kotlin dependencies in the build script. Consider a case when some really popular lib (antlr for example) or even corner case where all 3rd party libs are written in Kotlin — then all IJ plugins based on them will require removal of the Kotlin in the scripts. Then why not to do this in Obviously this approach breaks if there's an case when one can't put this in their plugin. (using |
No, why is that? Without this statement the rest comment doesn't make much sense, sorry.
I said why – none of gradle-plugin should change explicitly added dependencies.
You can extrapolate the example that Dmitry bring up. This is not the main reason why I won't implement this, though. The main reason is that it's not a responsibility of gradle-plugins. |
I consider that having two versions of kotlin is what we're trying to avoid. AFAIU gradle does not allow having two versions of the same lib simultaneously in the resolved dependency list (and tries to change versions if any). Is it true that in the case of IJ plugin gradle does not know that IJ already has some kotlin inside? So it does not trigger any resolve mechanism.
But can it add its own dependency for example? May that change explicitly added dependencies' versions which is thus also a dependency change?
How to solve this outside of the plugin? |
I would say that silently changing dependencies can be a little to magical. But it would be prudent to issue a warning (or maybe even fail a build by default) from the I personally don't worry that I need to exclude Kotlin explicitly in my |
I don't understand you at all. So let me answer your questions and then you'll tell me one more time what problem you're trying to solve.
No, gradle allows it
No, it knows
Yes, it can and it does this almost always. Except the case when you add kotlin dependencies explicitly.
No. Explicitly dependencies should not be modified by plugin. Period.
I don't understand what you're going to solve outside the plugin. Please describe your problem one more time with as many details as you can. |
93debc8
to
48f26bc
Compare
949c17e
to
76cec19
Compare
Hi!
build.gradle
specifiescompile
dependency onkotlin-runtime
andkotlin-stdlib
, version 1.0.3. It is propagated toruntime
dependency as well, so any plugin which usesintellij-markdown
, will then bundlekotlin-runtime
andkotlin-stdlib
jars. This happens for Intellij-rust. I believe it also affects https://github.com/JetBrains/intellij-plugins/tree/master/markdown though I have not checked that specifically.And intellij-plugins should not bundle their own Kotlin jars: http://www.jetbrains.org/intellij/sdk/docs/tutorials/kotlin.html#kotlin-gradle-plugin
I believe this PR should fix the issue. An alternative would be to somehow exclude this jar in the plugins themselves.